feat/out-of-scope-globs-and-hint: Accept globs in outOfScope*Dirs and hint when configured dirs match nothing#25
Merged
vedanthvdev merged 1 commit intomasterfrom Apr 22, 2026
Conversation
… hint when configured dirs match nothing
The v1.9.13 migration of security-service surfaced a silent trap:
`outOfScopeTestDirs = ['api-test/**']` looked intentional but the
matcher only did literal prefix comparison, so the glob was treated
as a literal path, never bit any file, and an api-test-only MR
escalated to the full unit-test suite. The pilot only noticed after
watching a 30-minute CI run burn on a docs-only branch.
This PR closes both halves of that failure mode.
outOfScopeTestDirs / outOfScopeSourceDirs now accept Ant-style globs
("api-test/**", "**/api-test/**", brace/character alternatives)
alongside the existing literal prefixes. Each list entry is
classified per-entry based on whether it contains a glob metachar, so
migrating adopters can mix both shapes. The literal-prefix branch
preserves the boundary-aware semantics the README already documents
("api-test" never claims "api-test-utils/..."). Matchers are
pre-compiled at PathToClassMapper construction time so per-diff
mapping stays O(files x matchers) instead of re-parsing config
strings per file.
affectedTest --explain now renders a Hint: line when out-of-scope
dirs are configured but the out-of-scope bucket is empty. The hint
is suppressed on empty diffs, on populated buckets, and on
zero-config installs so its rarity is itself a signal -- when you see
it, something is genuinely wrong with your paths or globs, and you
learn about it on the trace instead of after a 30-minute full-suite
CI run. README and CHANGELOG updated to document both knobs.
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.
Summary
outOfScopeTestDirs/outOfScopeSourceDirsnow accept Ant-style globs (api-test/**,**/api-test/**,{api,perf}-test/**) alongside the existing literal directory prefixes. Each list entry is classified per-entry, so migrating adopters can mix both shapes in the same config.affectedTest --explainnow emits aHint:line when out-of-scope dirs are configured but the out-of-scope bucket is empty — the silent-failure trap a real adopter hit on v1.9.13.Why
security-servicemigrated to v1.9.13 withoutOfScopeTestDirs = ['api-test/**']. That looked intentional but the matcher only did literal prefix comparison, so the glob was treated as a literal path, never matched anything, and an api-test-only MR escalated to the full unit-test suite. The pilot only noticed after watching a 30-minute CI run burn on an api-test-only branch.This PR closes both halves of that failure mode:
api-testnever claimsapi-test-utils/...).--explaininstead of in CI scrollback.Implementation notes
PathToClassMapperconstruction (matches howignorePathsare handled), so per-diff mapping stays O(files × matchers) rather than re-parsing config strings per file.*,?,[,{) — anything more exotic falls through to literal-prefix and fails closed (matches nothing), which is safer than inferring glob intent.Test plan
PathToClassMapperTestcases (glob at root, nested**/glob, source-dirs symmetry, literal-prefix regression guard, name-prefix negative guard).AffectedTestTaskExplainFormatTestcases (hint fires for each knob, stays silent on populated bucket / zero config / empty diff)../gradlew checkgreen end-to-end.security-serviceto the new version and swap itsoutOfScopeTestDirsback to glob shape to confirm end-to-end.Doc updates
outOfScopeTestDirsblock to show both shapes, flipped the worked example to the glob form (api-test/**) now that it works.Hint:paragraph under the--explainsection.CHANGELOG.md: Unreleased entry for both changes.