Skip to content

Commit 623146c

Browse files
xiaoan17xiaoan17
andauthored
test(semantics): derive the output-evidence guard from the registry (#7640)
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 0a9a3a3; ruff clean. Signed-off-by: xiaoan17 <anbc1224@gmail.com> Co-authored-by: xiaoan17 <anbc1224@gmail.com>
1 parent f45acd4 commit 623146c

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

‎tests/architecture/test_semantic_vocabulary_drift.py‎

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -431,19 +431,27 @@ def test_registered_kernel_producer_coverage_cannot_be_removed(name):
431431
smoke['check_coverage_floor'](registry)
432432

433433

434-
@pytest.mark.parametrize('metadata,name', [
435-
('call_producers', 'loop_disposition'),
436-
('call_producers', 'agent_scope_frontier_action'),
437-
('call_producers', 'turn_result_kind'),
438-
('return_paths', 'turn_route'),
439-
('return_paths', 'turn_result_kind'),
440-
])
441-
def test_explicit_output_evidence_cannot_be_removed_or_redirected(metadata, name):
434+
@pytest.mark.parametrize('metadata', ['call_producers', 'return_paths'])
435+
def test_explicit_output_evidence_cannot_be_removed_or_redirected(metadata):
436+
"""Every vocabulary that carries explicit output evidence must keep it.
437+
438+
The anchored vocabularies are read from the registry instead of being
439+
written out here. Evidence that moves to another vocabulary, or is retired
440+
together with its owner, then changes what this case proves instead of
441+
leaving it silently vacuous.
442+
"""
442443
smoke = runpy.run_path(str(SMOKE))
443444
registry = copy.deepcopy(smoke['load_registry']())
444-
registry['vocabularies'][name][metadata] = {}
445-
with pytest.raises(smoke['Drift'], match='anchored output evidence'):
446-
smoke['check_coverage_floor'](registry)
445+
anchored = sorted(
446+
name for name, vocabulary in registry['vocabularies'].items()
447+
if vocabulary.get(metadata)
448+
)
449+
assert anchored, f"no vocabulary carries {metadata} evidence to protect"
450+
for name in anchored:
451+
mutated = copy.deepcopy(registry)
452+
mutated['vocabularies'][name][metadata] = {}
453+
with pytest.raises(smoke['Drift'], match='anchored output evidence'):
454+
smoke['check_coverage_floor'](mutated)
447455

448456

449457
@pytest.mark.parametrize('name', [

0 commit comments

Comments
 (0)