diff --git a/evaluation/standards-effectiveness/generated/suite-inputs.json b/evaluation/standards-effectiveness/generated/suite-inputs.json index d12e6834..58420f4d 100644 --- a/evaluation/standards-effectiveness/generated/suite-inputs.json +++ b/evaluation/standards-effectiveness/generated/suite-inputs.json @@ -7405,7 +7405,7 @@ ] }, { - "digest": "sha256:489fea805dbfd6f84bcb28374b467da192d56243100c0a58d568d9acf6180e08", + "digest": "sha256:146231132e8fbff19b5d917c1268bb75a0195cff4478d0e44df6bf04b8ba6aa2", "path": "tools/standards_engine/contracts/examples/a1-examples.json", "state": "present", "uses": [ @@ -7875,7 +7875,7 @@ ] }, { - "digest": "sha256:7f51e403f03f5c57be8b1ca5736a79bcf139c87dd9eb4703ce3f7e59f1ba3d01", + "digest": "sha256:30eec6a6c472938048821b5669d17e054aa7cdee637647961b4012a380245e62", "path": "tools/standards_engine/tests/test_analysis.py", "state": "present", "uses": [ @@ -14116,7 +14116,7 @@ "path": "evaluation/standards-effectiveness/suite-registry.toml" }, "repository_index": { - "digest": "sha256:25f5d13e9650e10c5bcc198f50ea81aa00f90799ca3f9ba2a5a433a658262229", + "digest": "sha256:96dd89639c5b1a45d6c6692e969cea93338efdd3e5604fb2c2d30e6cfe254fd7", "uses": [ { "check": "python-package-contract", diff --git a/tools/standards_engine/contracts/examples/a1-examples.json b/tools/standards_engine/contracts/examples/a1-examples.json index a697ac1f..1f256f60 100644 --- a/tools/standards_engine/contracts/examples/a1-examples.json +++ b/tools/standards_engine/contracts/examples/a1-examples.json @@ -1274,7 +1274,7 @@ "value": { "kind": "input-contract-result", "purpose": "application", - "interface_version": 47, + "interface_version": 48, "catalog_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "operation": "runtime_info", "root": "RuntimeInfoCall", @@ -1420,7 +1420,7 @@ "value": { "kind": "output-contract-result", "purpose": "authoring", - "interface_version": 47, + "interface_version": 48, "catalog_digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "operation": "review", "dialect": "https://json-schema.org/draft/2020-12/schema", diff --git a/tools/standards_engine/tests/test_analysis.py b/tools/standards_engine/tests/test_analysis.py index 0eeaf032..0ae8a9e6 100644 --- a/tools/standards_engine/tests/test_analysis.py +++ b/tools/standards_engine/tests/test_analysis.py @@ -687,8 +687,39 @@ def apply_ready(readiness_id: str) -> ProposalApplication: } ) ) + # Apply advances this unchanged main checkout to its publication. + self.assertEqual(applied.checkout.status, "current") return engine._authoring.read_application(applied.application.id) + def assert_checkout_presents( + application: ProposalApplication, + present: tuple[str, ...], + absent: tuple[str, ...] = (), + ) -> None: + # Interface 47: HEAD, index and worktree all present the exact + # published candidate, and no other local difference appears. + self.assertEqual( + git_output(repository, ("rev-parse", "HEAD")).strip(), + application.candidate.oid.encode("ascii"), + ) + for path in present: + self.assertEqual( + (repository / path).read_bytes(), + engine._repository.read_file( + application.candidate, RepositoryPath.parse(path) + ), + path, + ) + for path in absent: + self.assertFalse((repository / path).exists(), path) + self.assertEqual( + git_output( + repository, + ("status", "--porcelain=v1", "--untracked-files=all"), + ), + b"", + ) + def assert_commit( application: ProposalApplication, revision: ProposalRevision, @@ -798,7 +829,10 @@ def assert_commit( impact_path: "100644", }, ) - self.assertFalse((repository / standard_path).exists()) + assert_checkout_presents( + create_application, + (standard_path, policy_path, impact_path), + ) facade.close() engine = StandardsEngine.open_repository( @@ -933,7 +967,11 @@ def assert_commit( ) self.assertIn(b"[[tombstone]]", retired_policy) self.assertNotIn(b"[[policy_unit]]", retired_policy) - self.assertFalse((repository / standard_path).exists()) + assert_checkout_presents( + retire_application, + (policy_path,), + absent=(standard_path, impact_path), + ) facade.close() engine = StandardsEngine.open_repository( diff --git a/tools/standards_engine/tests/test_consumer_publication.py b/tools/standards_engine/tests/test_consumer_publication.py index 43021335..b5d05cc0 100644 --- a/tools/standards_engine/tests/test_consumer_publication.py +++ b/tools/standards_engine/tests/test_consumer_publication.py @@ -11,13 +11,23 @@ import subprocess import sys import tempfile +import tomllib import unittest +from tools.standards_engine.standards_engine.tools import INTERFACE_CONTRACT from tools.standards_engine.tests.test_agent_workflow import ROOT, decisions, evidence, prepare_repository from tools.standards_engine.tests import test_proposal_consumers as fixtures from tools.standards_engine.tests.test_proposal_consumers import registration +def installed_interface_version(root): + # The server announces the interface declared by the repository it serves. + # Read that declaration instead of repeating a number that each interface + # edition would otherwise leave stale here. + with (root / INTERFACE_CONTRACT).open('rb') as source: + return tomllib.load(source)['interface_schema_version'] + + class ConsumerPublicationTest(unittest.TestCase): def setUp(self): self.temp = tempfile.TemporaryDirectory(prefix='consumer-publication-') @@ -43,7 +53,8 @@ def rpc(self, method, params, purpose='authoring'): self.assertEqual(process.returncode,0,process.stderr) self.assertEqual(process.stderr,'') responses={row['id']:row for row in map(json.loads,process.stdout.splitlines())} - self.assertIn('interface 47;',responses[1]['result']['instructions']) + self.assertIn(f'interface {installed_interface_version(self.root)};', + responses[1]['result']['instructions']) return responses[2] def call(self,name,arguments,purpose='authoring',error=False):