feat: advance repository records and provenance
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a023c0-a0a3-7c03-b395-5a0d2757214d
This commit is contained in:
parent
329af60753
commit
35e86d7b85
24 changed files with 1618 additions and 51 deletions
50
tests/test_identifiers.py
Normal file
50
tests/test_identifiers.py
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from repo_manager.identifiers import derive_work_record_uuid, scan_live_identifier_collisions
|
||||
|
||||
|
||||
def _workplan(path: Path, identifier: str, status: str, task_status: str = "todo") -> None:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(
|
||||
f"""---
|
||||
id: {identifier}
|
||||
title: Test
|
||||
status: {status}
|
||||
---
|
||||
|
||||
## Task
|
||||
|
||||
```task
|
||||
id: {identifier}-T01
|
||||
status: {task_status}
|
||||
```
|
||||
""",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
def test_uuid_derivation_is_stable_and_namespace_scoped() -> None:
|
||||
first = derive_work_record_uuid("helixforge", "RMGR-WP-0005")
|
||||
assert str(first) == "6dcf854e-9229-569d-90f0-2d9df235a61d"
|
||||
assert derive_work_record_uuid("helixforge", "RMGR-WP-0005") == first
|
||||
assert derive_work_record_uuid("client-a", "RMGR-WP-0005") != first
|
||||
with pytest.raises(ValueError):
|
||||
derive_work_record_uuid("Client A", "RMGR-WP-0005")
|
||||
|
||||
|
||||
def test_preflight_blocks_live_collision_but_ignores_archived_history(tmp_path: Path) -> None:
|
||||
one = tmp_path / "one"
|
||||
two = tmp_path / "two"
|
||||
_workplan(one / "workplans" / "one.md", "SHARED-WP-0001", "active")
|
||||
_workplan(two / "workplans" / "two.md", "SHARED-WP-0001", "ready")
|
||||
report = scan_live_identifier_collisions(tmp_path)
|
||||
assert report["ok"] is False
|
||||
assert "SHARED-WP-0001" in report["collisions"]
|
||||
|
||||
_workplan(two / "workplans" / "two.md", "SHARED-WP-0001", "archived")
|
||||
report = scan_live_identifier_collisions(tmp_path)
|
||||
assert report["ok"] is True
|
||||
Loading…
Add table
Add a link
Reference in a new issue