fix(orchestrate): correct trigger glob matching for recursive and single-star patterns - #446
Merged
Merged
Conversation
…gle-star patterns detectChanges reused a hand-rolled matchGlob that matched a recursive suffix glob (`**/*.go`, `pkg/**/*.ts`) against the literal suffix, so it never matched a real file and a needed build/deploy was silently skipped. The single-`*` branch used an unanchored substring search, so `*` crossed `/` and `foo*bar` matched `xfooybar`, over-triggering runs. Delegate matchGlob to the shared config.MatchGlobPattern evaluator (already used by internal/changes) so CLI-side change detection agrees with the emitted GitHub Actions paths filter: single `*` stays within one segment and `**` expands across any number of segments. Add table cases for the recursive-glob and anchoring behaviour. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.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.
Problem
The orchestrator's hand-rolled
matchGlobmishandled two common trigger forms. Its**branch compared paths against the recursive-glob suffix literally, so a trigger like**/*.goorpkg/**/*.tsnever matched any real file. Change-detection then reported "no changes," silently skipping a build or deploy that had genuine changes, so a release could advance without the changed code. Its single-*branch used substring search, so*matched across/and the match was unanchored, over-matching triggers and forcing needless re-runs.Fix
Replace the ad-hoc matcher with correct per-segment glob semantics: anchored matching,
*bounded to a single path segment, and proper**recursive handling. Add table-driven tests covering**/*.go,pkg/**/*.ts,a/*/b, and the previous over-match cases.Verification
go build ./...,go test ./... -race -count=1, andgolangci-lint run ./...all clean locally, including the new glob table tests.