fix(analytics): dataset widgets degrade to empty when backing object/table is absent#1851
Merged
Merged
Conversation
…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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) chartssys_audit_logvia thesys_audit_log_metricsdataset. 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 withno 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:{rows:[],fields:[],totals:[]}.Full
@objectstack/service-analyticssuite: 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-frameworkonce merged.