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::agents::{AgentPool, AgentStatus};
|
||||||
use crate::chat::util::strip_bot_mention;
|
use crate::chat::util::strip_bot_mention;
|
||||||
use crate::db::yaml_legacy::parse_front_matter;
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
/// A parsed assign command from a Matrix message body.
|
/// A parsed assign command from a Matrix message body.
|
||||||
@@ -94,7 +93,7 @@ pub async fn handle_assign(
|
|||||||
agents: &AgentPool,
|
agents: &AgentPool,
|
||||||
) -> String {
|
) -> String {
|
||||||
// Parse: find the story by numeric prefix (CRDT → content store → filesystem).
|
// 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) {
|
match crate::chat::lookup::find_story_by_number(project_root, story_number) {
|
||||||
Some(found) => found,
|
Some(found) => found,
|
||||||
None => {
|
None => {
|
||||||
@@ -102,9 +101,9 @@ pub async fn handle_assign(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let story_name = content
|
// Story name comes from the CRDT name register (story 929).
|
||||||
.or_else(|| crate::db::read_content(&story_id))
|
let story_name = crate::crdt_state::read_item(&story_id)
|
||||||
.and_then(|c| parse_front_matter(&c).ok().and_then(|m| m.name))
|
.and_then(|w| w.name().map(str::to_string))
|
||||||
.unwrap_or_else(|| story_id.clone());
|
.unwrap_or_else(|| story_id.clone());
|
||||||
|
|
||||||
let agent_name = resolve_agent_name(model_str);
|
let agent_name = resolve_agent_name(model_str);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ pub async fn handle_delete(
|
|||||||
agents: &AgentPool,
|
agents: &AgentPool,
|
||||||
) -> String {
|
) -> String {
|
||||||
// Find the story by numeric prefix: CRDT → content store → filesystem.
|
// 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) {
|
match crate::chat::lookup::find_story_by_number(project_root, story_number) {
|
||||||
Some(found) => found,
|
Some(found) => found,
|
||||||
None => {
|
None => {
|
||||||
@@ -69,12 +69,9 @@ pub async fn handle_delete(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let story_name = content
|
// Story name comes from the CRDT name register (story 929).
|
||||||
.and_then(|contents| {
|
let story_name = crate::crdt_state::read_item(&story_id)
|
||||||
crate::db::yaml_legacy::parse_front_matter(&contents)
|
.and_then(|w| w.name().map(str::to_string))
|
||||||
.ok()
|
|
||||||
.and_then(|m| m.name)
|
|
||||||
})
|
|
||||||
.unwrap_or_else(|| story_id.clone());
|
.unwrap_or_else(|| story_id.clone());
|
||||||
|
|
||||||
let outcome = match crate::service::work_item::delete::delete_work_item(
|
let outcome = match crate::service::work_item::delete::delete_work_item(
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ pub async fn handle_start(
|
|||||||
agents: &AgentPool,
|
agents: &AgentPool,
|
||||||
) -> String {
|
) -> String {
|
||||||
// Find the story by numeric prefix: CRDT → content store → filesystem.
|
// 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) {
|
match crate::chat::lookup::find_story_by_number(project_root, story_number) {
|
||||||
Some(found) => found,
|
Some(found) => found,
|
||||||
None => {
|
None => {
|
||||||
@@ -88,12 +88,9 @@ pub async fn handle_start(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let story_name = content
|
// Story name comes from the CRDT name register (story 929).
|
||||||
.and_then(|contents| {
|
let story_name = crate::crdt_state::read_item(&story_id)
|
||||||
crate::db::yaml_legacy::parse_front_matter(&contents)
|
.and_then(|w| w.name().map(str::to_string))
|
||||||
.ok()
|
|
||||||
.and_then(|m| m.name)
|
|
||||||
})
|
|
||||||
.unwrap_or_else(|| story_id.clone());
|
.unwrap_or_else(|| story_id.clone());
|
||||||
|
|
||||||
// Resolve agent name: try "coder-{hint}" first, then the hint as-is.
|
// Resolve agent name: try "coder-{hint}" first, then the hint as-is.
|
||||||
|
|||||||
Reference in New Issue
Block a user