Repository navigation
Select tests of a definition whose decorators changed (0.261.531) - #2023
Merged
Paul Lizer (paullizer) merged 2 commits intoDec 2, 2026
Conversation
…and same-module uses (0.261.530) The pull request for 0.261.524 changed the orchestration planner's prompt and discover_result_aliases, and passed CI without running six test files it broke. select_tests.py did not select them, for three reasons: - The five golden tests call planner.plan_request() on a module from import_module. A changed name counted only when no dot stood before it. - The alias test reaches functions_orchestration_services through HarnessEnvironment in test_support and never names the module. Only a test's own text was read. - A changed name was not followed into the definitions of its own module that use it, so a prompt-only edit selected 3 files and none of the goldens. The selector now follows all three, and the same two forms between application modules (import x as y; from x import name as other). Helper code is followed by definition, and a name counts there only when Python resolves it, so a version bump does not select the files that only check a version floor. Every file selected before is still selected. Over the last 24 pull requests the median selection goes from 300 to 454 files and the mean from 416 to 766. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
select_tests.py cut each top-level definition's source from the def/class line, so decorator lines belonged to no definition. Removing a decorator from one function while editing another in the same module selected only the tests of the other. A definition's source now starts at its first decorator, in top_level_sources and in helper_code. A changed decorator changes the definition, and a definition uses the names in its decorators. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Paul Lizer (paullizer)
merged commit Dec 2, 2026
99fb3e2
into
microsoft:Development
24 of 25 checks passed
Paul Lizer (paullizer)
added a commit
to paullizer/simplechat
that referenced
this pull request
Dec 2, 2026
…lies is now 0.261.532 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Lizer (paullizer)
added a commit
to paullizer/simplechat
that referenced
this pull request
Dec 2, 2026
…61.532); autoscaling defaults are now 0.261.533 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Lizer (paullizer)
added a commit
that referenced
this pull request
Dec 2, 2026
…1.536 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This sits on top of #2019 (
claude/select-tests-helper-paths, 0.261.530), which is still open and rewrites the same file. Until #2019 merges, this pull request's diff also shows its commit; the change here is the last commit only. Merge #2019 first.What was wrong
scripts/select_tests.pychooses the functional test files CI runs for a pull request into Development. It did not see a changed decorator on a top-level function or class as a change to that definition.top_level_sourcescut each definition's source fromnode.lineno, which for a decorated definition is thedef/classline. The decorator lines were in no definition's source:So removing
@login_requiredfroma()while editingb()ran the tests ofb()only. With the decorator as the only change in the module, the selector fell back to the whole module, which was safe.Change
first_line(node)gives the line of a statement's first decorator.top_level_sourcesstarts each definition there.names_usingandclosed_namesread the same sources, so a definition now counts as using the names in its decorators. A decorator runs at import and wraps the function, so a change toswagger_routereaches the top-level handlers that carry it.helper_codecuts test helper definitions the same way and now starts at the first decorator too. Its name sets already included decorator names (ast.walkvisitsdecorator_list); only its text stopped at thedefline. That text is searched for application module references and route URLs, which a decorator can hold (@pytest.mark.parametrize("module", ["functions_documents"])), so the text and the names now cover the same lines.Selection sizes
A change to
scripts/select_tests.pymakes CI run every test file, so these were measured locally withselect.select(changed, known, old_source), one change at a time, old selector against new, on 2,045 test files:config.pyaloneget_auth_securityinswagger_wrapper.pyswagger_routeinswagger_wrapper.pylogin_requiredinfunctions_authentication.pyEvery file selected before is still selected. The version bump and
login_requiredselect identical sets before and after.The growth is small because most route handlers were never affected: 1,031 are defined inside a
register_route_...(app)function, where their decorators are already inside that function's lines. 107 handlers sit at the top level of a blueprint module; those are the ones that now count as usingswagger_routeandget_auth_security.(The version bump baseline was reported as 401 when #2019 was written; it measures 402 on this branch with both the old and the new selector.)
Tests
test_selector_sees_a_changed_decorator_as_a_change_to_its_definitioninfunctional_tests/test_functional_suite_ci_runner.py, with two modules and three tests added toTINY_REPOSITORY: the case above, a decorator removed alone, a decorated class, a decorator removed together with an edit elsewhere, a change to the decorator's own code, and the helper text of a fixture.functional_tests/test_functional_suite_ci_runner.py: 16 passed locally.Documents
docs/explanation/fixes/FUNCTIONAL_TEST_SELECTION_DECORATOR_CHANGES_FIX.md(new)docs/explanation/features/FUNCTIONAL_TEST_SELECTION.md: rule added, the decorator line under "Limits" removed🤖 Generated with Claude Code