Skip to content

refactor(e2e): match exclude globs with Bun.Glob in the oracle - #563

Merged
Vivswan merged 1 commit into
mainfrom
refactor/oracle-bun-glob
Oct 27, 2026
Merged

Vivswan merged 1 commit into
mainfrom
refactor/oracle-bun-glob

Conversation

@Vivswan

@Vivswan Vivswan commented Oct 26, 2026

Copy link
Copy Markdown
Owner

What this changes

globTarget + globUnitMatches + a star-backtracking globMatches (44 lines)
  ->  Bun.Glob#match, behind eitherCase (case widening) and the slug-or-name scope split

differential, old against new against the action's own excludeMatches:
  generator excludes, 5000 seeds, 1432 scenarios       8,598 pairs    0 mismatches
  random grammar-valid patterns over GitHub slugs    124,624 pairs    new vs action 0
                                                                      old vs action 1,277: every one a character class the old oracle read literally

How

  • Bun.Glob has no case-insensitive mode, and lowercasing both sides misreads a cross-case range ([0-Z] becomes [0-z] and gains _), so eitherCase widens the pattern instead: a letter becomes [xX], a class the name characters it admits in either case.
  • The one behavior note: the oracle now reads character classes as the action does; it read them literally before, and no generator emits one, so no scenario changes outcome.
  • Library: Bun.Glob, the runtime's own, already used in arch-lint and a test.

Proof

  • Tests: oracle 190 pass with three new rows (a class, a mixed-case range, a leading !), each seen failing under the old matcher or the lowercase fold; generators 79 pass; e2e 373/373.
  • Gates: typecheck, fleet biome 0, member-shape 0, line cap.
Technical details
  • Removed: globTarget, globUnitMatches, the old globMatches. Added: eitherCase and the constants NAME_CHARACTERS, CLASS_OR_LETTER.
  • Out of scope: patterns the action refuses at its input boundary and slugs GitHub cannot produce (two slashes, an empty name, a bare-dot owner or name); there old and new still differ.
  • Files: test/e2e/generators/oracle.ts, test/e2e/generators/oracle.test.ts.

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.
Copilot AI balanced review requested due to automatic review settings October 26, 2026 20:22
@github-actions

Copy link
Copy Markdown
Contributor

File size check

0 over a hard cap (fails), 6 warning(s).

File Size Tier Cap
src/engine/diff.ts:56 11 comment lines warn 10
src/github/api-error.ts:9 11 comment lines warn 10
src/problem.ts:73 18 comment lines warn 10
src/sections/contract/errors.ts:13 11 comment lines warn 10
src/sections/contract/module.ts:55 12 comment lines warn 10
src/sections/shared/list/decl.ts:265 14 comment lines warn 10

Split the file, wrap the line, shorten or exempt the comment, or list the path in .file-size-allow.local with a # reason.

5 managed file(s) skipped; repo-platform owns them.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@Vivswan
Vivswan marked this pull request as ready for review October 26, 2026 20:28
@Vivswan
Vivswan merged commit fe77161 into main Oct 27, 2026
29 checks passed
@Vivswan
Vivswan deleted the refactor/oracle-bun-glob branch October 27, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants