Skip to content

feat: NL assistant, visualizations & dashboards - #15

Merged
Qard merged 10 commits into
mainfrom
feat/assistant-visualizations
Jul 28, 2026
Merged

Qard merged 10 commits into
mainfrom
feat/assistant-visualizations

Conversation

@Qard

@Qard Qard commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Lands the natural-language assistant plus the visualization/dashboards subsystem across the Rust core and the macOS app, with several correctness/stability fixes accumulated alongside.

Rust core (8c1c269)

  • sequins-assistant: tool-injecting Rig CompletionModel + MCP (/mcp) and OpenAI Responses (/v1/responses) surfaces over one shared tool registry; SeQL grounding.
  • sequins-metadata: AppStateStore for conversations + dashboards (JSON in object store, projected into DataFusion tables).
  • datafusion-backend: app-state SessionContext + execute_app_state_sql; honor RelRoot.names so output columns use SeQL aliases.
  • ffi: assistant + dashboard C API; app-state query entry point; panic-containment on the spawned query task.
  • cold-tier: UnsupportedForCold variant; cold-flush evicts un-encodable (Map-column) batches instead of retaining them — fixes unbounded hot-tier growth / OOM under load.

macOS app (6a24900)

  • Assistant chat UI (markdown bubbles, grouped tool activity, persisted conversations); SQLQueryAPI self-retaining collector fix so async chat loads complete.
  • Visualizations + dashboards: VizFormat/VizType, render_visualization / add_to_dashboard client tools, draggable dashboard grid with insertion-bar drop targeting, area-chart fill fix.
  • KeychainStore for the per-environment assistant secret; remote URL editor defaults (path-less Flight origin).
  • Crash fix: HistogramLine.recomputeMaxActiveBucket() guarded against an empty snapshot set (1..<0 trap on live metrics .ready with zero rows).
  • build-ffi.sh; new SequinsData tests (HistogramLine, VizFormat, DashboardViz, TimeRangeSeQL).

Tooling (e02d3c6)

  • Example app honors OTEL_EXPORTER_OTLP_ENDPOINT (+ profiles override) to target a containerized daemon; scripts/docs.

Testing

  • cargo test (cold-tier unsupported-schema, app-state SQL, alias columns) and swift test (HistogramLine regression, VizFormat) pass locally.
  • macOS app builds (xcodebuild Debug) and runs against the local containerized daemon.

🤖 Generated with Claude Code

Qard and others added 3 commits July 16, 2026 22:08
Rust-side landing of the natural-language assistant and the app-state
(conversations + dashboards) subsystem, plus supporting FFI and storage work:

- sequins-assistant: tool-injecting Rig CompletionModel + MCP/Responses
  surfaces over a shared tool registry (list_tables, describe_schema,
  column_profile, time_range, sample, explain, run_sql, validate_seql,
  run_seql), with SeQL grounding.
- sequins-metadata: AppStateStore for conversations + dashboards, JSON-backed
  in the object store and projected into DataFusion tables.
- datafusion-backend: app_state SessionContext + execute_app_state_sql;
  RelRoot.names alias honoring so output columns use SeQL aliases.
- ffi: assistant + dashboard C API; app-state SeQL query entry point;
  panic-containment on the spawned query task.
- cold-tier: UnsupportedForCold error + is_unsupported_for_cold(); cold-flush
  callback evicts un-encodable (Map-column) batches instead of retaining them
  (fixes unbounded hot-tier growth / OOM under load).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Assistant chat UI: markdown message bubbles, grouped tool-activity blocks,
  conversation persistence via app-state SQL (SQLQueryAPI self-retaining
  collector fix so async chat loads complete).
- Visualization + dashboards: VizFormat/VizType, render_visualization &
  add_to_dashboard client tools, draggable dashboard grid with insertion-bar
  drop targeting, area-chart fill interpolation fix.
- KeychainStore for the per-environment assistant secret; environment editor
  for remote query/management/assistant URLs (path-less Flight origin defaults).
- Fix HistogramLine.recomputeMaxActiveBucket() crash: guard the `1..<count`
  scan against an empty snapshot set (live metrics .ready with zero rows).
- build-ffi.sh to rebuild the SequinsFFI xcframework; SequinsData tests
  (HistogramLine, VizFormat, DashboardViz, TimeRangeSeQL).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- example/test-app: honor OTEL_EXPORTER_OTLP_ENDPOINT and a profiles
  endpoint override so the sample app can target a containerized daemon.
- Add scripts/ and docs/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Qard and others added 4 commits July 21, 2026 17:36
…role plumbing, SeQL null fix

Assistant tool layer (crates/sequins-assistant):
- Discovery tools: overview, list_attributes (promoted cols + _overflow_attrs
  map keys), attribute_values, list_metrics.
- Dashboard authoring server tools over a new optional DashboardApi handle
  (builder, so downstream Tools::new stays valid): list/get/create/rename
  dashboards, add_chart, update_chart, arrange_dashboard (move/resize/reorder
  with weights + heights). Positional addressing.
- Grounding teaches the explore -> build -> arrange workflow and non-null checks.
- DRY/YAGNI cleanup: shared wire module, base_completion_request/message_for_role,
  PersistTurn build/finish; drop unused temperature/with_max_tool_turns/backend.
- gpt-5.6: escalate reasoning_effort (none/drop) only when the provider demands it.

SeQL (crates/seql-substrait): compile `field == null` / `!= null` as
IS NULL / IS NOT NULL, so the common idiom no longer silently drops every row.

FFI (crates/sequins-ffi): CSchemaFrame carries per-column semantic roles so
renderers can tell dimensions from measures; conversation delete; wire the local
dashboard store into the assistant tools.

Metadata (crates/sequins-metadata): drop the never-released legacy free-grid
dashboard migration; delete_conversation.

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

Assistant tab:
- Model + reasoning pickers below the composer as faded pills that light up on
  hover; send button right-aligned in the controls row. Model list pulled from
  the provider's /v1/models, filtered to text/chat models; reasoning effort
  selectable per turn.
- Dashboard authoring is server-side; the app reloads dashboards after each turn.
- Destructive ops (delete_dashboard/remove_chart) surface an in-chat approval
  card; the composer stays live so a new instruction redirects instead of a bare
  decline. Conversation delete with confirmation.
- "Open Settings" and the settings assistant section actually work; the
  environment pane exposes provider base URL + API key.

Visualization reliability:
- Decode per-column SeQL roles; value detection plots only measures (a numeric
  dimension like http_status_code is never charted as a series); role-aware
  auto-selection; never render an empty chart — fall back to a table.

Also: dashboard separators only surface while dragging; DRY cleanup (shared
FFI-error/frame decoders, VizFormat helpers, delete unused VizData).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- metric_labels / metric_label_values: enumerate the per-series label dimensions
  a metric is broken down by, from the series index (metric attributes aren't in
  the SQL tables). New SeriesIndex::{metric_names,label_keys,label_values}; Tools
  gains an optional series-index handle (with_series_index), wired from the local
  cold tier.
- column_profile: numeric quantiles (mean/stddev/p50/p90/p95/p99) + optional
  `filter` scope.
- sample: optional `columns` projection, `filter`, and `order_by`.
- describe_schema: point _overflow_attrs at list_attributes/attribute_values.
- Grounding notes the metric-label tools.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a `recommend_chart(query)` server tool that runs a SeQL query and
suggests the best chart type from its result shape/roles, plus a
`VisualizationOptions` presentation blob (unit, y_scale/log, y_min/max,
stacked, legend, series_limit, thresholds) threaded end-to-end:

- metadata: `VisualizationOptions`/`Threshold` on `SavedVisualization`
  (additive, omitted-when-empty serde).
- assistant: `add_chart`/`update_chart` accept `options`; `render_dashboard`
  surfaces them; grounding teaches recommend_chart + options.
- ffi/swift: mirror the options model in `DashboardStore`, parse them in the
  inline `render_visualization` client tool, and honor them in the renderers
  (log/explicit y-scale, unit labels, legend, series cap, threshold rules,
  bar stacking) via a propagating `chartYPresentation` modifier.

Tests: assistant recommend_chart + options round-trip; metadata + SequinsData
options coding. All green; macOS app builds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Qard and others added 3 commits July 28, 2026 15:52
CI runs clippy with `-D warnings`, where the manual `position` counter in
`AppStateStore::append_response` fails `clippy::explicit_counter_loop`. Zip the
item iterator with an open-ended range starting at the current item count
instead — same positions assigned, no manual increment.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Rust 1.97's clippy flags `&filename` in the `format!` as
`useless_borrows_in_formatting`, failing CI under `-D warnings`. Format args
are borrowed implicitly, so dropping the `&` leaves `filename` available for
the `MappingData` construction below.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`bloom_pruning_rejects_missing_values_for_bloom_fields` asserted that
`trace-404` is pruned by a filter built over {trace-1, trace-2}. Bloom filters
admit false positives, and `Bloom::new_for_fp_rate` draws random sip keys per
instance, so the assertion held only when the seed happened to cooperate.
At n=2 / fpr=0.01 the filter is just 24 bits with 9 hash functions, so it is far
more saturated than the nominal rate suggests: measured over 2000 random seeds,
`trace-404` collides 3.25% of the time. That is roughly 1 CI failure in 31,
on a crate unrelated to whatever is being changed.

Add a `test-util` feature to sequins-companion-index exposing
`BloomFilterSet::build_with_seed` (via `new_for_fp_rate_with_seed`), and pin the
test to a seed verified to reject `trace-404` while keeping both members. The
feature is off in production builds; sequins-vortex-indexed-layout enables it as
a dev-dependency, since the test and the type live in different crates.

Also add the complementary no-false-negative case, which holds for any seed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Qard
Qard merged commit d1e20e3 into main Jul 28, 2026
3 checks passed
@Qard
Qard deleted the feat/assistant-visualizations branch July 28, 2026 14:19
Qard added a commit that referenced this pull request Jul 28, 2026
Rebasing onto main brought this branch's ABI change together with the test call
sites added by the assistant line (squashed into main as #15) for the first
time. Those tests call `sequins_seql_query` with the old 4-argument form, so
the crate fails to compile under `cargo test` — neither branch is broken alone.

Pass `0, 0, 0` (kind 0 = use the query's inline scope) at each of the 12 call
sites, preserving existing behavior.

Note this is invisible to CI's clippy step, which runs without --all-targets and
so never compiles test code; only the test step catches it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Qard added a commit that referenced this pull request Jul 28, 2026
…new aggregates (#16)

* feat(seql): scale throughput() to the query window; effective-window helper

throughput() was a stub returning count(*). Compute count(*) / seconds, where
seconds is the time-bin width when the query is bucketed by ts() (a per-bucket
rate) and otherwise the whole scan window — so the rate scales with the selected
time range. Adds effective_window_ns() and threads it through apply_aggregate,
laying groundwork for range-relative bucketing (ts() bin N%).

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

* feat(seql): range-relative time bucketing — `ts() bin N%` and `bin auto`

Introduce BinSpec (Fixed | Percent | Auto), replacing GroupExpr.bin_ns. The
compiler resolves Percent/Auto against the query's effective window at compile
time: `bin 10%` yields ~10 buckets scaled to the selected range, and `bin auto`
snaps to a nice duration ladder (~100 buckets). Fixed durations are unchanged.
This lets a saved time-series re-bucket sensibly as the dashboard range widens
or narrows instead of exploding a fixed `bin 1m` into thousands of buckets.

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

* feat(seql): query templates — optional scope + separable structured time range

Make the scan time scope optional (Scan.time_range: Option<TimeRange>) so a
query can be a range-agnostic template (`spans | group by { ts() bin 10% } {
count() }`). Add compile_with_range / compile_ast_with_range that inject a
structured range which overrides any inline scope, so the dashboard's selected
range drives the whole query. A scope-less query on a time-scoped signal errors
if executed without a range instead of silently scanning everything. The
effective window (inline or injected) feeds bin N% / throughput, so time-relative
features scale to whatever range is applied.

Rust core only; FFI + Swift threading follows.

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

* feat(seql): stddev, variance, and arbitrary percentile(col, q) aggregates

Add stddev(col), variance(col)/var(col), and percentile(col, q) — q a 0..1
quantile (a 0–100 form is normalized). p95/p99 now delegate to a shared
approx_percentile_cont helper, generalizing the previously hardcoded quantiles.

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

* style(seql): cargo fmt

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

* feat(seql): window functions — `window { moving_avg, cumulative, delta }`

Add a `window { … }` stage applied after aggregation over the ordered result
(by the ts() bucket / first temporal column): moving_avg(col, n), cumulative(col)
/running_sum(col), and delta(col) (period-over-period). Compiles to DataFusion
window exprs over row frames using only avg/sum UDAFs — delta reads the previous
row via a [1 preceding, 1 preceding] frame, so no lag UDF dependency.

A spike confirmed window functions survive the full Substrait round-trip through
the backend's custom consumer, so no SeqlExtension fallback is needed; a test
compiles a windowed time-series query and consumes it back to prove the daemon
can execute it. Being layered on aggregation, windowed queries are live-safe via
the existing Replace re-execution path.

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

* feat(ffi): thread an optional structured time range through the query path

Add query_with_range / query_live_with_range on the backend and client (compiling
via compile_*_with_range so a supplied range overrides the query's inline scope),
dispatch them through the FFI QueryExecutor, and extend the C ABI:
sequins_seql_query / _query_live now take (range_kind, range_a_ns, range_b_ns) —
kind 0=none, 1=relative sliding window (a=duration), 2=absolute (a=start,b=end).
Regenerates sequins.h. Lets the app run a scope-less query template against a
separately-chosen range instead of baking time into the query string.

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

* feat(macos): pass dashboard time range structurally, not by string rewrite

executeSeQL/executeLiveSeQL take an optional TimeRange, forwarded to the FFI as
the (range_kind, range_a_ns, range_b_ns) triple; dashboards now inject the
picker's range structurally (overriding the query's inline scope) instead of
rewriting the leading `<signal> <scope>` via TimeRange.applied(to:). This also
covers cases the string rewrite missed (inner sub-scopes, the signal(id)
shorthand) and lets a scope-less query template run against the selected range.
The chat/one-off path passes nil, so an inline scope is still honored.

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

* feat(assistant): teach new SeQL analytics in the grounding prompt

Update default_grounding() to cover percentile/stddev/variance and the corrected
per-second throughput(), range-relative bucketing (ts() bin 10% / bin auto), and
the window { moving_avg, cumulative, delta } stage, plus a note that dashboards
apply the selected range/liveness automatically and light interactive
query-building guidance. Refresh the parse-checked example list accordingly.

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

* chore(ffi): drop now-unused QueryExecutor::query shim

Superseded by query_with_range (the plain query() had no remaining callers).

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

* test(ffi): thread range triple into seql_query test call sites

Rebasing onto main brought this branch's ABI change together with the test call
sites added by the assistant line (squashed into main as #15) for the first
time. Those tests call `sequins_seql_query` with the old 4-argument form, so
the crate fails to compile under `cargo test` — neither branch is broken alone.

Pass `0, 0, 0` (kind 0 = use the query's inline scope) at each of the 12 call
sites, preserving existing behavior.

Note this is invisible to CI's clippy step, which runs without --all-targets and
so never compiles test code; only the test step catches it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant