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
+6 -11
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. // Find the story by numeric prefix: CRDT → content store.
let (story_id, _stage_dir, path, content) = let (story_id, _stage_dir, _path, content) =
match crate::chat::lookup::find_story_by_number(ctx.project_root, num_str) { match crate::chat::lookup::find_story_by_number(ctx.project_root, num_str) {
Some(found) => found, Some(found) => found,
None => { 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 // `content` comes from the CRDT / content store. If unavailable, report
// from disk during the filesystem fallback. If it is None (story found in // it rather than silently reading a stale on-disk copy.
// CRDT but no content-store entry yet), attempt a direct disk read. Some(content.unwrap_or_else(|| {
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.") format!("Story {story_id} found in pipeline but its content is unavailable.")
}), }))
)
} }
#[cfg(test)] #[cfg(test)]