fix(coachhelm): log best-effort insight-delivery failures as warning - #219
fix(coachhelm): log best-effort insight-delivery failures as warning#219njrini99-code wants to merge 1 commit into
Conversation
… not error fetchShotDriversByCategory / fetchSgTrendsByCategory / the SG fetch in assembleForPlayer are all best-effort enrichments — the CoachHelm themes page renders correctly without them. A handled failure (e.g. a Postgres statement timeout on the heavy golf_shots shot-drivers query) was logged at `error` severity, so it paged like a real crash (Sentry JAVASCRIPT-NEXTJS-57) despite 0 user impact. Pass 'warning' severity so these handled, gracefully-degraded conditions are captured as non-exception messages instead of error-level events — matching the logger's existing control-flow-signal convention. No behavior change to the page; indexes on golf_shots(round_id) and the child shot_id columns are already healthy, so this is purely a logging-severity correction. https://claude.ai/code/session_01NSJu2jvRqKxgk7vhvKZXeq
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
njrini99-code has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughThis PR updates three best-effort enrichment failure paths in ChangesNon-fatal warning logging for enrichment failures
🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 12✅ Passed checks (12 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.43.0)src/app/golf/actions/insight-delivery.tsError: Cannot parse rule /ast-grep-rules/../git/.coderabbit/ast-grep/no-explicit-any.yml ✖ Caused by Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Folded into #304 (feat/coachhelm-stats-roundup) — merged clean, combined gates green. Branch intact + reopenable. |
Fixes Sentry JAVASCRIPT-NEXTJS-57
Issue:
fetchShotDriversByCategory failed (continuing without shot drivers): canceling statement due to statement timeoutonGET /golf/dashboard/coachhelm. 3 occurrences, 0 users impacted.Diagnosis
fetchShotDriversByCategory,fetchSgTrendsByCategory, and the SG fetch inassembleForPlayer(src/app/golf/actions/insight-delivery.ts) are all best-effort enrichments — the CoachHelm themes page renders correctly without them (the helpers catch, returnundefined, and the assembler omits the data). The shot-drivers query is heavy (up to 5000 shots across up to 200 rounds with two nested JSON embeds) and occasionally trips the Postgresstatement_timeoutunder load.The only thing actually wrong: these handled, gracefully-degraded failures were logged at
errorseverity, so they paged like real crashes despite zero user impact — contradicting the helpers' own contract ("NEVER errors the page").Not an indexing problem — verified against prod:
golf_shots(round_id)is indexed (plus a covering index), andputt_details(shot_id)/approach_miss_details(shot_id)are indexed/unique.Change
Pass
'warning'severity to the three best-effortlogServerErrorcalls. The logger capturesinfo/warningas non-exception messages (seeserver-error-logger.ts), so these become low-severity signals instead of paging error events — the same convention PR #216 used for handled control-flow.No behavior change to the page — purely a logging-severity correction.
Verification
npm run typecheck— cleannpx eslint src/app/golf/actions/insight-delivery.ts— cleanDeferred (optional, not in this PR)
Lowering
SHOT_DRIVERS_ROUNDS_CAP(200 → ~50) would reduce how often the query times out at all. Left out per scope decision; can follow up if the warnings stay noisy.https://claude.ai/code/session_01NSJu2jvRqKxgk7vhvKZXeq
Generated by Claude Code