Skip to content

feat: improve db overload debugging UX - #43564

Merged
jordienr merged 61 commits into
masterfrom
jordi/debug-15-improve-db-overload-debugging-ux-surface-metrics-link-to
Mar 16, 2026
Merged

jordienr merged 61 commits into
masterfrom
jordi/debug-15-improve-db-overload-debugging-ux-surface-metrics-link-to

Conversation

@jordienr

@jordienr jordienr commented Mar 9, 2026 •

Copy link
Copy Markdown
Member

When the dashboard hits a DB connection timeout, users currently see a raw error message with no
path forward. This PR adds an inline troubleshooting system that detects known error types and
surfaces contextual next steps — restart the DB, read the docs, or debug with AI.

Changes

  • New ErrorDisplay component (packages/ui-patterns) — styled error card with a title, monospace error
    block, optional troubleshooting slot, and a "Contact support" link that always renders. Accepts
    typed supportFormParams to pre-fill the support form.

  • Error classification in handleError (data/fetchers.ts) — on every API error, the message is tested
    against ERROR_PATTERNS. If matched, handleError throws a typed subclass (ConnectionTimeoutError
    extends ResponseError) instead of a plain ResponseError. Stack traces now show the exact error
    class. All existing instanceof ResponseError checks continue to work.

  • ErrorMatcher component — reads errorType from the thrown class instance, does an O(1) lookup into
    ERROR_MAPPINGS, and renders the matching troubleshooting accordion as children of ErrorDisplay.
    Falls back to plain ErrorDisplay for unclassified errors.

  • Connection timeout mapping — first error type wired up, with three troubleshooting steps: restart
    the database, link to the docs, and "Debug with AI" (opens the AI assistant sidebar with a
    pre-filled prompt).

  • Telemetry — three new typed events track when the troubleshooter is shown, when accordion steps are
    toggled, and which CTAs are clicked.

Adding a new error type

  1. Add a class to types/api-errors.ts
  2. Add { pattern, ErrorClass } to data/error-patterns.ts
  3. Create a troubleshooting component in errorMappings/
  4. Add an entry to error-mappings.tsx

@vercel

vercel Bot commented Mar 9, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment Mar 13, 2026 10:40am
studio-staging Ready Ready Preview, Comment Mar 13, 2026 10:40am
7 Skipped Deployments
Project Deployment Actions Updated (UTC)
cms Ignored Ignored Mar 13, 2026 10:40am
studio Ignored Ignored Mar 13, 2026 10:40am
design-system Skipped Skipped Mar 13, 2026 10:40am
docs Skipped Skipped Mar 13, 2026 10:40am
learn Skipped Skipped Mar 13, 2026 10:40am
ui-library Skipped Skipped Mar 13, 2026 10:40am
zone-www-dot-com Skipped Skipped Mar 13, 2026 10:40am

Request Review

@supabase

supabase Bot commented Mar 9, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Repository UI (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 965aec92-1477-472f-a303-678d264b8e89

📥 Commits

Reviewing files that changed from the base of the PR and between dcf7a0c and 58b3335.

📒 Files selected for processing (7)
  • apps/design-system/content/docs/fragments/error-display.mdx
  • apps/design-system/registry/default/example/error-display-demo.tsx
  • apps/design-system/registry/default/example/error-display-no-support.tsx
  • apps/design-system/registry/default/example/error-display-with-children.tsx
  • apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.tsx
  • packages/ui-patterns/src/ErrorDisplay/ErrorDisplay.tsx
  • packages/ui-patterns/src/ErrorDisplay/ErrorDisplay.types.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/design-system/registry/default/example/error-display-no-support.tsx
  • apps/design-system/registry/default/example/error-display-demo.tsx
  • apps/design-system/content/docs/fragments/error-display.mdx
  • apps/studio/components/interfaces/ErrorHandling/ErrorMatcher.tsx

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Reusable Error Display card with inline troubleshooting, contact-support links, and AI-assisted debugging.
    • Error matching that surfaces targeted troubleshooting steps and an inline troubleshooter accordion.
    • One-click project/database restart flows surfaced from error panels.
  • Bug Fixes

    • Support form URL builder no longer leaves stray query markers when params are empty.
  • Documentation

    • Added usage docs and live examples for the error UI and troubleshooting patterns.
  • Tests

    • New tests covering error matching and troubleshooting UI.

Walkthrough

Adds a Studio error-handling system: a new ErrorMatcher component that normalizes errors, matches them against ERROR_MAPPINGS, and renders targeted troubleshooting UI or a generic ErrorDisplay with a support link; new TroubleshootingAccordion and TroubleshootingSections (restart project/database, external guide, AI debug) with telemetry hooks; RestartProjectDialog to perform restarts; ConnectionTimeout mapping that opens the troubleshooting flow and can invoke the AI assistant; ErrorDisplay UI and types; telemetry constants extended for inline troubleshooter events; TableEditorMenu updated to use ErrorMatcher; support URL formatting tightened; docs, examples, and tests added.

Sequence Diagram(s)

sequenceDiagram
    participant UI as UI Layer (e.g., TableEditorMenu)
    participant EM as ErrorMatcher
    participant MAP as ERROR_MAPPINGS
    participant TEL as Telemetry
    participant TS as Troubleshooting Components
    participant AI as AI Assistant / Sidebar
    participant SUPPORT as Support Form

    UI->>EM: Render(title, error, supportFormParams)
    EM->>EM: Normalize error -> message
    EM->>EM: build supportUrl via createSupportFormUrl
    EM->>MAP: Match message against patterns
    alt mapping found
        MAP-->>EM: Return mapping (id, troubleshooting UI)
        EM->>TEL: Emit inline_error_troubleshooter_shown (errorType)
        EM->>TS: Render troubleshooting UI (Accordion + Sections)
        TS->>TEL: Emit inline_error_troubleshooter_accordion_toggled on toggle
        opt user clicks restart
            TS->>UI: Open RestartProjectDialog
            UI->>UI: Call restart mutation
            UI->>TEL: Emit inline_error_troubleshooter_action_clicked (restart_db)
        end
        opt user clicks troubleshooting guide
            TS->>TEL: Emit inline_error_troubleshooter_action_clicked (troubleshooting_guide)
            TS->>SUPPORT: Open external guide link
        end
        opt user triggers AI debug
            TS->>AI: Open sidebar & initialize chat (buildPrompt)
            TS->>TEL: Emit inline_error_troubleshooter_action_clicked (ask_ai)
        end
        opt user clicks contact support
            TS->>TEL: Emit inline_error_troubleshooter_action_clicked (contact_support)
            TS->>SUPPORT: Open supportUrl
        end
    else no mapping
        MAP-->>EM: No match
        EM->>TEL: (optional) Emit DashboardErrorCreatedEvent with source='error_display'
        EM->>UI: Render ErrorDisplay with supportUrl
    end
Loading

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Mar 9, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  161 passed
skipped  4 skipped

Details

stats  165 tests across 20 suites
duration  12 minutes, 47 seconds
commit  f26372b

Skipped tests

Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@jordienr jordienr changed the title Jordi/debug 15 improve db overload debugging ux surface metrics link to feat: improve db overload debugging ux surface metrics link to Mar 9, 2026
@jordienr jordienr changed the title feat: improve db overload debugging ux surface metrics link to feat: improve db overload debugging UX Mar 9, 2026
@blacksmith-sh

This comment has been minimized.

Comment thread packages/ui-patterns/src/admonition.tsx Resolved
Comment thread apps/studio/types/api-errors.ts Resolved
Comment thread apps/studio/data/error-patterns.test.ts Resolved
Comment thread apps/studio/data/error-patterns.ts Resolved

@seanoliver seanoliver left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good from a growth eng / telemetry POV! I just dropped in a few minor notes on naming consistency that I noticed!

Comment thread packages/common/telemetry-constants.ts Resolved
Comment thread packages/common/telemetry-constants.ts Resolved
Comment thread packages/common/telemetry-constants.ts Resolved
Comment thread packages/common/telemetry-constants.ts Resolved

@kemaldotearth kemaldotearth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible when we do have space above a certain viewport we adhere to the alignment below?

Image

One thing I was wondering with the the placement in the sidebar, I think we could potentially do something similar to our feature preview enable popover. E.g. we have a smaller version of our error card, a button that says "Troubleshoot" (or similar) and we can open the error display as a dialog?

Image

aria-labelledby="error-display-title"
{...props}
>
<CardHeader className="flex-row items-center gap-2.5 space-y-0 py-2 px-3">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertical padding is too snug, I believe I had it 12px / p-3 in the design file. Gives it bit more room to breathe.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@jordienr

jordienr commented Mar 13, 2026 •

Copy link
Copy Markdown
Member Author

Is it possible when we do have space above a certain viewport we adhere to the alignment below?

@kemaldotearth
we cant do this without tailwind container queries i'm afraid, since it's not the size of the viewport that matters but the parent container of the error. viewport could be 2xl but the error renders inside the sidebar (for now at least)

@kemaldotearth

kemaldotearth commented Mar 13, 2026 •

Copy link
Copy Markdown
Contributor

Is it possible when we do have space above a certain viewport we adhere to the alignment below?

@kemaldotearth we cant do this without tailwind container queries i'm afraid, since it's not the size of the viewport that matters but the parent container of the error. viewport could be 2xl but the error renders inside the sidebar (for now at least)

Ahh I seem to remember @container being used on the new layout stuff. Either way we can do as a follow up. What do you think to a :smol: version for sidebar usage? I can help run some quick mock ups in Figma if need be 🙏

@jordienr

Copy link
Copy Markdown
Member Author

Is it possible when we do have space above a certain viewport we adhere to the alignment below?

@kemaldotearth we cant do this without tailwind container queries i'm afraid, since it's not the size of the viewport that matters but the parent container of the error. viewport could be 2xl but the error renders inside the sidebar (for now at least)

Ahh I seem to remember @container being used on the new layout stuff. Either way we can do as a follow up. What do you think to a :smol: version for sidebar usage? I can help run some quick mock ups in Figma if need be 🙏

@kemaldotearth yea 100% go for it, this is just v1 we can keep improving it and adding it to more places.

@kemaldotearth kemaldotearth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ to keep it moving!

@seanoliver seanoliver left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Telemetry side looks great!

@jordienr
jordienr merged commit ec26943 into master Mar 16, 2026
26 checks passed
@jordienr
jordienr deleted the jordi/debug-15-improve-db-overload-debugging-ux-surface-metrics-link-to branch March 16, 2026 10:22
@github-actions

github-actions Bot commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1773656668)

Score Average Improvements Regressions
Completeness 94.4% (-3pp) - 1 🔴
Conciseness 1.4% (+1pp) 1 🟢 -
Goal Completion 93.1% (-3pp) 1 🟢 3 🔴
SQL Identifier Quoting 93.8% (+7.000000000000001pp) 1 🟢 -
SQL Validity 93.8% (-6pp) - 1 🔴
Tool Usage 97% (-3pp) - 1 🔴
Correctness 91.7% (-4pp) - 1 🔴
Docs Faithfulness 61.1% (+3pp) 1 🟢 2 🔴
URL Validity 100% - -
Time_to_first_token 0.24tok (+0.06tok) - 12 🔴
Llm_calls 12.19 (-0.17) 1 🟢 6 🔴
Tool_calls 3.06 (-0.25) 1 🟢 6 🔴
Errors 0 (+0) - -
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 62015.81tok (+12120.36tok) 3 🟢 9 🔴
Prompt_cached_tokens 25176.89tok (-4167.11tok) 2 🟢 7 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Completion_tokens 2816.36tok (+48.86tok) 5 🟢 7 🔴
Completion_reasoning_tokens 2092.44tok (+17.78tok) 5 🟢 7 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 64832.17tok (+12169.22tok) 4 🟢 8 🔴
Estimated_cost 0.02$ (+0$) 5 🟢 7 🔴
Duration 40.09s (-9.71s) 11 🟢 1 🔴
Llm_duration 78.52s (-19.76s) 11 🟢 1 🔴

stylessh pushed a commit that referenced this pull request Mar 23, 2026
When the dashboard hits a DB connection timeout, users currently see a
raw error message with no
path forward. This PR adds an inline troubleshooting system that detects
known error types and
surfaces contextual next steps — restart the DB, read the docs, or debug
with AI.

##  Changes

- New ErrorDisplay component (packages/ui-patterns) — styled error card
with a title, monospace error
block, optional troubleshooting slot, and a "Contact support" link that
always renders. Accepts
  typed supportFormParams to pre-fill the support form.

- Error classification in handleError (data/fetchers.ts) — on every API
error, the message is tested
against ERROR_PATTERNS. If matched, handleError throws a typed subclass
(ConnectionTimeoutError
extends ResponseError) instead of a plain ResponseError. Stack traces
now show the exact error
  class. All existing instanceof ResponseError checks continue to work.

- ErrorMatcher component — reads errorType from the thrown class
instance, does an O(1) lookup into
ERROR_MAPPINGS, and renders the matching troubleshooting accordion as
children of ErrorDisplay.
  Falls back to plain ErrorDisplay for unclassified errors.

- Connection timeout mapping — first error type wired up, with three
troubleshooting steps: restart
the database, link to the docs, and "Debug with AI" (opens the AI
assistant sidebar with a
  pre-filled prompt).

- Telemetry — three new typed events track when the troubleshooter is
shown, when accordion steps are
   toggled, and which CTAs are clicked.

##  Adding a new error type

  1. Add a class to types/api-errors.ts
  2. Add { pattern, ErrorClass } to data/error-patterns.ts
  3. Create a troubleshooting component in errorMappings/
  4. Add an entry to error-mappings.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants