fix: apply post-v1.9.16 review findings (batch 2)#28
Merged
vedanthvdev merged 1 commit intomasterfrom Apr 22, 2026
Merged
Conversation
Follow-up pass addressing the non-blocking findings from the v1.9.16
code review. Focus is on doc/behaviour parity and covering error
branches the batch-1 fix quietly relied on.
Correctness — symmetric DELETE handling
- GitChangeDetector.uncommittedChanges and stagedChanges now surface
DiffEntry.DELETE through the old path, matching committedChanges.
v1.9.16 patched the committed branch only, which was inert under
its own committed-only defaults but re-opened the silent-skip hole
the moment any adopter flipped includeUncommitted/includeStaged
back on to iterate on a local 'git rm'. All three diff sources now
share one collectPaths helper so future bucketing changes can't
drift between them again.
Coverage for previously-untested error branches
- GitChangeDetector shallow-clone MissingObjectException: exercised
via a synthesised .git/refs/heads/ghost pointing at a SHA that
isn't in the object store — same state JGit sees inside a shallow
clone, without requiring a real shallow-clone fixture.
- PathToClassMapper.isIgnored InvalidPathException: exercised with a
NUL byte in the filename (the portable way to make the default
FileSystem reject a path on any platform).
- Malformed glob in ignorePaths: parity with the existing
outOfScope*Dirs error-message regression test, locks in the
key+index+pattern shape of the IllegalStateException.
- All three branches already shipped correct behaviour in v1.9.16;
this PR adds the coverage that should have been part of that
patch.
Docs
- AffectedTestTask.getTransitiveDepth() now says "Default: 4" with
rationale. v1.9.16 updated TransitiveStrategy and
AffectedTestsExtension but missed this third Javadoc site.
- OutOfScopeMatchers class Javadoc drops the '**' escapes
for '**' (comment-terminator was never a risk — only '*/' is) and
adds a one-liner explaining why the opening-brace escape
'{' is unavoidable.
- hasGlobMetachar now documents why only the opening forms '[' and
'{' count — an unbalanced ']' or '}' in a literal directory name
is a far more likely reality than the user meaning "glob", and
promoting it to glob compilation would convert typo-in-literal
into a build-breaking glob syntax error.
- AffectedTestTask.JAVA_FQN documents the intentional
non-validation of Java reserved words: the discovery strategies
read real filenames, so an FQN shaped like a keyword only arrives
adversarially and Gradle's '--tests' matcher reports "no tests
found" for it, never a compile failure.
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
Follow-up pass on the non-blocking findings from the v1.9.16 code review.
Scope is deliberately narrow — doc/behaviour parity plus coverage for
error branches the batch-1 fix relied on without testing.
Changes
Correctness — symmetric
DELETEhandling across all three diff sourcesGitChangeDetector.uncommittedChangesandstagedChangesnow surfaceDiffEntry.DELETEentries through the old path, the same waycommittedChangeshas since v1.9.16. v1.9.16 patched the committedbranch only, which was inert under its own committed-only defaults but
re-opened the silent-skip hole the moment any adopter flipped
includeUncommittedorincludeStagedback on to iterate on a localgit rm. All three diff sources now share onecollectPathshelper sofuture bucketing changes can't drift between them again.
Coverage for previously-untested error branches
GitChangeDetectorshallow-cloneMissingObjectException— exercisedvia a synthesised
.git/refs/heads/ghostpointing at a SHA that isn'tin the object store. Same state JGit sees inside a shallow clone,
without needing a real shallow-clone fixture.
PathToClassMapper.isIgnoredInvalidPathException— exercised witha NUL byte in the filename (the portable way to make the default
FileSystemreject a path on any platform).ignorePaths— parity test with the existingoutOfScope*Dirserror-message regression, locks in thekey[index]: 'pattern'shape of theIllegalStateException.All three branches already shipped correct behaviour in v1.9.16; this
PR only adds the coverage that should have been part of that patch.
Docs
AffectedTestTask.getTransitiveDepth()Javadoc now saysDefault: 4with the same rationale
TransitiveStrategyandAffectedTestsExtensiongot in v1.9.16 — this was the third site theprevious pass missed.
OutOfScopeMatchersclass Javadoc drops unnecessary**escapes for
**(the Javadoc comment-terminator is*/, not**),and adds a one-liner explaining why the opening-brace escape
{still has to stay.hasGlobMetacharnow documents why only the opening forms[and{count as glob indicators — an unbalanced]or}in a literaldirectory name is far more likely than the user meaning "glob", and
promoting it to glob compilation would turn typo-in-literal into a
build-breaking glob syntax error.
AffectedTestTask.JAVA_FQNnow documents the intentionalnon-validation of Java reserved words: the discovery strategies read
real filenames, so an FQN shaped like a keyword only arrives
adversarially and Gradle's
--testsmatcher reports "no tests found"for it, never a compile failure.
Verification
./gradlew check— green./gradlew javadoc— clean, no new warningsGitChangeDetectorTest#detectsUncommittedDeletesByOldPathGitChangeDetectorTest#detectsStagedDeletesByOldPathGitChangeDetectorTest#explainsShallowCloneWhenBaseObjectMissingPathToClassMapperTest#unparseablePathNameDoesNotCrashIsIgnoredPathToClassMapperTest#malformedIgnorePathsGlobFailsWithHelpfulMessageTest plan
./gradlew checkgreen locallysecurity-servicepilot bumps to the new version and keeps passing