fix(events): normalize path separators so file.changed globs match on Windows - #966
Merged
will-lamerton merged 1 commit intoAug 30, 2026
Conversation
chokidar reports changed files using the platform separator, so on Windows the router was asked to match a `/`-authored pattern like `docs/**` against `docs\guide.md` — a comparison that can never succeed. Path-scoped `file.changed` subscriptions therefore never fired, and nothing reported a problem: the daemon started, reported healthy and logged nothing, because no code path treats a non-match as an error. The same mismatch ran the other way too. `globToRegex` compiles `*` to `[^/]*`, which does not exclude a backslash, so a root-scoped pattern such as `*.md` matched the nested `sub\a.md` and dispatched an unattended agent run against a file that was deliberately scoped out. Normalize in `FileWatcherSource.emit` rather than only in the matcher, so the router, activity reports and the payload handed to a triggered agent all read one path shape; `matchGlob` normalizes both pattern and path defensively. Once the path uses `/`, `[^/]` stops at a real separator and the over-match disappears along with the under-match. The picomatch swap noted at event-router.ts:100 is left as a follow-up — it is not resolvable as a transitive dependency under pnpm's strict linking and would need adding as a direct one. Closes Nano-Collective#964.
addyCooks
requested review from
Avtrkrb,
akramcodez and
will-lamerton
as code owners
August 26, 2026 19:49
Member
|
Looking great @addyCooks :) |
Contributor
Author
|
Thankyou @will-lamerton ! |
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.
Description
chokidar reports changed files using the platform separator, so on Windows the router was asked to match a
/-authored pattern likedocs/**againstdocs\guide.mda comparison that can never succeed. Path-scopedfile.changedsubscriptions therefore never fired, and nothing reported a problem: the daemon started, reported healthy and logged nothing, because no code path treats a non-match as an error.The same mismatch ran the other way too.
globToRegexcompiles*to[^/]*, which does not exclude a backslash, so a root-scoped pattern such as*.mdmatched the nestedsub\a.mdand dispatched an unattended agent run against a file that was deliberately scoped out.Normalize in
FileWatcherSource.emitrather than only in the matcher, so the router, activity reports and the payload handed to a triggered agent all read one path shape;matchGlobnormalizes both pattern and path defensively. Once the path uses/,[^/]stops at a real separator and the over-match disappears along with the under-match.The picomatch swap noted at
event-router.ts:100is left as a follow-up it is not resolvable as a transitive dependency under pnpm's strict linking and would need adding as a direct one.Closes #964.
Type of Change
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Manual Testing
Checklist