This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
fix(telemetry): add debug logging to silent catch blocks in completion-telemetry - #1459
Merged
Merged
Conversation
…n-telemetry Both queueCompletionTelemetry and drainCompletionTelemetry had catch blocks that silently swallowed errors without any logging. Per AGENTS.md, every catch block must log with at least log.debug() for diagnostic visibility. When the database is corrupted or locked, these errors vanished silently, making debugging impossible. Add logger import and log.debug() calls to both catch blocks so failures are visible with --verbose. Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
marked this pull request as ready for review
August 25, 2026 08:50
BYK
approved these changes
Aug 25, 2026
jared-outpost Bot
added a commit
that referenced
this pull request
Aug 25, 2026
## 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.ts` allowlist precedent: - Grandfather the current backlog (169 silent catches across 84 files) into a committed baseline, `script/silent-catch-baseline.json`, keyed by file → count. - A **new** silent catch (a file exceeding its baseline count, or a file not in the baseline at all) now **fails CI**. - Removing silent catches **without** lowering the baseline also fails, so the baseline stays honest and can only ratchet down. - `pnpm run check:errors -- --update` regenerates the baseline after an intentional change. - Refactored the script to export its detectors and baseline logic so they're unit-testable; the standalone CLI behavior is unchanged. - Updated `packages/cli/AGENTS.md` to document the ratchet (replacing the old "advisory / SENTRY_STRICT_SILENT_CATCH" note). ## Tests - New `test/script/check-error-patterns.test.ts`: unit tests for `findSilentCatches`, `findContextErrorNewlines`, `findAdHocTryPatterns`, `countByFile`, and `compareToBaseline` (regression + stale-baseline directions), plus a subprocess test asserting the current tree passes against the committed baseline. - `pnpm run check:errors` passes; `vitest run test/script/check-error-patterns.test.ts` → 17 passing; biome + tsc clean on the changed files. Closes #1470 <!-- Plan: check:errors already existed and ran in CI (.github/workflows/ci.yml) but silent-catch was advisory (169-item backlog), so new drift was invisible to CI. Fix = ratchet baseline (same pattern as check-env-coverage.ts INTERNAL_ENV_VARS allowlist). Refactored check-error-patterns.ts to export pure detectors (findSilentCatches/findContextErrorNewlines/findAdHocTryPatterns) + scanFiles/countByFile/compareToBaseline; main() gated behind direct-invocation check so tests can import. Baseline committed at script/silent-catch-baseline.json (169 catches / 84 files). --update flag regenerates it. New silent catch OR stale (shrunk) baseline both fail CI. CI check count: ci.yml runs check:errors in the same job as check:deps/check:patches/check:stale-refs. --> Co-authored-by: jared-outpost[bot] <jared-outpost[bot]@users.noreply.github.com>
5 tasks
This branch was successfully deployed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Root Cause
Both
queueCompletionTelemetryanddrainCompletionTelemetryinsrc/lib/db/completion-telemetry.tshad catch blocks that silently swallowed errors without any logging. Per AGENTS.md, every catch block must either re-throw, log withlog.debug()orlog.warn(), or return a fallback value with alog.debug()call explaining the suppression.Reproduction
sentry __complete ...)--verbosedrainCompletionTelemetryon the next normal CLI run swallows the errorFix
loggerand create a tagged logger (completion-telemetry)log.debug()calls to both catch blocks so failures are visible with--verbose