Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions registry/source-classification.json
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@
"parity/dispatch-route-ticket-v1.json",
"parity/effective-capability-v1/fixture.json",
"parity/policy-detail-disclosure-v0.json",
"scripts/pre1_installed_discovery.py",
"scripts/pre1_package_execution.py",
"scripts/seed_operator_benchmark.py",
"spec/proposals/fixtures/profile-compatibility-v0.json",
Expand Down Expand Up @@ -968,6 +969,7 @@
"parity/effective-capability-v1/fixture.json",
"parity/policy-detail-disclosure-v0.json",
"parity/profile-compatibility-v0.json",
"scripts/pre1_installed_discovery.py",
"scripts/pre1_package_execution.py",
"src/db.rs",
"src/federation.rs",
Expand Down
6 changes: 3 additions & 3 deletions spec/v1.9/release-integrity-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"registry/schemas/safety-moderate-v1-input.json": "0df26d42bd9b96597e69397952af84a08fd60fd36a1963a31e1ca95368b63656",
"registry/schemas/safety-moderate-v1-output.json": "2ad76c1f4fbcff037c68e2478c737da7ca879d60917c52369c5c965339bbe1d5",
"registry/schemas/translate-v1-input.json": "197067000ec2acfeba9ab463c61d733008a302a4a836bebc5ba02eec228823e4",
"registry/source-classification.json": "63706659a0fb14ff4b06040f8e4e384617327bb69a6d063133e4bf126db46f02",
"registry/source-classification.json": "953ef6bad94dd337eea192acd0e36c6ff7b2e94293dcdab08252e0f0a6e04422",
"research/RESEARCH.md": "323dd757c9871aba21bf5933715ee746745fbecfc615d709f046deca7a6b58c5",
"research/native-ai-infrastructure/fixtures/native-framing-fixture-manifest-v1.json": "21ce99931b3e4b9a07bdadb70432c0c8a064497fe4b654c566b77f04378b3ccb",
"research/native-ai-infrastructure/fixtures/native-framing-v1.json": "02cc7bfbd3c238191ca3961aa03d09f143a51a43397e056d496977e5a9bf0471",
Expand Down Expand Up @@ -227,8 +227,8 @@
"tools/check_submission_governance_decision.py": "a249100bf6c2836ea01ceee353fa5c139ecbe0f0b280fe250a86d11137dde9cd",
"tools/manage_release_closure.py": "758c6a3371d032224cc6cf023f280cf4e4380e615898ab3f007413ee433c6680",
"tools/requirements.txt": "c0134412c5344bebbcef0bbe0cd3ed6f94f984f3cf990bb5c9a0ce79123c9e02",
"tools/run_profile_fixture_contract.sh": "0832e7007a69529c610bd7102a1c8be94bf53203c09ed83debdec446a6f450bf",
"tools/test_audit_intent_sources.py": "8286e32879fcf48647f00facc8bca1fbf9a460393e9fc607e50440cd1fae063f",
"tools/run_profile_fixture_contract.sh": "ff197ee2664ff02c37225a1f94f0a96d3f6312719fa6c4d90b8357d2aadc814f",
"tools/test_audit_intent_sources.py": "a66228f6f93131fd10ac2271e80d5b2430ddca7ef652f327f7a176955eb742c9",
"tools/test_clean_room_interoperability_record.py": "2f2cc274dfb5e9503b0d24d91bc5ee2e1878301c464ad3ff65d9afaa267a847b",
"tools/test_compatibility_environment.py": "c5cfb6c4bda7002b500f5b727c4ebd6bcf96052aef5ae8fefd902daf0ed324c8",
"tools/test_conformance_version_truth.py": "5fd46440bd25ec6a38033aac4948265fab3d2edebb18e2d9f25af248a4df82f3",
Expand Down
1 change: 1 addition & 0 deletions tools/run_profile_fixture_contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ python3 tools/check_intent_registry_schema.py
python3 -m unittest discover -s tools -p 'test_intent_registry.py'
python3 -m unittest discover -s tools -p 'test_intent_payload_fixture.py'
python3 tools/audit_intent_sources.py --check
python3 -m unittest discover -s tools -p 'test_audit_intent_sources.py'
python3 -m unittest discover -s tools -p 'test_service_lifecycle_fixture.py'
python3 tools/test_mcp_era_fixture.py
python3 tools/check_e050_client_credential_lifecycle.py
Expand Down
67 changes: 67 additions & 0 deletions tools/test_audit_intent_sources.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
from __future__ import annotations
import contextlib
import io
import json
from pathlib import Path
import sys
import tempfile
import unittest
from unittest.mock import patch
import audit_intent_sources as audit
from audit_intent_sources import classify

class IntentSourceAuditTest(unittest.TestCase):
Expand All @@ -11,5 +19,64 @@ def test_implementation_namespace_remains_a_candidate(self) -> None:
classification, _ = classify("urn:iicp:intent:vendor:chat:v1", set())
self.assertEqual("candidate-unregistered", classification)


class SourceInventoryTests(unittest.TestCase):
def setUp(self):
self.temporary = tempfile.TemporaryDirectory()
self.addCleanup(self.temporary.cleanup)
self.root = Path(self.temporary.name)
(self.root / "registry").mkdir()
canonical = json.loads((audit.ROOT / "registry/intents.json").read_text())
self.urn = next(row["urn"] for row in canonical["intents"]
if row["urn"].endswith(":llm:chat:v1"))
(self.root / "registry/intents.json").write_text(json.dumps(canonical))
self.sources = {self.urn: {"iicp-directory-php": {"scripts/known.py"}}}
self.output = self.root / "registry/source-classification.json"
for replacement in (patch.object(audit, "ROOT", self.root),
patch.object(audit, "OUTPUT", self.output),
patch.object(audit, "occurrences", lambda: self.sources),
patch.object(sys, "argv", ["audit_intent_sources.py", "--check"])):
replacement.start()
self.addCleanup(replacement.stop)
self.output.write_text(json.dumps(audit.render()))

def check(self):
with contextlib.redirect_stdout(io.StringIO()):
return audit.main()

def test_reviewed_source_passes_without_registry_promotion(self):
self.assertEqual(self.check(), 0)
row = audit.render()["records"][0]
self.assertEqual(row["classification"], "canonical")
self.assertEqual(row["disposition"], "present in registry/intents.json")

def test_new_location_for_canonical_intent_still_fails(self):
self.sources[self.urn]["iicp-directory-php"].add("scripts/new.py")
with self.assertRaisesRegex(SystemExit, "unclassified intent source"):
self.check()

def test_new_repository_for_known_intent_still_fails(self):
self.sources[self.urn]["iicp-directory-rust"] = {"scripts/known.py"}
with self.assertRaisesRegex(SystemExit, "unclassified intent source"):
self.check()

def test_unknown_identifier_still_fails(self):
self.sources[self.urn + "/unknown"] = {"iicp-directory-php": {"scripts/known.py"}}
with self.assertRaisesRegex(SystemExit, "unclassified intent observation"):
self.check()

def test_classification_drift_still_fails(self):
value = json.loads(self.output.read_text())
value["records"][0]["classification"] = "candidate-unregistered"
self.output.write_text(json.dumps(value))
with self.assertRaisesRegex(SystemExit, "classification drift"):
self.check()

def test_missing_inventory_still_fails(self):
self.output.unlink()
with self.assertRaisesRegex(SystemExit, "classification is missing"):
self.check()


if __name__ == "__main__":
unittest.main()
Loading