From 6a767a5cac310edb88fba3dd2521901fc8442da3 Mon Sep 17 00:00:00 2001 From: Anbc <49482824+xiaoan17@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:11:13 +0800 Subject: [PATCH] test(semantics): point the turn_route fixtures at their current owners Two turn_route fixtures in tests/architecture/test_semantic_production.py still named sites that no longer exist. The parametrized return-producer case named 'return LoopXTurnRoute.CONTRACT_ERROR' in driver.py. The driver now assigns the route to a local and returns a call, so the Python producer has no literal left to mutate and the test failed on its own precondition. The route vocabulary's owner is the TypeScript producer, so the case now mutates turn_envelope.ts::turnEnvelopeRoute, whose resolved returns are the route values themselves. The mutation still replaces one returned value with an unregistered one and still expects the scan to reject it, so the invariant the test proves is unchanged; only the fixture that had gone stale moves. The one-hop re-export case named loop_controller.py::_envelope_route. PR #7523 moved that decision into loop_controller.ts and dropped the site from the turn_route producers, so the assertion collected nothing. driver.py still re-exports LoopXTurnRoute from the generated owner and _typed_route is still a registered return producer, so the case now resolves through that hop. No production code, schema, wire or default change. Validation: tests/architecture/test_semantic_production.py 42 passed on origin/main 0a9a3a388. The remaining failures in tests/architecture are pre-existing on that base: the lark import boundary (PR #7631) and two package/vocabulary ratchets this change does not touch. Signed-off-by: xiaoan17 --- tests/architecture/test_semantic_production.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/architecture/test_semantic_production.py b/tests/architecture/test_semantic_production.py index d489d9e562..6cda493d43 100644 --- a/tests/architecture/test_semantic_production.py +++ b/tests/architecture/test_semantic_production.py @@ -153,7 +153,7 @@ def test_declared_return_is_scanned_in_real_python_syntax(): @pytest.mark.parametrize('vocabulary_name, module, original', [ - ('turn_route', 'loopx/control_plane/turn_driver/driver.py', 'return LoopXTurnRoute.CONTRACT_ERROR'), + ('turn_route', 'loopx/control_plane/quota/turn_envelope.ts', 'return "user_action_required";'), ('loop_disposition', 'loopx/control_plane/turn_driver/turn_contract_generated.py', 'return LoopDisposition(value)'), ]) def test_real_return_producer_rejects_an_unregistered_result(vocabulary_name, module, original): @@ -291,11 +291,11 @@ def test_registered_consumer_cannot_replace_a_removed_writer(): def test_real_reexported_turn_owner_is_attributed_through_one_hop(): import json from loopx.semantics.inventory import load_sources - # loop_controller imports LoopXTurnRoute from driver, which re-exports the - # generated owner; the registered return producer must still resolve. + # driver imports LoopXTurnRoute from the generated owner and re-exports it; + # the registered return producer must still resolve through that one hop. v = json.loads((ROOT / 'loopx/semantics/vocabulary_v0.json').read_text(encoding='utf-8'))['vocabularies']['turn_route'] rows = collect_production(ROOT, v, load_sources(ROOT)) - site = 'loopx/control_plane/turn_driver/loop_controller.py::_envelope_route' + site = 'loopx/control_plane/turn_driver/driver.py::_typed_route' resolved = {value for r in rows if r.site == site and not r.unresolved for value in r.values} assert 'user_action_required' in resolved