fix: reconcile intake and decision identifiers

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a023c0-a0a3-7c03-b395-5a0d2757214d
This commit is contained in:
tegwick 2026-08-21 22:11:11 +02:00
parent 60f4a5ca93
commit 165fc3d50f
2 changed files with 72 additions and 21 deletions

View file

@ -56,7 +56,12 @@ def test_closed_records_are_not_registrar_work(tmp_path: Path) -> None:
workplan.read_text(encoding="utf-8").replace("status: active", "status: finished"),
encoding="utf-8",
)
assert rr._missing_identifiers(repo) == {"workplans": [], "tasks": []}
assert rr._missing_identifiers(repo) == {
"workplans": [],
"tasks": [],
"intakes": [],
"decisions": [],
}
def test_rejects_dirty_or_unsynced_repository(tmp_path: Path, monkeypatch) -> None:
@ -68,6 +73,34 @@ def test_rejects_dirty_or_unsynced_repository(tmp_path: Path, monkeypatch) -> No
assert dirty.error and dirty.error["code"] == "git_precondition_failed"
def test_missing_scan_includes_intakes_and_decisions(tmp_path: Path) -> None:
repo = _fixture(tmp_path)
records = repo / "intakes" / "records.md"
records.parent.mkdir()
records.write_text(
"""# Records
```yaml
id: DEMO-IN-0001
kind: intake
title: Intake
status: open
```
```yaml
id: DEMO-DEC-0001
kind: decision
title: Decision
status: open
```
""",
encoding="utf-8",
)
missing = rr._missing_identifiers(repo)
assert missing["intakes"] == ["DEMO-IN-0001"]
assert missing["decisions"] == ["DEMO-DEC-0001"]
def test_scopes_registrar_env_and_commits_assigned_ids(tmp_path: Path, monkeypatch) -> None:
repo = _fixture(tmp_path)
monkeypatch.setattr(rr, "_check_primary", lambda _api: ({"status": "ok", "db": "connected"}, None))
@ -91,7 +124,12 @@ def test_scopes_registrar_env_and_commits_assigned_ids(tmp_path: Path, monkeypat
)
assert result.status == "applied"
assert result.evidence["missing_after"] == {"workplans": [], "tasks": []}
assert result.evidence["missing_after"] == {
"workplans": [],
"tasks": [],
"intakes": [],
"decisions": [],
}
subject = subprocess.run(
["git", "log", "-1", "--format=%s"], cwd=repo, capture_output=True, text=True, check=True
).stdout.strip()