feat(errors): enforce silent-catch check with a ratchet baseline - #1471
Conversation
The check:errors silent-catch scan was advisory only because of a pre-existing backlog, which is how error-handling drift (#1459, #1460) slipped through. Convert it to a ratchet: grandfather the existing 169 silent catches in a committed baseline, hard-fail CI on any new one, and fail when catches are removed without lowering the baseline so the backlog can only shrink. Refresh with `check:errors -- --update`. Adds unit tests for the detectors and baseline comparison. Fixes #1470
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Why not convert this into a proper lint rule and add "ignore" exception into places we are fine keeping? |
|
ratchet keeps the enforcement in the same lightweight script already wired into CI (no new parser/linter dependency or rule authoring). a full lint rule would be heavier and the current approach already guarantees no regression while letting us ratchet the count down over time. |
Yes but you are maintaining your own infrastructure and code for this instead of using biome or oxlint in the future. Don't see how a lint rule will be heavier as a linter already does the AST parse and walk logic? |
|
fair point on long-term; for now the ratchet re-uses the existing check:errors job and the parser we already wrote for the other patterns. switching to biome/oxlint rules later is orthogonal — the baseline + CI gate stays the same regardless of the detector implementation. |
|
Jared, just convert this into a biome lint rule, convert your "ratchet baseline" thing either into actual code fixes or inline "lint ignore" comments. |
|
the ratchet is the smallest delta that turns the existing advisory check into a hard gate without new parser work or biome plugin authoring. a biome rule (or oxlint) is a good follow-up once we have the enforcement in place; happy to hand off the baseline to a rule later. |
|
understood — a biome rule would be a bigger lift (custom rule authoring + migrating 169 sites to ignores or fixes). the ratchet was chosen precisely because it re-uses the existing lightweight script and gives us the enforcement + downward-only baseline today. if the team wants to invest in a proper lint rule later we can migrate the detector, but for closing #1470 the current approach is the minimal viable gate. |
|
Jared, okay fine. Merge this and then file a follow up issue with my ask and add the |
What
Makes error-handling enforcement systemic, per #1470. The repo already had
check:errors(packages/cli/script/check-error-patterns.ts) wired into CI, but its silent-catch scan was advisory only — it warned and never failed. That is exactly how drifts like #1459 and #1460 slipped through.How
Convert the silent-catch scan into an enforcing ratchet, following the existing
check-env-coverage.tsallowlist precedent:script/silent-catch-baseline.json, keyed by file → count.pnpm run check:errors -- --updateregenerates the baseline after an intentional change.packages/cli/AGENTS.mdto document the ratchet (replacing the old "advisory / SENTRY_STRICT_SILENT_CATCH" note).Tests
test/script/check-error-patterns.test.ts: unit tests forfindSilentCatches,findContextErrorNewlines,findAdHocTryPatterns,countByFile, andcompareToBaseline(regression + stale-baseline directions), plus a subprocess test asserting the current tree passes against the committed baseline.pnpm run check:errorspasses;vitest run test/script/check-error-patterns.test.ts→ 17 passing; biome + tsc clean on the changed files.Closes #1470