huskies: merge 577_bug_show_command_reads_story_files_from_filesystem_instead_of_crdt

This commit is contained in:
dave
2026-04-15 17:23:22 +00:00
parent 1fe4ca2b7a
commit d80fc143c2
+7 -12
View File
@@ -21,8 +21,8 @@ pub(super) fn handle_show(ctx: &CommandContext) -> Option<String> {
));
}
// Find the story by numeric prefix: CRDT → content store → filesystem.
let (story_id, _stage_dir, path, content) =
// Find the story by numeric prefix: CRDT → content store.
let (story_id, _stage_dir, _path, content) =
match crate::chat::lookup::find_story_by_number(ctx.project_root, num_str) {
Some(found) => found,
None => {
@@ -32,16 +32,11 @@ pub(super) fn handle_show(ctx: &CommandContext) -> Option<String> {
}
};
// `content` is populated from the content store (CRDT/DB path) or read
// from disk during the filesystem fallback. If it is None (story found in
// CRDT but no content-store entry yet), attempt a direct disk read.
Some(
content
.or_else(|| std::fs::read_to_string(&path).ok())
.unwrap_or_else(|| {
format!("Story {story_id} found in pipeline but its content is unavailable.")
}),
)
// `content` comes from the CRDT / content store. If unavailable, report
// it rather than silently reading a stale on-disk copy.
Some(content.unwrap_or_else(|| {
format!("Story {story_id} found in pipeline but its content is unavailable.")
}))
}
#[cfg(test)]