Repository navigation
fix(watch): classify Linux undecodable and nameless inotify events instead of overflowing - #783
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 10:12 PM ET / October 1, 2026, 02:12 UTC (Revision 3). ClawSweeper reviewWhat this changesThe branch classifies undecodable and nameless watcher events on Linux and macOS, routes relevant hints through guarded scans, and adds documentation and cross-platform regression coverage. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main and v0.21.3 still overflow on undecodable Linux names; the merged retirement fix addresses a separate cause. The branch remains useful, and this review found no blocking patch defect. Priority: P2 Review scores
Verification
How this fits togetherThe filesystem watcher receives operating-system notifications beneath an admitted Root. It checks native hints against configured scopes and guarded scans before reporting invalidations or scan failures to callers. flowchart LR
A[Filesystem notifications] --> B[Bounded native hint queue]
B --> C[Scope and alias admission]
D[Admitted Root and watch scopes] --> C
C --> E[Guarded directory scan]
D --> E
E --> F[Scoped invalidation or scan failure]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep guarded Root scans authoritative for child names while preserving scoped detail for Linux directory lifecycle events. Do we have a high-confidence way to reproduce the issue? Yes. The captured packed AWS Linux comparison measured the failure on the published and main baselines, and current-main source shows the unconditional overflow path; this reviewer did not run the reproduction. Is this the best way to solve the issue? Yes. The branch classifies native events before scope admission while leaving name discovery and filesystem access to guarded scans. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 900a77074fcd. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
2ab511f to
9a07946
Compare
Linux treated both undecodable child names and nameless directory self-events as backend overflow. A malformed-byte sibling beside a missing TREE anchor therefore invalidated that subscription despite being unable to match any validated scope component; ordinary directory chmod, rename and deletion also discarded structural detail.
Carry an explicit nameless-child marker through the bounded native queue and callback retry. TypeScript admits it only when that directory's children are selected within a TREE's remaining depth, including observed directory aliases. The guarded scan then fails closed with
invalid-pathif the undecodable name remains present. Ancestor/anchor-only activity is dropped. Non-root Linux self-events become structural hints for the directory; Root self-events, genuine kernel overflow and malformed transport remain conservative. Hints never publish unobserved names or supply child I/O authority.macOS FSEvents previously discarded an undecodable path silently. It now retains the nearest fully decodable directory and uses the same guarded child admission. Windows already fails closed: RDCW decoding overflows on unpaired UTF-16 surrogates, and owned-directory enumeration rejects invalid UTF-16. Its behavior is unchanged and now has explicit surrogate regression tests.
Linux lifecycle measurements, one operation per case: chmod generated one nameless
IN_ATTRIB; rename generated oneIN_MOVE_SELF; deletion generatedIN_DELETE_SELFandIN_IGNORED. Each produced one public overflow before this fix. The packed candidate produces zero public overflows for all three operations and retains structural directory detail. Kernel event counts remain 1 / 1 / 2.Regression coverage includes Rust classification and callback-retry tests, macOS raw-byte decoding, Windows unpaired surrogates, TypeScript scope/depth/exclusion/alias admission, and real Linux events-mode integration driven by guarded
reconcile()checkpoints. This follows the separately landed retirement-isolation fix #782. No release, tag or publication is included.Packed AWS Linux proof (Node 24.21.0, matching the supplied diagnostic): the supplied standalone repro, with only its version assertion/report adapted for the packed candidate, now records missing TREE 0 and unrelated ENTRY 0 overflows. The unmodified original repro against published 0.21.3 and the main baseline both measured 4 / 2, and #782 alone was 2 / 0. Valid-name controls remain 0. Both selected malformed-name TREEs still fail
scan / invalid-pathand close successfully.Validation:
cargo test --workspace --locked,cargo clippy --workspace --locked -- -D warnings,pnpm build && pnpm native:build, all focused Linux watch tests (263 passed), andpnpm check(16,972 passed). macOS Rust tests and Clippy pass, as do 58 focused TypeScript admission/scheduling tests locally. Independent Codex review is clean at P0–P2 after rebasing onto main including #782 and #781.