huskies: merge 869

This commit is contained in:
dave
2026-04-29 14:51:00 +00:00
parent b9bb1ff804
commit f3e4d5d072
8 changed files with 148 additions and 8 deletions
@@ -50,14 +50,29 @@ pub(crate) fn spawn_pipeline_advance(
});
}
/// Resolve QA mode from the content store.
/// Resolve QA mode for a story.
///
/// Checks the typed `qa_mode` CRDT register first. If the register holds a
/// recognised value, returns it immediately without touching the content store.
/// Otherwise reads the story content and falls back to YAML front-matter
/// parsing via [`crate::io::story_metadata::resolve_qa_mode_from_content`].
pub(super) fn resolve_qa_mode_from_store(
_project_root: &Path,
story_id: &str,
default: crate::io::story_metadata::QaMode,
) -> crate::io::story_metadata::QaMode {
// CRDT register is the authoritative source; check it before the content store.
if let Some(view) = crate::crdt_state::read_item(story_id)
&& let Some(ref s) = view.qa_mode
&& let Some(mode) = crate::io::story_metadata::QaMode::from_str(s)
{
return mode;
}
// Fall back to YAML front matter for backward compatibility.
if let Some(contents) = crate::db::read_content(story_id) {
return crate::io::story_metadata::resolve_qa_mode_from_content(&contents, default);
return crate::io::story_metadata::resolve_qa_mode_from_content(
story_id, &contents, default,
);
}
default
}