Skip to content

fix(path): match Node minimatch extglobs and normalized paths - #46

Merged
steipete merged 1 commit into
mainfrom
claude/w18b-path-matches-glob
Oct 1, 2026
Merged

steipete merged 1 commit into
mainfrom
claude/w18b-path-matches-glob

Conversation

@steipete

Copy link
Copy Markdown

Make path.matchesGlob use the fork's existing Node-compatible minimatch matcher. Negated extglobs now select production sources correctly, and minimatch's dot-segment normalization makes paths such as ui/src/styles/./base.css match the same policy as their normalized spelling.

The path adapter lazily loads the existing filesystem glob implementation, keeping its POSIX/Windows behavior and retaining a separate last-pattern cache for each adapter. This removes the separate Bun.Glob path implementation without introducing a dependency or editing the vendored minimatch block.

Upstream: scoped oven-sh/bun issue and PR searches for matchesGlob extglobs and normalization found no existing fix. The matcher already in the fork was ported from Node; this change reuses it.

Validation on macOS arm64 against Node 24.21.0:

  • 26,460 differential cases match Node exactly; the clean fork disagrees on 4,582.
  • 163 path tests and 34 filesystem glob tests pass. Sixteen path regression cases fail on the clean fork. The vendored Node path-glob test passes under both runtimes.
  • Independent review found no actionable P0–P2 defects; formatting, JavaScript lint and built-in TypeScript checks pass.

OpenClaw consumer proof at 9280c615c0c3b, with private HOME/state and mode-0700 TMPDIR on every run:

Consumer file Before (pass/fail) After (pass/fail)
test/scripts/ci-changed-node-test-plan.config-fallback.test.ts 51/1 52/0
test/scripts/ci-changed-node-test-plan.integration.test.ts 11/1 12/0
test/scripts/ci-changed-node-test-plan.source-owners.test.ts 85/11 96/0
test/scripts/ci-changed-node-test-plan.test.ts 89/1 90/0
test/scripts/ci-node-test-plan.test.ts 112/1 113/0

The first baseline source-owner run hit its no-output guard under heavy host load; rerunning the file alone completed and reproduced the 11 failures shown above. All five patched consumer files pass (363 tests).

Reuse the existing filesystem minimatch implementation lazily from node:path,
with separate last-pattern caches for POSIX and Windows. Remove the separate
Bun.Glob adapter so negated extglobs and dot-segment normalization follow
Node's matcher configuration.

A 26,460-case comparison matches Node 24 exactly (4,582 baseline mismatches).
The path suite passes 163 tests, including 16 regressions that fail unpatched.
Independent review, built-in type checks and JavaScript lint pass.
@steipete
steipete force-pushed the claude/w18b-path-matches-glob branch from 4c806c4 to b1b7140 Compare October 1, 2026 07:16
@steipete
steipete merged commit b02bb8a into main Oct 1, 2026
4 checks passed
@steipete
steipete deleted the claude/w18b-path-matches-glob branch October 1, 2026 07:20
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.

1 participant