Skip to content

feat: show rule-based trends in ResultGrid - #613

Draft
emrberk wants to merge 9 commits into
mainfrom
feat/grid-highlight-rules
Draft

emrberk wants to merge 9 commits into
mainfrom
feat/grid-highlight-rules

Conversation

@emrberk

@emrberk emrberk commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Highlight rules for notebook result grids

Result grids in notebook cells can now color cells and rows by rule, so a notebook can serve as a live dashboard: watchlists that flash on price moves, threshold breaches that stay colored, heatmap columns, and event tapes that flash new rows.

What you can do

  • Open "Highlight rules" from a grid cell's menu, or from the gear in the maximized header. Rules are saved per cell and apply to every result grid of that cell by column name. They survive SQL edits, export, and import.
  • Compare with the previous refresh. Pick the identity columns that name the same row across refreshes, for example symbol and side. Then use > previous, < previous, changed, or changed by at least an absolute or percent amount. Matching cells flash, and > previous / < previous show a ▲ or ▼ glyph. Timestamps compare as instants.
  • Flash new rows. A "new row" rule paints any row whose identity was not in the previous result.
  • Compare with a fixed value. >, ≥, <, ≤, =, between, is null, contains, and matches a regular expression. Text comparisons ignore case. A rule can target one column or all numeric columns.
  • Band values into steps. Each step means "from this value up". A value takes the highest step it reaches; a base color covers everything below the first step.
  • Gradient. A between rule with the gradient fill shades every cell of the column from one color at the low bound to another at the high bound, mixed in between and clamped beyond the ends. Leave a bound empty for auto: it follows the column's current minimum or maximum on every refresh, so a heatmap column keeps its full spread as data moves.
  • Choose how a match shows. Flash fades after a second; Permanent stays until the next result. A rule can color its own cell or the whole row.
  • Order matters. Rules evaluate top to bottom. The first matching rule colors a cell. A row rule listed first paints the whole row; a cell rule listed first keeps its cell. Rules can be reordered, disabled, and removed.
  • Colors come from ten theme-aware hues. Red and green are the loss and gain pair.

Agent and MCP

The assistant and the MCP bridge can set or clear a cell's rules with set_cell_highlight_config, and apply_notebook_state carries highlight_config per cell. Notebook snapshots include the rules.

Also in this PR

  • Chart settings and highlight rules share one drawer shell. Drawers animate on close and keep their draft across maximize and restore.
  • Settings drawers cover the cell body, so the grid stays visible next to the panel.
  • The Metrics color palette moved to a shared component.

@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Web Console deploy preview

Preview Commit Logs
https://pr-613--web-console.netlify.app 32fe56f build log

emrberk and others added 8 commits September 25, 2026 09:54
A row rule counts as a match for every cell of its row, so the first
matching rule in the list wins per cell. A row rule listed first paints
the whole row; a cell rule listed first keeps its cell and the row rule
fills the rest. Schema and prompt describe the same order.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The drawer shell keeps its nodes for a slide-out before unmounting, and
both drawers let the shell own visibility. A maximize or restore remounts
the cell, so the open state and the unsaved draft (rules, expanded rule,
chart config) live in a per-cell session store and come back in place
without replaying the entrance.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- Row rule listed after a matching cell rule on the same column now paints the rest of the row
- Between bounds accept auto (null): the engine reads the column's current min/max on every result; new between rules default to auto
- Text equality ignores case like contains; previous-result rules compare timestamps as instants
- Wire default unit is percent like the drawer; wire rejects a flat gradient and a reversed range
- Trend store moves into NotebookProvider behind ResultTrendContext, so maximize/restore keeps the baseline
- Trend capture has one writer, run from the cells store before render; the grid only reads
- Field validation lives once in the engine and serves the drawer and the wire; loaded configs pass a deep structural guard
- ResultGridPanel event-bus effect gets deps; the highlight drawer writes its draft from setters; the tool reports its own AI status

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A `newRow` rule paints the whole row of a row whose identity key was not in
the previous result. It carries only a color and a display, needs no column,
and defaults to a flash. The drawer offers it as "new row" under the
previous-result conditions and hides the column and applies-to fields for it.
The condition select no longer waits for a column; a missing column is flagged
on Save. The agent wire, tool schema, prompt, structural guard, and shared
field validation cover the new kind.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A step now carries `from` and a value takes the highest step it reaches; the
rule's base color covers values below the lowest step. This matches threshold
lists elsewhere. The editor shows the base line first, then each step as ">= N".
The wire uses `steps[].from` and `base_color`. The old shape is dropped on load
by the structural guard; no migration.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- test each regex match from the start, so g and y no longer skip rows
- keep no trend rows for released cells or cells without comparison rules
- reject agent rules that the load check would drop on reload
- offer highlight rules only when the active result renders a grid

Co-Authored-By: Claude Opus 5.5 <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