fix(detection): stop reporting broken-symlink fs errors as exceptions#750
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(detection): stop reporting broken-symlink fs errors as exceptions#750posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
During best-effort project-tree traversal (`walkProjectFiles`), broken symlinks (ENOENT) and unreadable entries (EACCES/EPERM) are already caught and skipped, but `reportFsError` still piped them into `analytics.captureException`, turning every benign symlink into an error-tracking issue. Downgrade expected filesystem error codes to a debug log line while still capturing genuinely unexpected failures as exceptions. Generated-By: PostHog Code Task-Id: 2287642a-b5dc-4a9e-9f17-6dabae1215da
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
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.
Problem
The wizard's error tracking was getting flooded with noise from broken symlinks it already handles fine. During warehouse-source detection,
walkProjectFilescallsfs.statSyncon every symlink to resolve its target. A broken symlink (e.g. a stale macOS~/Library/Logs/ims.loglink) makesstatSyncthrowENOENT. The code already catches this and skips the entry — butreportFsErrorthen piped it intoanalytics.captureException, so every benign broken symlink became an error-tracking issue (39 occurrences across 3 users in ~4 hours). It's not a crash; the wizard flow is unaffected — it's pure triage noise, and it recurs for anyone whose tree contains a broken symlink (same for the siblingrealpath/readdircatches on ENOENT/EACCES).Changes
reportFsErrornow distinguishes expected, already-handled filesystem errors from genuine failures. Benign codes from best-effort traversal —ENOENT(broken symlink target gone),EACCES/EPERM(unreadable entry) — are downgraded to a debug log line instead ofcaptureException. Any other code still surfaces as an exception. Traversal behavior is unchanged; only where the error is recorded changes.Test plan
Added
src/utils/__tests__/file-utils.test.tscovering a real broken symlink in a temp dir:EIOreaddir failure still callscaptureExceptionpnpm build && pnpm testgreen;pnpm lintreports 0 errors.Created with PostHog Code from an inbox report.