Check import manifests by hash and name together (INFO-WP-0028 T01-T03)
import-review takes any partner manifest and returns, per concept, whether the name resolves in the ownership index and to which artifact, and per entry whether the pinned SHA-256 matches the blob at the declared source commit. Both run in one pass so neither can be recorded without the other, which is the failure this workplan exists to prevent. It exits non-zero on a finding, reads JSON or YAML, needs no partner checkout, and carries its own limit: resolution proves a name exists and names one owner, nothing more. Accepted manifests are registered under infospace/interfaces/manifests/ as provenance-preserving copies owned by the partner, with the partner revision and retrieval date recorded. Editing a copy to make a check pass is forbidden in the file itself. Validation re-resolves them and reports drift as federation_import_drift, a warning naming the partner rather than an error, because a stale partner pin is not this repository's file to fix. The review kit gains an extension-boundary-review template requiring hash count, resolution count and conflict count as three separate lines, and an operating rule saying one is never evidence of another. Both boundary files carry the standing-check result. Verified live: security-canon resolves 11 of 11, interface-canon 23 of 25 with the two known Interface and Endpoint pins. make check passes with 58 tests, clean validation and those two warnings. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 3588@bnt-lap001 Assistant-Session: 24b80f66-e5a7-4e61-99fe-2d422e6d17da
This commit is contained in:
parent
d1254aabe6
commit
e1a6314131
14 changed files with 513 additions and 7 deletions
|
|
@ -17,6 +17,7 @@ from info_tech_canon.maintenance import (
|
|||
source_evidence,
|
||||
)
|
||||
from info_tech_canon.contracts import coverage
|
||||
from info_tech_canon.federation import import_manifest_review, registered_drift
|
||||
from info_tech_canon.service import (
|
||||
DEFAULT_INFOSPACE_ROOT,
|
||||
concept_declaration_checks,
|
||||
|
|
@ -199,3 +200,41 @@ def test_validation_coverage_reports_the_declaration_ratio():
|
|||
assert report["silent_artifacts"] == ["kernel/itc-kernel-map"]
|
||||
assert report["undeclared"] < report["declared"]
|
||||
assert report["limit"]
|
||||
|
||||
|
||||
def test_import_review_resolves_a_partner_manifest(tmp_path):
|
||||
manifest = DEFAULT_INFOSPACE_ROOT / "interfaces/manifests/security-canon.json"
|
||||
review = import_manifest_review(load_context(), manifest)
|
||||
|
||||
assert review["ok"] is True
|
||||
assert review["resolved"] == review["declared"]
|
||||
assert {entry["hash"] for entry in review["entries"]} == {"match"}
|
||||
|
||||
|
||||
def test_import_review_reports_a_name_its_artifact_does_not_define(tmp_path):
|
||||
source = json.loads(
|
||||
(DEFAULT_INFOSPACE_ROOT / "interfaces/manifests/security-canon.json").read_text())
|
||||
source["imports"][0]["concepts"] = ["Artifact"]
|
||||
manifest = tmp_path / "imports.json"
|
||||
manifest.write_text(json.dumps(source))
|
||||
|
||||
review = import_manifest_review(load_context(), manifest)
|
||||
|
||||
assert review["ok"] is False
|
||||
finding = review["findings"][0]
|
||||
assert finding["concept"] == "Artifact"
|
||||
assert finding["code"] in {"import_wrong_artifact", "import_unowned"}
|
||||
|
||||
|
||||
def test_registered_drift_names_the_partner_not_the_canon():
|
||||
warnings = registered_drift(load_context())
|
||||
|
||||
assert all(item["code"] == "federation_import_drift" for item in warnings)
|
||||
assert {item["partner"] for item in warnings} <= {"interface-canon", "security-canon"}
|
||||
|
||||
|
||||
def test_import_review_cli_exits_non_zero_on_a_finding(capsys):
|
||||
manifest = DEFAULT_INFOSPACE_ROOT / "interfaces/manifests/interface-canon.json"
|
||||
assert main(["import-review", str(manifest)]) == 1
|
||||
payload = json.loads(capsys.readouterr().out)
|
||||
assert [item["concept"] for item in payload["findings"]] == ["Interface", "Endpoint"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue