Assert every {connection_test_id} route enforces the ct:self scope - #71835
Open
potiuk wants to merge 1 commit into
Open
Assert every {connection_test_id} route enforces the ct:self scope#71835potiuk wants to merge 1 commit into
potiuk wants to merge 1 commit into
Conversation
The execution API has two scope-consistency tests for ti:self — a forward one
(routes with the scope have the path parameter) and a dual (routes with the
path parameter have the scope). ct:self only ever got the forward half.
That leaves the gap open in the direction that matters. The forward test walks
routes that already declare ct:self and checks they take {connection_test_id};
a new route that takes {connection_test_id} and declares no scope at all is
invisible to it, because there is nothing to iterate over. Which is exactly how
the ti:self gap on /task-reschedules/{task_instance_id}/start_date survived
until its dual test was added.
Add the missing dual, mirroring test_routes_with_task_instance_id_param_-
enforce_ti_self: check the served OpenAPI spec for every API version, allow
deliberate exemptions through CT_ID_ROUTES_WITHOUT_CT_SELF (empty today), and
assert the check is non-vacuous so it cannot silently pass by matching nothing.
No production change — connection_tests.py already carries ct:self, so this is
preventative. Verified by negative control: removing the scope from the router
fails the new test while the pre-existing forward test still passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
test_routes_with_connection_test_id_param_enforce_ct_self— the missing dual of the existingct:selfroute-consistency test.Why
The execution API has two scope-consistency tests for
ti:self:test_ti_self_routes_have_task_instance_id_paramtest_ct_self_routes_have_connection_test_id_paramtest_routes_with_task_instance_id_param_enforce_ti_selfct:selfonly ever got the forward half, and the missing half is the one that matters.The forward test iterates routes that already declare
ct:selfand checks each takes{connection_test_id}. A new route that takes{connection_test_id}and declares no scope at all is invisible to it — there is simply nothing to iterate. That is precisely how theti:selfgap on/task-reschedules/{task_instance_id}/start_datesurvived until its dual was added in #67628: the forward test was green the entire time.So today
ct:selfsits in the same stateti:selfwas in before that fix.Approach
Mirrors
test_routes_with_task_instance_id_param_enforce_ti_selfexactly, so the two stay easy to read side by side:CT_ID_ROUTES_WITHOUT_CT_SELF(empty today) so an intentional exception is a visible, justified edit rather than a silently missing scope;Production impact
None.
connection_tests.pyalready carriesct:self; this is purely preventative.Verification
Negative control — removed
ct:selffrom theconnection_testsrouter and re-ran:The new test catches it; the pre-existing forward test stays green, which is the gap this closes. Scope restored, full file green (27 passed).
🤖 Generated with Claude Code