Skip to content

fix(analytics): dataset widgets degrade to empty when backing object/table is absent#1851

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/dataset-widget-graceful-degradation
Jun 14, 2026
Merged

fix(analytics): dataset widgets degrade to empty when backing object/table is absent#1851
xuyushun441-sys merged 1 commit into
mainfrom
fix/dataset-widget-graceful-degradation

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Problem

A dashboard/report dataset whose backing object/table isn't present in the kernel hard-failed the widget with a 500. Concretely: the platform System Overview dashboard (shipped by plugin-auth) charts sys_audit_log via the sys_audit_log_metrics dataset. Opened in an environment that never mounted the audit object (e.g. a cloud tenant runtime, or any host without the audit plugin), every audit widget 500'd with no such table: sys_audit_log — the Setup app's System Overview rendered with three broken widgets.

Fix

Wrap the dataset execution in AnalyticsService.queryDataset: on a missing-source error (table/object/relation absent), log a warning and return an empty result ({rows:[], fields:[], totals:[]}) so the widget renders "no data" instead of crashing. The match (isMissingSourceError) covers the missing-relation signatures across sqlite/libsql, postgres, mysql, plus the framework's unknown-object signal. Column/syntax errors still throw, so real query bugs surface.

This mirrors how the list grid and detail surfaces already tolerate absent data — datasets were the one read surface that hard-failed.

Tests

__tests__/query-dataset.test.ts:

  • missing table → empty result {rows:[],fields:[],totals:[]}.
  • non-missing-source error (syntax error) → still throws.

Full @objectstack/service-analytics suite: 124 tests pass.

Context

Found during a cloud customer-journey audit. Pairs with the Setup/Studio-in-every-env work (cloud#312 for the multi-tenant runtime; serve.ts already wires the apps for single-env via #1813). Ships to cloud via bump-framework once merged.

…table is absent

A dashboard/report dataset whose backing object isn't present in the kernel
hard-failed the widget with a 500. Concretely: the platform System Overview
dashboard (shipped by plugin-auth) charts `sys_audit_log` via the
`sys_audit_log_metrics` dataset; opened in an environment that never mounted
the audit object, every audit widget 500'd ("no such table: sys_audit_log").

Wrap the dataset execution in `queryDataset`: on a MISSING-SOURCE error
(table/object/relation absent — matched across sqlite/libsql, postgres,
mysql, and the framework's unknown-object signal) log a warning and return an
empty result, so the widget renders "no data" instead of crashing. Column/
syntax errors still throw so real query bugs surface. The list grid and
detail surfaces already tolerate absent data; datasets were the gap.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 14, 2026 3:00pm

Request Review

@xuyushun441-sys
xuyushun441-sys merged commit 9327cd8 into main Jun 14, 2026
13 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the fix/dataset-widget-graceful-degradation branch June 14, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants