fix(notifications): guard open-goals banner SELECT behind table pre-flight (42P01)#275
Conversation
…light The SessionStart banner path (fetchOpenGoals -> listOpenGoals) issued the hivemind_goals SELECT unconditionally, while the context-block path already skips it when the table is absent (knownTablesOrNull). On any org that never created hivemind_goals, the banner logged a server-side 42P01 on every SessionStart even though the client-side catch hid it from the user (~150 such errors/day in prod across many orgs). Add the same knownTablesOrNull() pre-flight: skip the read when the trusted table list omits the goals table, fall back to SELECT-then-catch when the list is untrusted (null) so a transient lookup blip can't hide a real table. Tests: extend the mock with knownTablesOrNull and add 3 cases (skip when absent / query when present / fall back when null). 21/21 green.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesfetchOpenGoals table-existence pre-flight guard
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
Coverage ReportScope: files changed in this PR. Enforced threshold: 90% per metric (per file via
File Coverage — 1 file changed
Generated for commit 03e90b4. |
Problem
pg-deeplake prod logs ~150
sqlstate=42P01 ERROR: relation \"hivemind_goals\" does not existper day, spread across many orgs. Source: the SessionStart banner path (fetchOpenGoals→listOpenGoals) issues the goalsSELECTunconditionally. The SessionStart context-block path already guards the same read withknownTablesOrNull()and skips it when the table is absent. On any org that never createdhivemind_goals(i.e. never wrote a goal), the banner sends the SELECT on every SessionStart; the server logs 42P01 even though the client-sidetry/catchhides it from the user.Fix
Add the same pre-flight in
fetchOpenGoals:knownTablesOrNull()returns the trusted table list → if it omits the goals table, skip the read (no server-side 42P01).null(untrusted/lookup failed) → fall back to SELECT-then-catch, so a transient blip can't hide a table that really exists.This mirrors the proven context-block pattern exactly and does not create the table as a side effect (the banner is read-only/best-effort).
Tests
Extended the existing mock with
knownTablesOrNulland added 3 cases: skip-when-absent (assertsquerynever called), query-when-present, fall-back-when-null. 21/21 green.Summary by CodeRabbit