Test entity-refusal atomicity of corpus import; doc: repeated-line recovery, attestation owner
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b5ff88f1b0
commit
b453c40a3e
2 changed files with 21 additions and 3 deletions
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:<slug>:<n>`).
|
||||
- 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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue