fix(registrar): contain projection repair writeback

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a023c0-a0a3-7c03-b395-5a0d2757214d
This commit is contained in:
tegwick 2026-08-22 10:05:33 +02:00
parent f8b914a52a
commit 8eff8d3239
2 changed files with 32 additions and 0 deletions

View file

@ -149,6 +149,8 @@ def test_repairs_an_already_identified_workplan_projection(tmp_path: Path, monke
'priority: high\nstate_hub_task_id: "22222222-2222-4222-8222-222222222222"\n```',
)
workplan.write_text(text, encoding="utf-8")
brief = repo / ".custodian-brief.md"
brief.write_text("authoritative local brief\n", encoding="utf-8")
_git(repo, "add", ".")
_git(repo, "commit", "-m", "add authoritative identifiers")
_git(repo, "push")
@ -166,6 +168,7 @@ def test_repairs_an_already_identified_workplan_projection(tmp_path: Path, monke
def fake_run(command, *, env):
assert env["STATEHUB_REGISTRAR"] == "1"
brief.write_text("generated from partial projection\n", encoding="utf-8")
return subprocess.CompletedProcess(command, 1, "legacy stale references remain", "")
monkeypatch.setattr(rr, "_run_statehub", fake_run)
@ -180,3 +183,5 @@ def test_repairs_an_already_identified_workplan_projection(tmp_path: Path, monke
assert result.status == "applied"
assert result.evidence["repair_projection_verified"] is True
assert result.evidence["repair_projection_id"] == "11111111-1111-4111-8111-111111111111"
assert result.evidence["restored_generated_paths"] == [".custodian-brief.md"]
assert brief.read_text(encoding="utf-8") == "authoritative local brief\n"