40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
|
|
"""C-07 must not fail on rows forge projection retired (railiance-platform, 2026-10-11).
|
||
|
|
|
||
|
|
Retirement stamps the slug with ``@retired-YYYYMMDD`` and sets
|
||
|
|
``projection_retired_at`` but leaves status untouched, so a row retired while
|
||
|
|
blocked stayed blocked and C-07 reported it as an ADR-001 violation the repo
|
||
|
|
could never fix.
|
||
|
|
"""
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import sys
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
sys.path.insert(0, str(Path(__file__).parent.parent / "scripts"))
|
||
|
|
|
||
|
|
import consistency_check # noqa: E402
|
||
|
|
from consistency_check import ConsistencyReport, _check_orphan_db # noqa: E402
|
||
|
|
|
||
|
|
|
||
|
|
def _run(monkeypatch, rows, file_ids=frozenset()):
|
||
|
|
monkeypatch.setattr(consistency_check, "_api_get", lambda *a, **k: rows)
|
||
|
|
report = ConsistencyReport(repo_slug="r", repo_path="/tmp/r")
|
||
|
|
_check_orphan_db("http://hub", "repo-id", set(file_ids), report)
|
||
|
|
return [(i.severity, i.check_id) for i in report.issues]
|
||
|
|
|
||
|
|
|
||
|
|
def test_retired_slug_blocked_row_is_info_not_fail(monkeypatch):
|
||
|
|
rows = [{"id": "038bc3c0-0000", "slug": "railiance-wp-0029@retired-20260826", "status": "blocked"}]
|
||
|
|
assert _run(monkeypatch, rows) == [("INFO", "C-08")]
|
||
|
|
|
||
|
|
|
||
|
|
def test_projection_retired_at_field_is_info_not_fail(monkeypatch):
|
||
|
|
rows = [{"id": "aaaa0000-0000", "slug": "x-wp-0001", "status": "active",
|
||
|
|
"projection_retired_at": "2026-08-26T00:00:00Z"}]
|
||
|
|
assert _run(monkeypatch, rows) == [("INFO", "C-08")]
|
||
|
|
|
||
|
|
|
||
|
|
def test_unretired_open_orphan_still_fails(monkeypatch):
|
||
|
|
rows = [{"id": "bbbb0000-0000", "slug": "x-wp-0002", "status": "blocked"}]
|
||
|
|
assert _run(monkeypatch, rows) == [("FAIL", "C-07")]
|