From 7dda889e5f8755c6ef276356ef78fc5e8f65de1f Mon Sep 17 00:00:00 2001 From: xiaoan17 Date: Thu, 29 Oct 2026 14:51:13 +0800 Subject: [PATCH] test(semantics): derive the output-evidence guard from the registry tests/architecture/test_semantic_vocabulary_drift.py::test_explicit_output_evidence_cannot_be_removed_or_redirected listed the vocabularies whose explicit output evidence must not be removed or redirected. PR #7523 retired the Python output builder behind loop_disposition and dropped that vocabulary's call_producers entry from both the registry and the drift smoke's anchor, but the case here kept naming loop_disposition. With the anchor and the registry both empty for that vocabulary, the mutation the case performs was a no-op, so the coverage floor raised no drift and the case failed on its own precondition: ``` Failed: DID NOT RAISE Drift ``` The case now reads the anchored vocabularies from the registry instead of writing them out, and proves the invariant for every vocabulary that currently carries that metadata. Two things follow. The retired vocabulary can no longer leave the case vacuous, and effective_action - which carries return_paths and was not in the written-out list - is now covered as well. No production code, schema, wire or default change. Validation: tests/architecture/test_semantic_vocabulary_drift.py 124 passed on origin/main 0a9a3a388; ruff clean. Signed-off-by: xiaoan17 --- .../test_semantic_vocabulary_drift.py | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/tests/architecture/test_semantic_vocabulary_drift.py b/tests/architecture/test_semantic_vocabulary_drift.py index a662ce960b..afb3a58711 100644 --- a/tests/architecture/test_semantic_vocabulary_drift.py +++ b/tests/architecture/test_semantic_vocabulary_drift.py @@ -431,19 +431,27 @@ def test_registered_kernel_producer_coverage_cannot_be_removed(name): smoke['check_coverage_floor'](registry) -@pytest.mark.parametrize('metadata,name', [ - ('call_producers', 'loop_disposition'), - ('call_producers', 'agent_scope_frontier_action'), - ('call_producers', 'turn_result_kind'), - ('return_paths', 'turn_route'), - ('return_paths', 'turn_result_kind'), -]) -def test_explicit_output_evidence_cannot_be_removed_or_redirected(metadata, name): +@pytest.mark.parametrize('metadata', ['call_producers', 'return_paths']) +def test_explicit_output_evidence_cannot_be_removed_or_redirected(metadata): + """Every vocabulary that carries explicit output evidence must keep it. + + The anchored vocabularies are read from the registry instead of being + written out here. Evidence that moves to another vocabulary, or is retired + together with its owner, then changes what this case proves instead of + leaving it silently vacuous. + """ smoke = runpy.run_path(str(SMOKE)) registry = copy.deepcopy(smoke['load_registry']()) - registry['vocabularies'][name][metadata] = {} - with pytest.raises(smoke['Drift'], match='anchored output evidence'): - smoke['check_coverage_floor'](registry) + anchored = sorted( + name for name, vocabulary in registry['vocabularies'].items() + if vocabulary.get(metadata) + ) + assert anchored, f"no vocabulary carries {metadata} evidence to protect" + for name in anchored: + mutated = copy.deepcopy(registry) + mutated['vocabularies'][name][metadata] = {} + with pytest.raises(smoke['Drift'], match='anchored output evidence'): + smoke['check_coverage_floor'](mutated) @pytest.mark.parametrize('name', [