Repository navigation
feat: System Health as a SeQL dashboard — CASE/scoring sugar, score-bar viz, dashboard templates - #17
Merged
Merged
Conversation
Qard
force-pushed
the
feat/seql-analytics
branch
from
July 28, 2026 14:24
10f4939 to
c20190a
Compare
Qard
force-pushed
the
feat/health-dashboard
branch
2 times, most recently
from
July 28, 2026 16:31
fd79952 to
3770504
Compare
Extend the reactive-view path with a structured time range so scope-less "template" SeQL queries can be executed with a range supplied by the control bars, matching the SeQL snapshot/live paths: - ffi: `sequins_view_create` gains the (range_kind, range_a_ns, range_b_ns) triple → Option<TimeRange> that overrides any inline scope; the view builder now calls `query_live_with_range`. Header regenerated. - swift: `DataSource.executeView` and `ReactiveTableView.start`/`startSnapshot` take an optional `timeRange:`, passed structurally. Convert every signal surface to scope-less template queries + structural ranges (no more `spans last <dur>` baked into strings): Health, Logs, Traces, Metrics (outer `metrics` scan only), Profiles, and the resources live stream. Retire the now-dead `TimeRange.applied(to:)`/`seqlTimeScope`/`dropTimeScope` string-rewrite machinery and its obsolete tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… fns
Add the expression surface needed to compute thresholded health/ranking
scores as plain queries (all lowering to standard SQL):
- ast: `Expr::Case { branches, otherwise }` (+ `CaseBranch`), and scalar fns
`exp, coalesce, least, greatest, float, int`.
- parser: `case when <pred> then <expr> … [else <expr>] end`; parenthesised
arithmetic grouping; generic scalar-function calls; and `score(v, warn, err)`
/ `grade(v, warn, err)` sugar that desugars to `Expr::Case` — the exact
HealthAnalyzer piecewise (linear 1.0→0.7→0.3 then `greatest(0, 0.3·exp(...))`).
- compiler: lower `Case` via DataFusion `when().otherwise()`, and the new scalar
fns via the session's built-in UDFs / `cast`. Verified through the full
Substrait produce→consume round-trip the backend executes.
- grounding: teach the optional time scope (templates), `compute`, CASE, and
score()/grade().
Tests: parser expansion/arity/paren, compiler compile + Substrait consume of a
health-style scoring query.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add `VizType.scoreBar` + `ScoreBarView` — horizontal factor bars filled to a 0..1 score and colored by band (≥0.7 green, ≥0.3 yellow, else red), matching the Health tab's factor rows. Renders whatever the query produces: a wide single row (each numeric column a factor, `<name>__value` companion for the raw value, an `overall`/`score` column emphasized as a summary header) or a tall [label, score] result. Wired into VizRenderer; the picker lists it via allCases. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a built-in dashboard template catalog and a "New from Template" gallery,
with System Health as the first entry — reproducing the Health tab as an
ordinary dashboard built entirely from SeQL.
- metadata: `templates.rs` — `DashboardTemplate` + `builtin_templates()` +
`system_health()`, whose panels are scope-less SeQL (range from the control
bar): a `scoreBar` of per-factor scores + weighted overall (via `score()`,
thresholds mirroring HealthThresholdConfig), metric stat cards, trend lines,
and an HTTP status-class stacked bar. `AppStateStore::{instantiate_template,
seed_builtin_dashboards}` (seeds only a fresh store, so it stays deletable).
- ffi: `sequins_dashboard_templates_list` / `_instantiate_template`; the local
data-source constructor seeds on first run.
- swift: `DataSource.{listDashboardTemplates,instantiateTemplate}`,
`DashboardTemplateInfo`, a `TemplateGallerySheet`, and a "New from Template…"
menu item in the dashboard sidebar.
The Health tab stays for side-by-side verification. Template panel queries are
guarded by seql-substrait compile+consume tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Qard
force-pushed
the
feat/health-dashboard
branch
from
July 28, 2026 20:59
3770504 to
8d7e9eb
Compare
Same flake class as the vortex-indexed-layout pruning test, in the crate that owns BloomFilterSet. The test's comment — "use 1000+ items to avoid false positives" — has it backwards: scaling the item count makes the nominal 1% rate *accurate*, not zero. Two cross-field negative assertions at ~1% each fail 1.90% of runs (measured over 3000 trials against random keys). Pin both filters to a seed verified to prune both cross-field values, and state the actual reason in the comment. Also widen the gate on `build_with_seed` to `any(test, feature = "test-util")`. The bare feature gate is not active when compiling the owning crate's own unit tests, so it was unavailable exactly where it is needed here. Swept the rest of the workspace for the same pattern: the remaining negative assertions query fields with no filter built, where `check` returns false deterministically. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Summary
Makes the Health tab reproducible as an ordinary dashboard built entirely from SeQL, by adding the expression surface it needs (CASE + scoring sugar), a score-bar visualization, a dashboard template catalog, and by finishing the separable-time-range work through the view (live table) path so template queries carry no baked-in time scope.
SeQL: CASE + scoring sugar (
c906577)Everything lowers to standard SQL — no bespoke stages.
Expr::Case { branches, otherwise }(+CaseBranch), scalar fnsexp, coalesce, least, greatest, float, int.case when <pred> then <expr> … [else <expr>] end, parenthesised arithmetic grouping, generic scalar-function calls, andscore(v, warn, err)/grade(v, warn, err)sugar desugaring toExpr::Case— the exactHealthAnalyzerpiecewise (linear 1.0→0.7→0.3, thengreatest(0, 0.3·exp(…))).Casevia DataFusionwhen().otherwise(), new scalar fns via session built-in UDFs /cast. Verified through the full Substrait produce→consume round-trip the backend actually executes.compute, CASE, andscore()/grade().Separable time range through the view path (
9dadeeb,dee7544)The snapshot/live SeQL paths already took a structured range (#16); the reactive-view path did not.
sequins_view_creategains the(range_kind, range_a_ns, range_b_ns)triple →Option<TimeRange>overriding any inline scope; the view builder callsquery_live_with_range. Header regenerated.DataSource.executeViewandReactiveTableView.start/startSnapshottake an optionaltimeRange:, passed structurally.metricsscan), Profiles, resources live stream. No morespans last <dur>baked into query strings.TimeRange.applied(to:)/seqlTimeScope/dropTimeScopestring-rewrite machinery and its obsolete tests.Score-bar visualization (
5553752)VizType.scoreBar+ScoreBarView— horizontal factor bars filled to a 0..1 score, colored by band (≥0.7 green, ≥0.3 yellow, else red), matching the Health tab's factor rows. Renders either shape the query may produce: a wide single row (each numeric column a factor,<name>__valuecompanion for the raw value,overall/scoreemphasized as a summary header) or a tall[label, score]result. Wired intoVizRenderer; picker lists it viaallCases.Dashboard templates + seeded System Health (
2edf33d)templates.rs:DashboardTemplate,builtin_templates(),system_health(). Its panels are scope-less SeQL (range comes from the control bar): ascoreBarof per-factor scores plus a weighted overall viascore()with thresholds mirroringHealthThresholdConfig, metric stat cards, trend lines, and an HTTP status-class stacked bar.AppStateStore::{instantiate_template, seed_builtin_dashboards}— seeds only a fresh store, so the dashboard stays deletable.sequins_dashboard_templates_list/_instantiate_template; the local data-source constructor seeds on first run.DataSource.{listDashboardTemplates,instantiateTemplate},DashboardTemplateInfo,TemplateGallerySheet, and a "New from Template…" menu item in the dashboard sidebar.The Health tab stays in place for side-by-side verification against the templated dashboard.
Testing
Test coverage added by these commits: parser expansion/arity/parens on
score()/grade(), and compiler compile + Substrait consume of a health-style scoring query; the System Health template's panel queries are guarded by the same compile+consume tests.cargo fmt --all— one formatting drift inseql-substrait/src/compiler.rstest code (introduced by2edf33d) fixed here ine59ae6e.cargo test -p seql-ast -p seql-parser -p seql-substrait -p sequins-metadata— not completed locally before opening this PR (cut short); relying on CI for the authoritative run.Known CI failure, inherited from #15: clippy
explicit_counter_loopatcrates/sequins-metadata/src/store.rs:152, which fails the Rust job under-D warnings. It is being fixed onfeat/assistant-visualizationsand will flow up when the stack rebases — not fixed here, to avoid a rebase conflict with that fix.Not re-verified in this PR: the macOS app build and the daemon container image. The Swift changes were built during development, but if remote mode is used, the daemon image needs rebuilding for the new grounding (grounding is compiled into the daemon), same caveat as #16.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.