fix(desktop): harden workspace watcher fallback#352
Conversation
Keep workspace file subscriptions non-fatal when native fs.watch fails with platform-specific system errors, while preserving explicit handling for unavailable workspaces. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Review mode: initial
Findings
-
[Minor] Missing changeset for a user-visible behavior change — the PR improves the workspace watcher's error handling for additional system error codes (EINVAL, ENOSPC, ERR_FEATURE_UNAVAILABLE_ON_PLATFORM, etc.) and clarifies the missing-workspace logic. This affects the Files panel reliability and should be listed in the changelog.
Suggested fix: runpnpm changeset add --type minor(orpatchif the fix is considered minor) and commit the generated markdown file. -
[Nit] Comment cosmetic change (
—→--) inworkspace-watcher.ts:28is inconsistent with the broader codebase style (most comments use--or–). Not a blocker but consider reverting to match the original intent.
Summary
The PR refactors error code extraction in the workspace watcher, splits the “unavailable workspace” check into its own predicate, and expands the fallback-to-polling error codes to include EINVAL, ENOSPC, and ERR_FEATURE_UNAVAILABLE_ON_PLATFORM. The tests are updated accordingly with parameterized coverage. The change is correct, maintainable, and improves robustness without introducing regressions. The only gap is a missing changeset for a user-visible behavior fix.
Testing
All existing and new parameterized tests pass (pnpm test in apps/desktop). No new integration-level test is required, but adding a simple Vitest test that simulates a real fs.watch rejection with one of the new error codes would strengthen coverage of the fallback path.
Open-CoDesign Bot
Author's PR didn't include a changeset; addressing the bot reviewer's Minor finding post-merge so the next release notes capture the behavior change.
Summary