huskies: merge 869
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user