Repository navigation
refactor(e2e): match exclude globs with Bun.Glob in the oracle - #563
Merged
Merged
Conversation
The fuzz oracle matched discovery exclude globs with a hand-rolled star-backtracking loop (globTarget, globUnitMatches, globMatches) that handled "*", "?", and a leading "!" and read everything else, character classes included, literally. Bun.Glob, the runtime's own glob that arch-lint and a test already use, covers the wildcards, the negation, and the classes. The wrapper keeps the two things the library lacks: the slug-or-name scope split the action's repos-dir pairing defines, and case-insensitivity, which GitHub names have and Bun.Glob does not. The pattern is widened to admit either case the way the action's nocase regex does: a letter outside a class becomes "[xX]", and a class becomes the name characters it admits in either case. Folding the target instead misreads a range that spans the cases: lowercased, "[0-Z]" is "[0-z]" and gains "_". Differential check, the old matcher against the new code and against the action's compileExcludePattern and excludeMatches: every exclude the discovery generator emits over 5000 seeds (1432 scenarios, disc-0 to disc-7) against its pool, 8598 pairs, identical; the oracle test's five patterns over its pools, 50 pairs, identical; a hand-made edge set with every operator, mixed-case ranges, and the forms the action refuses over 26 slugs; and 3000 random grammar-valid patterns over 40 random slugs. Over GitHub-shaped slugs the action accepts 110089 pairs; the new matcher agrees with the action on every one, where the old matcher disagreed on 1277, each a character class it read literally. Old and new differ on no accepted pattern without a class. Every remaining difference is a pattern the action refuses at its input boundary (braces, escapes, runs of stars, unpaired brackets) or a slug GitHub cannot produce. The oracle's coverage widens to character classes, where it now predicts what the action does; no generator emits one today, so no scenario changes outcome. The three new table rows pin the class reading, the mixed-case range, and the leading "!" the runtime now handles.
Contributor
File size check0 over a hard cap (fails), 6 warning(s).
Split the file, wrap the line, shorten or exempt the comment, or list the path in 5 managed file(s) skipped; repo-platform owns them. |
There was a problem hiding this comment.
🟢 Approval recommended
The focused, test-only refactor preserves the supported matching contract, with no blocking defects identified.
No open issues 🎉
What changed in this PR
This PR replaces the e2e oracle's handwritten exclude-glob matcher with Bun.Glob, keeping it independent of the action's matcher while aligning character-class behavior.
Changes:
- Adds case widening that preserves mixed-case range semantics.
- Retains slug-or-name matching scope.
- Adds regression cases for character classes, mixed-case ranges, and leading negation.
| File | Description |
|---|---|
test/e2e/generators/oracle.ts |
Replaces manual glob matching with Bun.Glob and case widening. |
test/e2e/generators/oracle.test.ts |
Adds three exclude-glob regression cases. |
Review effort: Balanced
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 this changes
How
[0-Z]becomes[0-z]and gains_), soeitherCasewidens the pattern instead: a letter becomes[xX], a class the name characters it admits in either case.Bun.Glob, the runtime's own, already used in arch-lint and a test.Proof
!), each seen failing under the old matcher or the lowercase fold; generators 79 pass; e2e 373/373.Technical details
globTarget,globUnitMatches, the oldglobMatches. Added:eitherCaseand the constantsNAME_CHARACTERS,CLASS_OR_LETTER.test/e2e/generators/oracle.ts,test/e2e/generators/oracle.test.ts.