Skip to content

fix(seer): add debug logging to silent catch blocks in seer-trial - #1460

Merged
BYK merged 1 commit into
mainfrom
fix/seer-trial-silent-catch
Aug 25, 2026
Merged

fix(seer): add debug logging to silent catch blocks in seer-trial#1460
BYK merged 1 commit into
mainfrom
fix/seer-trial-silent-catch

Conversation

@cursor

@cursor cursor Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Root Cause

promptAndStartTrial in src/lib/seer-trial.ts had two catch blocks that silently discarded error objects:

  1. Trial availability check (line 80): catch { return false; } — silently swallowed errors from getProductTrials() API call
  2. Trial start (line 118): catch { log.warn(...) } — showed user-facing warning but discarded the actual error object

Per AGENTS.md, every catch block must surface the error for diagnostic visibility. When the API call fails due to network issues, auth problems, or unexpected responses, there was no diagnostic output even with --verbose.

Reproduction

  1. Run sentry issue explain with a Seer-eligible error and network issues
  2. The trial prompt check fails silently with no error details
  3. Even with --verbose, no diagnostic information about the failure is logged

Fix

  • Add log.debug() calls to both catch blocks so the underlying error (network failure, auth issue, unexpected response) is visible with --verbose
  • Preserve the graceful degradation behavior (still catch + return false or show user-facing warning)
  • Update the test mock to include the debug method
Open in Web View Automation 

promptAndStartTrial had two catch blocks that silently discarded error
objects. The trial availability check (getProductTrials) silently
returned false on any error, and the trial start (startProductTrial)
showed a user-facing warning but discarded the actual error object.

Per AGENTS.md, every catch block must surface the error for diagnostic
visibility. Add log.debug() calls so the underlying error (network
failure, auth issue, unexpected response) is visible with --verbose.

Update the test mock to include the debug method.

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli Ready Ready Preview Aug 24, 2026 12:12pm

Request Review

@BYK
BYK marked this pull request as ready for review August 25, 2026 08:49
@github-actions github-actions Bot added the risk: low PR risk score: low label Aug 25, 2026
@BYK
BYK merged commit ce3f7d1 into main Aug 25, 2026
31 checks passed
@BYK
BYK deleted the fix/seer-trial-silent-catch branch August 25, 2026 09:27
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants