huskies: merge 864
This commit is contained in:
+60
-1
@@ -21,7 +21,7 @@ pub mod ops;
|
||||
pub mod shadow_write;
|
||||
|
||||
pub use content_store::{all_content_ids, delete_content, read_content, write_content};
|
||||
pub use ops::{delete_item, move_item_stage, next_item_number, write_item_with_content};
|
||||
pub use ops::{ItemMeta, delete_item, move_item_stage, next_item_number, write_item_with_content};
|
||||
pub use shadow_write::init;
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -320,6 +320,65 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
/// Story 864: `write_item_with_content` no longer parses YAML front-matter
|
||||
/// from `content`. The CRDT metadata reflects ONLY what the caller passes
|
||||
/// via `ItemMeta`. This test writes a body without any front-matter at
|
||||
/// all, sets metadata explicitly, and asserts the CRDT picks up the typed
|
||||
/// values, not anything derived from `content`.
|
||||
#[test]
|
||||
fn write_item_typed_meta_takes_precedence_over_content() {
|
||||
crate::crdt_state::init_for_test();
|
||||
ensure_content_store();
|
||||
let story_id = "9864_story_typed_meta";
|
||||
|
||||
// Body has NO YAML header — just plain markdown.
|
||||
let content = "# Just a heading\n\nNo front matter here.\n";
|
||||
let meta = ItemMeta {
|
||||
name: Some("Typed Name".into()),
|
||||
agent: Some("coder-1".into()),
|
||||
retry_count: Some(2),
|
||||
blocked: Some(true),
|
||||
depends_on: Some(vec![100, 200]),
|
||||
};
|
||||
write_item_with_content(story_id, "2_current", content, meta);
|
||||
|
||||
let view = crate::crdt_state::read_item(story_id).expect("story exists in CRDT");
|
||||
assert_eq!(view.stage, "2_current");
|
||||
assert_eq!(view.name.as_deref(), Some("Typed Name"));
|
||||
assert_eq!(view.agent.as_deref(), Some("coder-1"));
|
||||
assert_eq!(view.retry_count, Some(2));
|
||||
assert_eq!(view.blocked, Some(true));
|
||||
assert_eq!(view.depends_on, Some(vec![100, 200]));
|
||||
|
||||
// Content is stored verbatim (no parsing, no rewrite).
|
||||
assert_eq!(read_content(story_id).as_deref(), Some(content));
|
||||
}
|
||||
|
||||
/// Story 864: passing `ItemMeta::default()` against a content blob that
|
||||
/// LOOKS like front-matter must NOT silently extract metadata into the
|
||||
/// CRDT. The whole point of removing the implicit YAML round-trip is
|
||||
/// that metadata only flows in through the typed `ItemMeta` arg.
|
||||
#[test]
|
||||
fn write_item_default_meta_ignores_yaml_in_content() {
|
||||
crate::crdt_state::init_for_test();
|
||||
ensure_content_store();
|
||||
let story_id = "9864_story_yaml_ignored";
|
||||
|
||||
let content = "---\nname: Should Not Appear\nagent: ghost\n---\n# Body\n";
|
||||
write_item_with_content(story_id, "2_current", content, ItemMeta::default());
|
||||
|
||||
let view = crate::crdt_state::read_item(story_id).expect("story exists in CRDT");
|
||||
assert_eq!(view.stage, "2_current");
|
||||
assert_eq!(
|
||||
view.name, None,
|
||||
"name must come from typed meta, not parsed YAML"
|
||||
);
|
||||
assert_eq!(
|
||||
view.agent, None,
|
||||
"agent must come from typed meta, not parsed YAML"
|
||||
);
|
||||
}
|
||||
|
||||
/// Bug 780: stage transitions must reset retry_count to 0 in the CRDT.
|
||||
/// Carryover from prior-stage retries was tripping the auto-assigner's
|
||||
/// deterministic-merge skip logic.
|
||||
|
||||
Reference in New Issue
Block a user