diff --git a/crates/weksa/tests/cli.rs b/crates/weksa/tests/cli.rs index b451cee..bfcd2d8 100644 --- a/crates/weksa/tests/cli.rs +++ b/crates/weksa/tests/cli.rs @@ -2276,3 +2276,18 @@ fn the_annotator_flags_decide_the_label() { let dump = out(&weksa(d.path(), &["corpus", "dump"])); assert!(dump.contains("by Some(Operator)"), "{dump}"); } + +#[test] +fn an_import_refused_on_a_cast_entity_leaves_both_stores_untouched() { + let d = tempfile::tempdir().unwrap(); + // entity:tamsin is already held by a cast origin, so the work's PublicDomain + // claim on it (cast position 2, after orsa) is refused by EntityStore::put. + cast_entities(d.path(), &["tamsin"]); + let (w, n) = lantern(d.path(), &["Quiet, both of you."], &["Quiet, both of you."]); + let before = std::fs::read(d.path().join("e.cc")).unwrap(); + let o = weksa(d.path(), &[&["corpus", "import", &w, &n][..], &MODEL].concat()); + assert!(!o.status.success()); + assert!(String::from_utf8_lossy(&o.stderr).contains("a cast entity"), "{}", String::from_utf8_lossy(&o.stderr)); + assert_eq!(std::fs::read(d.path().join("e.cc")).unwrap(), before); + assert!(!d.path().join("c.cc").exists() || CorpusStore::open(&d.path().join("c.cc")).unwrap().all().unwrap().is_empty()); +} diff --git a/docs/name-span-annotation.md b/docs/name-span-annotation.md index a91f646..546d57b 100644 --- a/docs/name-span-annotation.md +++ b/docs/name-span-annotation.md @@ -34,8 +34,9 @@ You are given a work's cast: each member's entity id and the forms the work spel scratch copies before the first write, so a refusal (a parse failure, a span the store judges, a work that repeats a line under case or width folding) leaves the stores untouched. Re-draw the whole answer once, log it, and import - again. A work file repeating a line's text is refused naming both lines; fix - the file (a repeated line cannot be two corpus items). + again. A work file repeating a line's text is refused naming both lines; leave + that line out of the answer file (the rest imports with its numbering intact), + since a repeated line cannot be two corpus items. - A line the answer does not cover is not imported by that run; a later run over other lines of the work does not collide (keys are `item::`). - A line whose own text holds `[[` or `]]` cannot be marked and is refused; it @@ -44,6 +45,8 @@ You are given a work's cast: each member's entity id and the forms the work spel ## Label scope `names_by` labels the spans only, not the line or its speaker. One label per -item: a later attestation is a superseding item with the same text and group. +item: a later attestation would be a superseding item with the same text and +group, but no command writes one yet; question `pd-name-span-attestation` owns +that door. `None` means unrecorded (the cast seeds, `weksa corpus add`, the Dao De Jing bed), not attested.