test(corpus): a rebuild with log.md present reproduces the bundle exactly
`log.md` is written INTO a directory Door B enumerates on the next round: it matches the concept glob and is excluded only by `index.md`'s name, so a rebuild could have seen it as pre-existing curated content or pruned it. Rebuild-equals-incremental is the property the segmented bundle rests on. Measured on the real artifact, not only the synthetic: the K2 corpus was run a second time into the same bundle and compared against a snapshot with `diff -r`, exit 0 over all 1108 files. The test pins the same property in seconds instead of 13 minutes. Also corrects the report's reproduction command -- it documented plan filenames the run did not use, and re-running it into the existing plans directory would leave two files claiming one `source_sha256`, which `_resolve_plans` refuses. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
5628467be0
commit
2a2eb9c8bd
2 changed files with 72 additions and 7 deletions
|
|
@ -321,3 +321,49 @@ def test_without_a_plan_directory_the_run_is_unchanged(tmp_path: Path) -> None:
|
|||
concepts = [path for path in bundle.rglob("*.md") if path.name not in ("index.md", "log.md")]
|
||||
assert len(concepts) == 1
|
||||
assert "adjudication:" not in concepts[0].read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_a_second_run_into_the_same_bundle_reproduces_it_byte_for_byte(tmp_path: Path) -> None:
|
||||
"""`log.md` is a file the harness writes INTO a directory Door B enumerates
|
||||
on the next round: it matches the concept glob and is excluded only by
|
||||
`index.md`'s name, so a rebuild could see it as pre-existing curated content
|
||||
or prune it. Rebuild-equals-incremental is the property the segmented bundle
|
||||
is built on, and a log that broke it would be worse than no log.
|
||||
"""
|
||||
root = corpus(tmp_path, {"doc.md": SEGMENTABLE, "flat.md": SUBSTANTIVE})
|
||||
plans = tmp_path / "plans"
|
||||
plans.mkdir()
|
||||
_propose(root / "doc.md", plans / "doc.json")
|
||||
bundle = tmp_path / "bundle"
|
||||
argv = [
|
||||
"--corpus",
|
||||
str(root),
|
||||
"--report",
|
||||
str(tmp_path / "r.md"),
|
||||
"--bundle",
|
||||
str(bundle),
|
||||
"--ingested-at",
|
||||
INGESTED_AT,
|
||||
"--plans-dir",
|
||||
str(plans),
|
||||
"--bundle-id",
|
||||
"k2",
|
||||
"--okf-version",
|
||||
"0.2",
|
||||
]
|
||||
|
||||
assert okf_corpus_run.main(argv) == 0
|
||||
first = {
|
||||
path.relative_to(bundle).as_posix(): path.read_bytes()
|
||||
for path in sorted(bundle.rglob("*"))
|
||||
if path.is_file()
|
||||
}
|
||||
assert "log.md" in first
|
||||
|
||||
assert okf_corpus_run.main(argv) == 0
|
||||
second = {
|
||||
path.relative_to(bundle).as_posix(): path.read_bytes()
|
||||
for path in sorted(bundle.rglob("*"))
|
||||
if path.is_file()
|
||||
}
|
||||
assert second == first
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue