feat(consistency): consume repo-manager conformance
All checks were successful
CI Smoke / host-smoke (push) Successful in 1s
CI Smoke / container-smoke (push) Successful in 1s

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:34:24 +02:00
parent ec780c05a2
commit b9d9ffed5f
2 changed files with 93 additions and 0 deletions

View file

@ -12,6 +12,7 @@ No network calls, no DB, no live API — these tests run fully offline.
"""
from __future__ import annotations
import json
import os
import shutil
import subprocess
@ -33,6 +34,7 @@ from consistency_check import (
_BACKGROUND_CHECKS,
_api_get,
_check_scope_freshness,
_check_repo_manager_conformance,
_detect_behind_remote,
_git_pull,
_patch_frontmatter_field,
@ -69,6 +71,42 @@ class TestResolveTopicDomainSlug:
assert resolve_topic_domain_slug("custodian", repo_market_domain="infotech") == "infotech"
class TestRepoManagerConformanceAdapter:
def test_surfaces_repo_manager_findings_without_reimplementing_rules(self, tmp_path, monkeypatch):
rmgr = tmp_path / "rmgr"
rmgr.write_text("stub", encoding="utf-8")
monkeypatch.setenv("RMGR_BIN", str(rmgr))
payload = {
"ok": False,
"findings": [
{
"code": "intent-and-goal",
"severity": "contradictory",
"path": "INTENT.md",
"message": "project flavor forbids both purpose files",
}
],
}
monkeypatch.setattr(
"consistency_check.subprocess.run",
lambda *args, **kwargs: subprocess.CompletedProcess(args[0], 1, json.dumps(payload), ""),
)
report = ConsistencyReport(repo_slug="demo", repo_path=str(tmp_path))
_check_repo_manager_conformance(tmp_path, report)
assert len(report.warnings) == 1
assert report.warnings[0].check_id == "C-35"
assert "project flavor forbids" in report.warnings[0].message
def test_missing_adapter_is_informational(self, tmp_path, monkeypatch):
monkeypatch.setenv("RMGR_BIN", str(tmp_path / "missing"))
monkeypatch.setattr("consistency_check.shutil.which", lambda _name: None)
monkeypatch.setattr(Path, "home", classmethod(lambda cls: tmp_path))
report = ConsistencyReport(repo_slug="demo", repo_path=str(tmp_path))
_check_repo_manager_conformance(tmp_path, report)
assert len(report.infos) == 1
assert report.infos[0].check_id == "C-35"
# ---------------------------------------------------------------------------
# parse_frontmatter
# ---------------------------------------------------------------------------