wip(929): stage 2 — migrate chat/transport/matrix/* off yaml_legacy
delete.rs, start.rs, assign.rs all looked up the story name by reading
the content from disk/store and parsing the front matter. Replaced with
`crdt_state::read_item(&story_id).and_then(|w| w.name())`. Each callsite's
fallback chain ("CRDT → content store → filesystem") still locates the
story_id; only the name extraction moved off YAML.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
|
||||
use crate::agents::{AgentPool, AgentStatus};
|
||||
use crate::chat::util::strip_bot_mention;
|
||||
use crate::db::yaml_legacy::parse_front_matter;
|
||||
use std::path::Path;
|
||||
|
||||
/// A parsed assign command from a Matrix message body.
|
||||
@@ -94,7 +93,7 @@ pub async fn handle_assign(
|
||||
agents: &AgentPool,
|
||||
) -> String {
|
||||
// Parse: find the story by numeric prefix (CRDT → content store → filesystem).
|
||||
let (story_id, _stage_dir, _path, content) =
|
||||
let (story_id, _stage_dir, _path, _content) =
|
||||
match crate::chat::lookup::find_story_by_number(project_root, story_number) {
|
||||
Some(found) => found,
|
||||
None => {
|
||||
@@ -102,9 +101,9 @@ pub async fn handle_assign(
|
||||
}
|
||||
};
|
||||
|
||||
let story_name = content
|
||||
.or_else(|| crate::db::read_content(&story_id))
|
||||
.and_then(|c| parse_front_matter(&c).ok().and_then(|m| m.name))
|
||||
// Story name comes from the CRDT name register (story 929).
|
||||
let story_name = crate::crdt_state::read_item(&story_id)
|
||||
.and_then(|w| w.name().map(str::to_string))
|
||||
.unwrap_or_else(|| story_id.clone());
|
||||
|
||||
let agent_name = resolve_agent_name(model_str);
|
||||
|
||||
@@ -61,7 +61,7 @@ pub async fn handle_delete(
|
||||
agents: &AgentPool,
|
||||
) -> String {
|
||||
// Find the story by numeric prefix: CRDT → content store → filesystem.
|
||||
let (story_id, stage, _path, content) =
|
||||
let (story_id, stage, _path, _content) =
|
||||
match crate::chat::lookup::find_story_by_number(project_root, story_number) {
|
||||
Some(found) => found,
|
||||
None => {
|
||||
@@ -69,12 +69,9 @@ pub async fn handle_delete(
|
||||
}
|
||||
};
|
||||
|
||||
let story_name = content
|
||||
.and_then(|contents| {
|
||||
crate::db::yaml_legacy::parse_front_matter(&contents)
|
||||
.ok()
|
||||
.and_then(|m| m.name)
|
||||
})
|
||||
// Story name comes from the CRDT name register (story 929).
|
||||
let story_name = crate::crdt_state::read_item(&story_id)
|
||||
.and_then(|w| w.name().map(str::to_string))
|
||||
.unwrap_or_else(|| story_id.clone());
|
||||
|
||||
let outcome = match crate::service::work_item::delete::delete_work_item(
|
||||
|
||||
@@ -80,7 +80,7 @@ pub async fn handle_start(
|
||||
agents: &AgentPool,
|
||||
) -> String {
|
||||
// Find the story by numeric prefix: CRDT → content store → filesystem.
|
||||
let (story_id, _stage_dir, _path, content) =
|
||||
let (story_id, _stage_dir, _path, _content) =
|
||||
match crate::chat::lookup::find_story_by_number(project_root, story_number) {
|
||||
Some(found) => found,
|
||||
None => {
|
||||
@@ -88,12 +88,9 @@ pub async fn handle_start(
|
||||
}
|
||||
};
|
||||
|
||||
let story_name = content
|
||||
.and_then(|contents| {
|
||||
crate::db::yaml_legacy::parse_front_matter(&contents)
|
||||
.ok()
|
||||
.and_then(|m| m.name)
|
||||
})
|
||||
// Story name comes from the CRDT name register (story 929).
|
||||
let story_name = crate::crdt_state::read_item(&story_id)
|
||||
.and_then(|w| w.name().map(str::to_string))
|
||||
.unwrap_or_else(|| story_id.clone());
|
||||
|
||||
// Resolve agent name: try "coder-{hint}" first, then the hint as-is.
|
||||
|
||||
Reference in New Issue
Block a user