test(evidence): harden owner gate acceptance
This commit is contained in:
@@ -141,47 +141,52 @@ run_git("add", "evidence")
|
||||
run_git("commit", "-qm", "baseline human-reviewed curated evidence")
|
||||
baseline_formula = run_git("show", "HEAD:evidence/curated/formula/fascia-pediatrica.md").stdout
|
||||
fixture_target.write_text(fixture_target.read_text(encoding="utf-8") + "\nNota revisionata.\n", encoding="utf-8")
|
||||
second = prepare_workspace_evidence(workspace, restructurer=fake, git_status=lambda _: ())
|
||||
second = prepare_workspace_evidence(workspace, restructurer=fake)
|
||||
assert second.model_calls == 1 and second.changed == ("source/notes/poorly-structured.md",)
|
||||
changed_paths = set(run_git("diff", "--name-only").stdout.splitlines())
|
||||
assert "evidence/manifest.yaml" in changed_paths
|
||||
assert "evidence/curated/formula/fascia-pediatrica.md" in changed_paths
|
||||
assert run_git("show", "HEAD:evidence/curated/formula/fascia-pediatrica.md").stdout == baseline_formula
|
||||
run_git("add", "evidence")
|
||||
run_git("commit", "-qm", "proposed fake restructuring")
|
||||
|
||||
snapshot = {
|
||||
path.relative_to(workspace): path.read_bytes()
|
||||
for path in (workspace / "evidence").rglob("*") if path.is_file()
|
||||
}
|
||||
no_op = prepare_workspace_evidence(workspace, restructurer=fake, git_status=lambda _: ())
|
||||
no_op = prepare_workspace_evidence(workspace, restructurer=fake)
|
||||
assert no_op.model_calls == 0 and no_op.changed == ()
|
||||
assert snapshot == {
|
||||
path.relative_to(workspace): path.read_bytes()
|
||||
for path in (workspace / "evidence").rglob("*") if path.is_file()
|
||||
}
|
||||
|
||||
curated_path = workspace / "evidence" / "curated" / "formula" / "fascia-pediatrica.md"
|
||||
curated_path.write_text(curated_path.read_text(encoding="utf-8") + "\n", encoding="utf-8")
|
||||
try:
|
||||
prepare_workspace_evidence(
|
||||
workspace, restructurer=fake, git_status=lambda _: (" M evidence/curated/formula/fascia-pediatrica.md",),
|
||||
)
|
||||
prepare_workspace_evidence(workspace, restructurer=fake)
|
||||
except EvidencePreparationError as failure:
|
||||
assert failure.code == "authoring_worktree_dirty"
|
||||
else:
|
||||
raise AssertionError("dirty curated state was not refused")
|
||||
run_git("checkout", "--", "evidence/curated")
|
||||
|
||||
manifest_path = workspace / "evidence" / "manifest.yaml"
|
||||
manifest_path.write_text(
|
||||
manifest_path.read_text(encoding="utf-8").replace("evidence-authoring-v1", "evidence-authoring-v2"),
|
||||
encoding="utf-8",
|
||||
)
|
||||
run_git("add", "evidence/manifest.yaml")
|
||||
run_git("commit", "-qm", "incompatible authoring pipeline")
|
||||
incompatible = manifest_path.read_bytes()
|
||||
try:
|
||||
prepare_workspace_evidence(workspace, restructurer=fake, git_status=lambda _: ())
|
||||
prepare_workspace_evidence(workspace, restructurer=fake)
|
||||
except EvidencePreparationError as failure:
|
||||
assert failure.code == "pipeline_upgrade_required"
|
||||
else:
|
||||
raise AssertionError("incompatible pipeline version was not refused")
|
||||
assert manifest_path.read_bytes() == incompatible
|
||||
upgrade = prepare_workspace_evidence(workspace, restructurer=fake, git_status=lambda _: (), upgrade=True)
|
||||
upgrade = prepare_workspace_evidence(workspace, restructurer=fake, upgrade=True)
|
||||
assert upgrade.model_calls == 2 and set(upgrade.changed) == {
|
||||
"source/notes/independent.md", "source/notes/poorly-structured.md",
|
||||
}
|
||||
@@ -198,6 +203,7 @@ PY
|
||||
cd "$repo_root/harness"
|
||||
.venv/bin/pytest -q \
|
||||
tests/test_evidence_restructuring_fixture.py \
|
||||
tests/test_evidence_candidate_publication.py \
|
||||
tests/test_evidence_authoring.py \
|
||||
tests/test_evidence_canonical.py \
|
||||
tests/test_evidence_pi_restructurer.py \
|
||||
|
||||
Reference in New Issue
Block a user