Skip to content

chore(deps-dev): Bump vitest from 2.1.9 to 4.1.0 in /web#4

Closed
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/npm_and_yarn/web/vitest-4.1.0
Closed

chore(deps-dev): Bump vitest from 2.1.9 to 4.1.0 in /web#4
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/npm_and_yarn/web/vitest-4.1.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Jun 1, 2026

Copy link
Copy Markdown

Bumps vitest from 2.1.9 to 4.1.0.

Release notes

Sourced from vitest's releases.

v4.1.0

Vitest 4.1 is out!

This release page lists all changes made to the project during the 4.1 beta. To get a review of all the new features, read our blog post.

   🚀 Features

... (truncated)

Commits
  • 4150b91 chore: release v4.1.0
  • 1de0aa2 fix: correctly identify concurrent test during static analysis (#9846)
  • c3cac1c fix: use isAgent check, not just TTY, for watch mode (#9841)
  • eab68ba chore(deps): update all non-major dependencies (#9824)
  • 031f02a fix: allow catch/finally for async assertion (#9827)
  • 3e9e096 feat(reporters): add agent reporter to reduce ai agent token usage (#9779)
  • 0c2c013 chore: release v4.1.0-beta.6
  • 8181e06 fix: hideSkippedTests should not hide test.todo (fix #9562) (#9781)
  • a8216b0 fix: manual and redirect mock shouldn't load or transform original module...
  • 689a22a fix(browser): types of getCDPSession and cdp() (#9716)
  • Additional commits viewable in compare view
Maintainer changes

This version was pushed to npm by GitHub Actions, a new releaser for vitest since your current version.


@dependabot dependabot Bot added dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code labels Jun 1, 2026
public-repo-publish Bot pushed a commit that referenced this pull request Jun 6, 2026
…inned-tooltip survival fixes (#447)

* [testing] Rename seed_may_data → seed_updated_data

May was the month it was written; rename to a stable name that won't
become misleading. Updates project name (maySeededData → updatedSeededData),
run name prefix (may-seed → updated-seed), and usage docs.

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

* [frontend] Show un-smoothed value in tooltip alongside smoothed value

Adds a synthetic "Raw Value" column to the chart tooltip that appears
only when smoothing is active (the chart has an `(original)` companion
series). When smoothing is off, the tooltip is unchanged — single Value
column.

Also fixes a long-standing bug where the existing inline `value (raw)`
rendering never fired: `buildSeriesConfig` overrides uPlot's `series.label`
to `runId`, so the suffix check on `series.label` for ` (original)` always
failed. The detection now reads `lineData.label` (the un-overridden
original) and keys the rawValues map by `series.label` (which is the same
for main + companion of a given run).

Default tooltip column order updated to: Run Name | Series ID | Metric |
Value | Raw Value (Series Name still available, disabled by default).
Storage key bumped to v2 so existing saved configs roll forward.

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

* [testing] Tooltip raw value: unit tests + restructured E2E spec

Unit tests cover insertRawValueColumn (column-order contract) and
formatRawValueContent (cell render contract incl. flag-takes-precedence
and stale-style cleanup). Both helpers exported for testability.

E2E spec rewritten to use forEachChartLocation:
- Smoothing-on header check across NON_FS_LOCATIONS (6 locations).
- Smoothing-off header check across AR-C + IR-C.
- Numeric-raw-cell regression check across AR-C + IR-C — guards the
  series.label-vs-lineData.label bug fixed in this branch.

10 E2E tests total; 11 unit tests.

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

* [testing] Replace polling loops with locator.waitFor; expand tooltip raw value spec to ALL_LOCATIONS

Apply Gemini PR-446 review feedback (#2, #3, #4) across the chart e2e
suite to align with the project styleguide rule against hardcoded
arbitrary timeouts (.gemini/styleguide.md:328).

#2 — pin-tooltip polling loop replaced with locator.waitFor in:
  - tooltip-columns.spec.ts
  - tooltip-pinned-highlight.spec.ts
  - tooltip-hide-show.spec.ts
  - tooltip-raw-value.spec.ts

#3 — switch-toggle hardcoded waits replaced with expect.toHaveAttribute in:
  - hidden-run-sync.spec.ts (display-only-selected toggle)
  - tooltip-raw-value.spec.ts (smoothing toggle)

#4 — tooltip-raw-value.spec.ts: read RAW VALUE cell by header index, not
positional offset. Important because the recent column reorder (Display ID
→ Series ID, repositioned) means cells.length-1 silently mapped to the
wrong cell on main, making test 3 falsely pass.

Test scope expanded:
  - test 1 (header includes VALUE + RAW VALUE): NON_FS_LOCATIONS → ALL_LOCATIONS (6 → 12)
  - test 3 (raw cell is numeric):                NON_FS_LOCATIONS → ALL_LOCATIONS (6 → 12)
  - test 2 (header omits RAW VALUE off):         stays LOCATIONS_CHARTS_TAB (toggle is occluded by FS modal)

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

* [testing] Fix flaky step-sync-media-types test (count race)

scrollUntilVisible only waits for ONE step slider, but media widgets
mount lazily — the audio/video step navigators usually render a beat
after the histogram one. Counting immediately after the first slider
becomes visible returned sliderCount=1 on slow CI, throwing
"SKIPPED: need 2+ step navigators" even though both sliders would be
present a moment later (visible in the failure screenshot).

Fix: use the existing waitForStepNavigators(page, 2) helper, which calls
expect.toHaveCount(2) under the hood and lets Playwright auto-retry until
both sliders mount.

Pre-existing flake unrelated to this branch's tooltip changes; bundled
because the same PR is touching e2e helpers and the fix is one line.

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

* [testing] Fix tooltip-columns localStorage key + media sync wait semantics

Two corrections from #447 review:

1. tooltip-columns.spec.ts referenced the pre-bump localStorage key
   (uplot-tooltip-columns) in beforeEach cleanup and the saved-config
   readback. Since the v2 storage key bump in this branch, the cleanup
   was a no-op and the readback returned null (silently passing the
   default). Updated both call sites to uplot-tooltip-columns-v2.

2. step-sync-media-types.spec.ts was using waitForStepNavigators(page, 2)
   which calls expect.toHaveCount(2) under the hood — exact match. The
   dashboard mounts up to 4 step navigators (audio + video + images +
   histogram) so the count never stably equals 2 → "skipped" thrown.
   Replaced with sliders.nth(1).waitFor({ state: "visible" }), which is
   "≥ 2" by construction and doesn't constrain the upper bound.

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

* [frontend][testing] Revert tooltip column default-order change

The original PR re-ordered the tooltip column defaults (Run Name first,
"Display ID" → "Series ID" relabeled and moved to second) and bumped the
storage key to v2 to force existing users onto the new default. That
turned out to be unnecessary: drag-to-reorder still works in the column
header, so users who want a different order can do it themselves without
the codebase changing the default for everyone.

Reverts:
- ALL_COLUMNS order back to: Display ID | Run Name | Metric | Value
  (Series Name remains in the list, enabled: false)
- TOOLTIP_COLUMNS_KEY back to "uplot-tooltip-columns" (no v2 bump)
- localStorage cleanup keys in tooltip-raw-value.spec.ts and
  tooltip-columns.spec.ts back to the original key

Note: there is currently no UI to toggle Series Name on/off — the +Add
button was removed in PR #373 (commit d9e46b17) as a fix for header
grid alignment, leaving disabledColumns and addColumnDropdownOpen as
dead code. Out of scope for this PR.

Unit tests use generic column ids, so they continue to pass without
modification. E2E tests assert on header presence, not order, so they
continue to pass.

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

* [frontend][testing] Remove dead Series Name column + leftover toggle UI scaffolding

PR #373 dropped the per-column show/hide UI from the tooltip column
header (drag grips, × buttons, +Add) to fix a grid-alignment bug, but
left behind dead code: the `name` ("Series Name") column had no way to
be re-enabled by users (default was enabled: false), and the toggle
scaffolding was retained as orphan vars and helpers. Cleaning up:

tooltip-plugin.ts:
- Drop "name" from TooltipColumnId, ALL_COLUMNS, DEFAULT_COL_WIDTHS.
- Drop the `case "name"` rendering branch in createTooltipRow.
- Drop nameSpan from the row-cache type and the fast-path cacheEntry
  type, plus the 6 dead `if (cached.nameSpan) ...fontWeight = ...`
  highlight-bold updates that were already guard-protected no-ops.
- Drop nameColIdx + its cacheEntry assignment.
- Drop nameSpan from the search-filter chain (the column was never
  rendered, so its textContent was always undefined).
- Drop addColumnDropdownOpen flag, closeAddDropdown helper + 3 callsites,
  disabledColumns variable, and the stale "Settings panel replaced by
  Neptune-style column headers with +Add dropdown" comment.

tooltip-plugin.test.ts:
- Re-frame the "raw-value goes after Series Name" test as
  "raw-value goes after a user-reordered run-id" — same property
  (raw-value always last), Series Name no longer exists.

Migration: existing users with `name: enabled: true` saved in localStorage
get that entry silently dropped on next load — the init merge logic looks
up each saved id in ALL_COLUMNS via .find() and skips entries with no def.
No localStorage-key bump needed.

Default order for a fresh user remains: Display ID | Run Name | Metric |
Value (with Raw Value auto-appended when smoothing is on). Identical to
what main ships, just without the unreachable 5th column.

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

* [frontend][testing] Add Min/Max tooltip columns + gear popover + FS legend min/max

Three coupled features extending the Raw Value tooltip work:

PART A — Restore the per-column show/hide UI as a gear popover.
PR #373 removed the inline drag-grip / × / +Add controls because they
widened the column-header grid and broke data-row alignment. The new
gear icon (⚙) lives at the top-right of the pinned tooltip OUTSIDE the
header grid (sibling to the close button), and clicking it opens a
popover that lists the toggleable columns with checkboxes. The popover
is appended to document.body so it can extend past the tooltip's
bounds. Click-outside / Escape dismiss it. The plugin's
"click outside pinned tooltip unpins" handler (handleDocumentMouseDown)
now also treats clicks inside the popover as "inside the tooltip" so
toggling a checkbox doesn't accidentally un-pin the parent tooltip.
Escape similarly closes the popover first without unpinning.

PART B — Min and Max as new optional tooltip columns.
Both columns default to disabled in ALL_COLUMNS; users opt in via the
gear popover. Detection mirrors the Raw Value pattern: walk uPlot's
series, identify env_min / env_max companions via lineData.envelopeOf
+ envelopeBound, key the resulting Min/Max maps by the parent's
series.label (the runId-overridden uPlot label, same key Raw Value
uses). For series without envelope companions (raw individual-run
charts) the maps stay empty for that label and the cell renders an
em-dash. Cache adds minSpan / maxSpan; fast-path updates the new
spans alongside rawValueSpan in all 4 sites.

PART C — Fullscreen-sidebar legend numeric expansion + show-min/max toggle.
The series.value formatter in series-config.ts now emits a
"·"-separated list of bare numbers (no min=/max= labels) matching a
new column-header strip rendered ABOVE the moved uPlot legend in the
FS sidebar. The strip's labels adapt to smoothing state ("Raw Value"
shown only when any series has _hasOriginal — a tag I added to
series objects in buildSeriesConfig) and to the new toggle.

The FS toggle is now a boolean (include/exclude min+max), not a min-vs-max
switch. State persists in localStorage as "fullscreen-legend-show-minmax"
("true" | "false"; default false). The button label is "min/max" when
off and "min/max ✓" when on. Clicking flips legendShowMinMaxRef.current
and forces u.redraw(false, true) to refresh the legend cells.

Header strip is right-aligned to match the uPlot legend's value column.

Coverage:
- 5 new vitest cases for formatMinMaxContent (16 total).
- 6 new E2E tests for popover behavior + Min/Max columns (93 total).
- Live browser walkthrough of all 6 acceptance sub-checks (a-f) passes.

Persistence semantics:
- Tooltip column config: existing "uplot-tooltip-columns" key (unchanged).
  ALL_COLUMNS gains min/max entries; the init merge logic at
  tooltip-plugin.ts:33-55 silently appends them to existing saved configs.
- FS legend min/max toggle: new "fullscreen-legend-show-minmax" key.

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

* [frontend][testing] Fix tooltip horizontal-scroll alignment + add Min/Max + FS-legend specs

Scroll/alignment fix:
- Move the column-header strip INSIDE [data-tooltip-content] (the
  scroll container) as the first child, with position: sticky; top: 0.
  Previously the header was a sibling of the rows container, so any
  horizontal scroll on the rows desynced their cells from the header
  labels. Sticky-top keeps the header pinned during vertical scroll.
- Match the header's background to hsl(var(--popover)) (same as the
  surrounding tooltip) so it blends instead of reading as a black bar.
- Add min-width: max-content to both the header wrapper and the data
  rows so each row's box equals its grid's natural width — without
  this, the highlighted background only painted across the visible
  scroll-clipped width when columns overflowed.
- Enable overflow-x: auto on data-tooltip-content so a horizontal
  scrollbar appears when the user resizes the tooltip narrower than
  the column total; both header and rows now scroll together.

Tests added:
- tooltip-raw-value.spec.ts (+6 across LOCATIONS_CHARTS_TAB):
  - Test G: clicking popover checkboxes does not unpin the tooltip
    (regression for the handleDocumentMouseDown body-portal click bug).
  - Test H: Escape closes the popover first; second Escape unpins.
  - Test I: Min/Max column toggles persist across page reloads.
  beforeEach uses a sessionStorage flag so localStorage clears once
  per test rather than on every navigation — otherwise reload would
  wipe the state we're verifying in Test I.
- fs-legend-minmax.spec.ts (new, 6 tests):
  - Default header reads "Value · Raw Value" (×2 FS locations).
  - Min/max toggle flips header AND cell format (×2 FS locations).
  - Toggle state survives page reload (×1 FS location).
  - Smoothing-off + toggle-on shows "Value · Min · Max", no Raw Value.

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

* [frontend] Fix tooltip jumping on pin in fullscreen mode

Radix DialogContent applies `transform` for centering, which establishes
a containing block for `position: fixed` descendants. When pinTooltip
reparents tooltipEl from document.body INTO the dialog (so Radix's focus
scope allows the search input to receive keystrokes), the tooltip's
left/top coords flip from viewport-relative to dialog-relative — making
the tooltip visually jump on pin.

Fix: capture getBoundingClientRect() before and after the reparent,
compute the delta, and adjust style.left/style.top so the visual
position stays pixel-identical. Same compensation applied in reverse
in unpinTooltip when the tooltip moves back to document.body, so the
unpin doesn't briefly flash the tooltip at the wrong spot before
hover-following kicks back in.

Verified with Playwright: BEFORE pin (left=576, top=474, parent=BODY) →
AFTER pin (left=576, top=474, parent=dialog-content). dx=0, dy=0.

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

* [frontend] Simplify FS legend + fix resize-handle flicker

- Remove min/max from FS legend (kept in tooltip popover only)
- Switch to compact "Value (Raw)" parens format (matches main)
- rAF-throttle sidebar drag and pause moveLegend interval mid-drag
  to eliminate the per-mousemove React re-render + uPlot redraw stutter

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

* [frontend] Stop destroying uPlot on every FS sidebar drag tick

Root cause: useChartLifecycle's main effect had width/height in its deps
array, and its cleanup unconditionally destroyed the chart. When the user
dragged the resize handle, ResizeObserver fired ~5x/sec, each tick fired
React's cleanup → chart.destroy() → null refs → effect body fell through
the early-return (chartRef was null) → full uPlot recreation. The legend
table briefly vanished from the sidebar each tick.

Fix has two parts:
1. Track upcoming dim-only changes during render via isDimsOnlyChangeRef.
   The main cleanup checks this ref and skips destroy/listener teardown
   when the next run will hit the early-return. Listeners stay attached
   to the still-alive chart.
2. Add a separate unmount-only useEffect with [] deps for guaranteed
   chart destroy when the component actually unmounts.

Also drop the in-drag setSidebarWidth and the moveLegend pause from the
dialog — those were workarounds for the recreation, no longer needed
now that resize is cheap.

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

* [testing] Regression tests for the tooltip + FS legend bugs found in this PR

Unit (tooltip-plugin.test.ts, +7):
- formatValueContent ~prefix when isInterpolated is true (italic, opacity 0.6)
- formatValueContent: flagText overrides interpolated rendering
- formatValueContent: stale interpolation styles cleared on next render
- formatRawValueContent / formatMinMaxContent: rowHidden → "hidden" warning

E2E (web/e2e/specs/charts/):
- fs-legend-resize.spec.ts (new, 5 tests, [AR-C-FS])
  * legend rows do not blank out during resize drag — guards against
    use-chart-lifecycle's cleanup destroying uPlot on every dim change
  * .uplot root has zero DOM mutations during drag — stronger sensor
  * sidebar width persists across reload via localStorage
  * pin tooltip does not jump on transform-containing-block reparent
  * FS popover stacks above tooltip rows (Max checkbox click hits the
    checkbox, not the MAY-16 row underneath)
- tooltip-interpolated-value.spec.ts (new, 1 test, [AR-C])
  * cursor at off-cadence step → tooltip shows ~prefixed value for the
    sparse run, plain value for the dense run
- tooltip-raw-value.spec.ts (extended, +3 tests × 2 locations)
  * column header strip and rows share the same scrollLeft (sticky-top
    inside the scrollable content, not a sibling)
  * highlighted row's box width ≥ grid scrollWidth (min-width: max-content
    so the blue highlight covers all columns when scrolled)
  * hidden series propagates "hidden" into Value, Raw Value, Min, Max cells

Seed (web/server/tests/setup.ts §5d-bis):
- interp-dense-cadence + interp-sparse-cadence runs sharing interp/loss
  metric at every-1-step vs every-50-steps cadence, in smoke-test-project,
  far past createdAt so they don't auto-select. Used by the
  tooltip-interpolated-value E2E test.

Also export formatValueContent for unit testing (was internal-only).

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

* [testing] Expand E2E location coverage for hide / Min-Max / FS-resize / Escape

- Min/Max numeric cells: LOCATIONS_CHARTS_TAB → AR_LOCATIONS (6 AR cells
  including Dashboard and FS) since AR multi-run charts have envelope
  companions in every AR context.
- Hide propagation: LOCATIONS_CHARTS_TAB → ALL_LOCATIONS (12) and switch
  the hide mechanism from chart-legend click to tooltip-row click —
  tooltip-plugin row click toggles series.show in every location, so the
  test now exercises FS, dashboards, and IR uniformly.
- FS-resize specs (legend rows persist, no .uplot mutations, pin no-jump,
  popover no-click-through): ["AR-C-FS"] → FS_LOCATIONS (6 cells) so the
  fix in use-chart-lifecycle is verified across multi-run, single-run,
  charts-tab, and dashboard FS contexts.
- New: [AR-C-FS] Escape priority 3-level test (popover → tooltip → dialog)
  — the dialog's onEscapeKeyDown was untested.

Net E2E count for the affected files: 58 → 85 tests across 3 files.

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

* [testing] Sync E2E test improvements from PR 450 onto ryandev16

Brings the four new E2E spec files in line with the work iterated on
PR 450 (the e2e-tests-only draft). Includes:

- Remove low-signal tests:
  * fs-legend-resize "Legend rows persist throughout drag" × 6 — too weak
    a sensor; falsely passed in 5/6 locations even when the
    chart-recreation bug was firing.
  * fs-legend-minmax "No Min/Max toggle button" × 1 — defensive guard for
    a button that never existed on main.
  * fs-legend-resize "Sidebar width persistence" × 1 — defensive guard
    for an existing feature, flaky in CI on post-reload scrollIntoView.

- Convert all test.skip() guards to descriptive expect() failures so a
  missing prerequisite (gear icon, tooltip, popover) shows up as a
  diagnosable failure rather than silently skipping.

- Fast-fail timeouts on gear-icon clicks (2s) and setColumnEnabled
  (try/catch with 2s on click + 2s on popover wait) so missing-feature
  failures resolve in seconds instead of consuming the action timeout.

- Force-narrow the pinned tooltip to 300px in the scroll-alignment and
  highlight-coverage tests so the grid actually overflows; otherwise
  on wide viewports those checks were vacuously skipping.

- Per-test testTimeout values (30s default, 60s for reload-persistence,
  45s for the smoothing-toggle test) so a hung test fails in seconds
  instead of consuming the project-level 6-min timeout.

NOT included: retries=0. PR 450 set retries=0 to avoid wasted CI time
on tests guaranteed to fail on main; PR 447 keeps the project default
(2 retries) since the fixes here should make every test pass.

Net new test count for the 4 specs: 89 → 81.

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

* [testing] Fix three test-side bugs uncovered by the column-header DOM move

PR 447 moved the tooltip column-header strip inside [data-tooltip-content]
so it scrolls with the rows. The header's inner row also has display:grid,
which broke selectors that assumed only data rows match. Fixed all three
helpers + one inline scan + one inline click target. Also restricted the
highlighted-row test to AR-C only and re-applied the metric filter after
the persist-reload test's reload.

Group A — column-header counted as a row (96 failures across 3 specs):
- tooltip-hide-show.spec.ts: countTooltipRows now filters out elements
  inside [data-tooltip-column-headers]. Inline locators switched from
  '[data-tooltip-content] div[style*="grid"]' to direct-child selector
  '[data-tooltip-content] > div[style*="grid"]' so only data rows match.
- tooltip-series-count.spec.ts: contentArea.children.length now skips
  the column-header wrapper.
- tooltip-raw-value.spec.ts: readFirstRowCells, the highlighted-row scan,
  the hidden-row click target, and the hidden-row reader all filter out
  elements inside [data-tooltip-column-headers].

Group B — single-series chart has no highlighted row (1 failure):
- tooltip-raw-value.spec.ts "Highlighted row covers all columns when
  scrolled" restricted from LOCATIONS_CHARTS_TAB (AR-C, IR-C) to ["AR-C"].
  IR-C charts have a single series so hover-driven focus detection can't
  pick out one row to highlight.

Group C — post-reload chart isn't a line chart (2 failures):
- tooltip-raw-value.spec.ts "Min/Max persist across reload" now re-applies
  searchMetricGroups("metric") after page.reload(). Without this, the
  histograms group renders first (which has no .uplot .u-over overlay)
  and scrollIntoViewIfNeeded times out at 10s.

Tests removed: 0. Tests scoped down: 1 (highlight-coverage from 2 to 1).
Net new tests in PR: 81 → 80.

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

* [testing] Fix bucket-alignment flake — filter metric tree before waitForCharts

CI run b0sdkbnnhxpl9f9idjhdosbl had this single test fail with
"TimeoutError: page.waitForSelector(.uplot canvas): Timeout 30000ms
exceeded" while 5 of 6 sibling shards passed it cleanly. The screenshot
showed the project page successfully loaded with the `media/*` group
expanded and `logs (1)` below — but the train metric group's line charts
hadn't attached to the DOM yet.

Root cause: `navigateToFirstProject` lands on smoke-test-project which
has many metric groups (train/*, media/*, logs/*, distributions/*,
interp/*). LazyChart only mounts widgets when they enter the viewport.
On unlucky shards where media/logs render at the top, the train line
charts (which the test actually needs) live below the fold and never
attach within 30s — `.uplot canvas` never matches and the test fails.

Fix: apply `searchMetricGroups("metric")` after navigating, before
`waitForCharts`. That filters the metric tree to only `train/metric_xx`
line-chart groups, so a uPlot canvas attaches immediately. Doesn't
change which runs are selected (auto-select stays the same), so the
batch-bucketed alignment check still has multi-run data to verify.

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

* [frontend] Apply Gemini review feedback (4 items)

1. Column popover (toggleColumnPopover) now uses CSS-variable theme
   tokens (hsl(var(--popover)), hsl(var(--border)), hsl(var(--foreground)))
   instead of hardcoded #1a1a1a/#fff hex pairs — matches the main tooltip
   element and tracks any future theme-token changes. Drops the now-unused
   `theme` parameter from the function signature.

2. Extract `compensateFixedPositionAfterReparent(el, desired)` helper for
   the position-fixed coordinate compensation that was duplicated in
   pinTooltip, unpinTooltip, and toggleColumnPopover (3 sites). Each
   helper call replaces ~8 lines of rect-delta math.

3. toggleColumnPopover's click-outside dismiss now uses
   `anchor.contains(target)` instead of `target === anchor`. Equality
   works today (button only has a text-node child, which can't be an
   event target per DOM spec), but breaks the moment anyone wraps the
   ⚙ glyph in a <span> or swaps it for an SVG. Standard contains-check
   idiom is future-proof.

4. Extract `collectCompanionValues(u, lines, idx)` returning
   { rawValues, rawFlags, minValues, maxValues }. The full-rebuild path
   (updateTooltipContent) and fast-path (updateTooltipValues) had two
   near-identical ~25-line blocks doing the same companion-series scan.
   When Min/Max collection was added it had to be done twice; the next
   numeric column would have hit the same trap.

No behavior change. All 792 unit tests pass; typecheck clean.

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

* [frontend][bugfix] Pinned tooltip survives auto-refresh + route preload

Bug A — pinned tooltip vanished every few seconds on RUNNING runs because
`useRefreshTime` scheduled its own `setInterval` in parallel with the
RefreshButton's existing smart timer, bypassing the button's popup-defer
and tab-pause logic. Deleted the redundant timer; the hook is now
handler-only (timestamp persistence + manual `handleRefresh`).

Bug B — pinned tooltip vanished when hovering any left-sidebar link
because TanStack Router prefetch was past the 5s staleTime and recreated
the chart underneath. Added a 250ms deferred-unpin protocol in
`tooltip-plugin.ts`: destroy() defers clearing the pin; init() cancels
the deferral when the same chartId re-mounts. Defends against any
chart-recreation cause (refresh, preload, dim change, zoom refetch).

Also pinned pnpm@10.9.0 in `web/app/Dockerfile` — the unpinned install
was pulling pnpm 11.x, which fails the frontend build over
`ERR_PNPM_IGNORED_BUILDS`.

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

* [frontend][bugfix] Fix smoothing-clobber race in URL↔IndexedDB sync

Customer reports: smoothing toggle would reset itself to ON after a
page reload on dashboards that had `?inherited=false` in the URL.

Root cause — race in two cooperating useEffects:
  1. `useLocalStorage` initializes React state to `defaultValue`
     synchronously, then async-resolves to the saved IndexedDB value
     ~150ms later.
  2. The URL→setting effect at metrics-display.tsx:84-88 fires on
     mount during that 150ms window. It calls `updateSettings`, which
     spreads the closure-captured `settings` (still defaults!) and
     writes the whole object back to IndexedDB — clobbering the user's
     saved smoothing preference with the default `enabled: true`.

Fix: `useLocalStorage`'s setter now accepts a functional updater
`(prev) => T`. The updater receives the freshest persisted value (read
directly from IndexedDB at write time), not the stale React closure.
`useLineSettings`'s `updateSettings` / `updateSmoothingSettings` use
the functional form. The merge always runs against the actual saved
state, so partial writes can't clobber unrelated keys.

Verified live against pre-fix and post-fix builds:
- Pre-fix: seed `smoothing.enabled=false`, navigate to `?inherited=false`,
  reload → IndexedDB shows `smoothing.enabled=true` (clobbered).
- Post-fix: same scenario → IndexedDB stays `false` (preserved).

4 new unit tests in local-cache.test.ts cover the race-safety contract.

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

* [testing] E2E coverage for tooltip-pin / smoothing-clobber fixes

Adds 15 Playwright specs across 4 files, plus a seeded RUNNING-status run
for tests that need to exercise auto-refresh polling.

Spec 1: tooltip-survives-running-autorefresh (3 tests, IR non-FS, RUNNING)
  Bug A — pin must survive ~12s of 5s-interval auto-refresh polling.
  Forces interval via localStorage seed; asserts pin still present after
  multiple cycles. On main: pin vanishes within 1-2 cycles.

Spec 2: tooltip-survives-sidebar-prefetch (3 tests, IR non-FS)
  Bug B — pin must survive hovering every left-sidebar nav link with 6s
  waits past the TanStack Router 5s prefetch staleTime. On main: pin
  vanishes after the first hover that triggers refetch+recreation.

Spec 3: tooltip-pin-survives-chart-recreation (6 tests, NON_FS = IR+AR)
  Defensive coverage for the tooltip-plugin deferred-unpin protocol
  itself. Forces chart recreation via smoothing-toggle (trigger-
  independent of polling or prefetch); asserts pin survives a rapid
  off→on→off cycle that exercises the 250ms defer window edge.
  Symmetric across IR + AR + charts + dashboards (static & dynamic).

Spec 4: smoothing-not-clobbered-by-inherited-url (3 tests, AR non-FS)
  Smoothing-clobber race fix — seeds IndexedDB with
  smoothing.enabled=false + showInheritedMetrics=false, reloads with
  ?inherited=false in URL, asserts smoothing.enabled stays false. On
  main, the URL→setting effect clobbers it to true via stale-defaults
  spread.

Seed: one new RUNNING-status run (a-running-run-001) in setup.ts,
sharing the same metric-seeding pipeline as the other bulk runs. Exposed
via `TEST_RUN_RUNNING` constant in test-helpers.ts.

Helpers: chart-locations.ts gains an `irRunName` option on `SetupOptions`
so any forEachChartLocation call can target the RUNNING run instead of
the default TEST_RUN_INDIVIDUAL, plus two new location groups
(LOCATIONS_IR_NON_FS, LOCATIONS_AR_NON_FS) for asymmetric-coverage specs.

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

* [testing] Apply Gemini review feedback on new e2e tests

Addresses 5 of 6 review comments on PR #447's e2e additions:

1. (high) smoothing-clobber spec: drop the buggy `getActiveOrgId`
   reimplementation (missing `?batch=1`, wrong response-shape parse).
   Import the existing `getOrganizationId` helper from test-helpers.ts.

2. (medium) smoothing-clobber spec: replace `waitForTimeout(2000)` with
   a fail-fast polling loop reading IndexedDB. Caps at 3s budget but
   exits the moment a regression is observed.

3. (medium) Tooltip pin/hover helpers were duplicated across 3 specs.
   Extracted `hoverUntilTooltipVisible`, `pinTooltip`, and
   `pinnedTooltip` into `web/e2e/utils/tooltip-helpers.ts`. All three
   specs now import from there.

4. (medium) running-autorefresh: replace the `document.querySelectorAll('*')`
   RUNNING-status fallback with a clean `[data-testid="run-status-badge"]`
   text check (the actual badge selector — `[data-run-status]` doesn't
   exist).

5. (medium) running-autorefresh: replace `waitForTimeout(12_000)` with
   `Promise.all` of two `waitForResponse` calls matching graph-batch
   refresh URLs. Event-driven; ~10-12s typical, fails fast on missing
   ticks, capped at 14s.

#6 (sidebar-prefetch's `waitForTimeout(6_000)`) intentionally kept —
the wait IS the trigger condition. TanStack Router's prefetch only
fires past the 5s `runs.get` staleTime; replacing the wait with
`waitForResponse(prefetch)` either short-circuits early (skipping past
the buggy condition) or hangs when no refetch fires. The 6s is
load-bearing, not a smell. Documented inline.

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

* [testing] Force hard reload in smoothing-clobber spec

The previous version used `page.goto(sameUrlWithInheritedFalse)` to
trigger the bug. That doesn't work: TanStack Router treats
query-param-only navigations on the same path as soft navigations, so
React components stay mounted and `useState` never re-runs with
DEFAULT_SETTINGS. The buggy URL→setting effect re-evaluates with the
current (post-seed) state instead of the stale DEFAULT it needs to spread
— no clobber, no bug, test passes wrongly.

Empirically verified on pre-fix code (dev container with source fix
reverted): page.goto(sameUrlWithInheritedFalse) → smoothing.enabled stays
false (bug doesn't fire). page.reload() → smoothing.enabled flips to true
(clobber confirmed).

Fix: ensure `?inherited=false` is in the URL, then `page.reload()`.
The reload bypasses TanStack Router entirely — a real browser reload that
unmounts React, so the next mount starts with `useState(DEFAULT_SETTINGS)`,
which is the exact race window the bug exploits.

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

* [testing] Redesign smoothing-clobber spec as a real UI flow + setup cleanup

Replaces the previous "seed IndexedDB directly, force reload, read IDB"
test with the actual customer scenario, exercised through the real UI:

  1. Default state — URL has no `inherited=` param.
  2. Click `#toolbar-smoothing` to toggle smoothing OFF.
  3. Reload — smoothing must remain OFF (auto-retry handles the legitimate
     post-reload flicker where React state inits to DEFAULT for ~150-300 ms
     before liveQuery hydrates from IndexedDB).
  4. Open Line Settings drawer (gear-icon button, now with
     data-testid="line-settings-trigger" for stable targeting).
  5. Toggle "Show inherited metrics" OFF via the actual switch — NOT by
     setting the URL param directly, since that would cause an unintended
     navigation/reload mid-test.
  6. Close drawer (Escape). URL writer mirrors the saved setting and
     `?inherited=%22false%22` appears (TanStack Router JSON-encodes
     search values; checks parse the search param instead of substring).
  7. Reload — this is the moment the pre-fix bug fires. URL→setting
     effect spreads stale DEFAULT_SETTINGS over the saved record,
     clobbering smoothing.enabled to ON. The flicker-aware
     `await expect(toggle).not.toBeChecked({ timeout })` polls past the
     legitimate flicker window — on the bug case the toggle stays ON
     forever and the assertion times out; on the fix case the toggle
     resolves to OFF as IndexedDB hydrates.

Empirically verified locally against the dev container:
  • Post-fix (functional-updater) build: test PASSES.
  • Pre-fix build (source-fix files reverted): test FAILS at step 7
    with "expected not to be checked, actual: checked".

Cleanup #1: `setupAllRunsDashboard` now resolves the dashboard view ID
and run SQIDs entirely via API context (no first goto for session
context). Single `page.goto` with the resolved URL. Saves ~1.5 s per
dashboard test setup and removes the brief "project loads with default
5 runs" visual flash before the real URL kicks in. Added
`getDashboardViewIdViaApi` as the API-context variant of
`getDashboardViewId`; existing page-form `getDashboardViewId` stays for
other callers.

Tracking tags:
  • `data-testid="line-settings-trigger"` added to the LineSettings drawer
    trigger button (line-settings.tsx:136). Makes the spec robust to icon
    changes or nearby button additions.

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

* [testing] Revert setupAllRunsDashboard goto cleanup

The "skip the first goto" cleanup introduced by fb2f64fe broke
dashboard-using tests across the suite. The first
`page.goto(/o/$slug/projects/$name)` has a load-bearing side effect:
visiting the org-scoped URL triggers better-auth's
`setActiveOrganization(slug)` async call. Without it, the session's
`activeOrganization` stays at whatever it was last set to (often null
or a different org), so the subsequent `dashboardViews.list` API call
filters by the wrong org and returns no views — failing every dashboard
test with "Dashboard 'Line Chart Variants Test' not found. Available:".

Reverting `setupAllRunsDashboard` to the original two-goto pattern and
removing the unused `getDashboardViewIdViaApi` helper. The brief
"project loads with default 5 runs" flash before the real URL kicks in
is annoying but harmless; the alternative would be to explicitly call
the set-active-organization tRPC mutation before resolving views, which
is more invasive than the visual nicety is worth.

The smoothing-spec redesign and `data-testid="line-settings-trigger"`
from the same commit are kept — those are unrelated and functioning.

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

* [testing] Drop chart-recreation defensive spec; switch autorefresh to fixed wait

Two adjustments after CI on ryandev16 (with source fix) surfaced false
failures in the new test matrix:

1. **Drop `tooltip-pin-survives-chart-recreation.spec.ts` (6 tests).**
   This was defensive coverage for the tooltip-plugin defer-and-cancel
   protocol — force a chart recreation via the smoothing toggle, assert
   the pin survives. But the defer protocol only catches recreations
   where the chart re-mounts with the SAME `chartId` within 250 ms of
   destroy. The smoothing toggle path doesn't fit either constraint:
   adding/removing the `(original)` companion line takes longer than
   250 ms to settle in uPlot, and React may remount the LineChart with
   a fresh `useId()`. So the spec was testing a scenario the fix never
   claimed to defend against — failing on the fix branch with "defer
   protocol regressed" was a false positive. Not one of the originally
   reported bugs (A or B), and the actual triggers for A and B are
   already covered by sibling specs `tooltip-survives-running-autorefresh`
   and `tooltip-survives-sidebar-prefetch`. Deleting cleanly.

2. **Revert autorefresh spec to fixed wait.** The earlier switch from
   `waitForTimeout(12_000)` to `Promise.all` of two `waitForResponse`
   calls (Gemini comment #5) was wrong-headed for this test. With the
   source fix in place the RefreshButton's popup-defer correctly skips
   its tick while the tooltip is pinned, so NO `graphBucketed` response
   ever fires — `waitForResponse` hangs the full 14 s and the test
   fails with TimeoutError. Reverting to a fixed 12 s wait is the right
   shape: "let time pass, see if the pin survives." On `main` (no fix),
   the redundant `useRefreshTime` setInterval bypasses popup-defer,
   chart recreates, pin dies, assertion catches it. On fix, nothing
   fires, pin trivially stays. Either branch behaves correctly. Inline
   comment explains why `waitForResponse` doesn't work here.

Net change to the new e2e matrix: 15 tests → 9 tests
(Spec 1 autorefresh: 3, Spec 2 prefetch: 3, Spec 4 smoothing: 3).

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

---------

Co-authored-by: Ubuntu <azureuser@ryan-dev-azure-ebd1-27ae-0.hws5gqy4aacuhplmnpd3zr4cxb.bx.internal.cloudapp.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
public-repo-publish Bot pushed a commit that referenced this pull request Jun 6, 2026
…n (#454)

* docs: spec for runs-table search "Other matches" dropdown

Adds a design spec for the search-while-filtered UX issue: when a filter
or "Display only selected" is active, users cannot add runs from outside
the current view to their selection without disabling the constraint.

The proposed dropdown beneath the search input surfaces out-of-view
matches, lets users select them, and relies on the existing
mergeSelectedRuns / ensureSelectedRunsIncluded logic to make them
sticky-visible in the table.

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

* docs: implementation plan for search "Other matches" dropdown

Bite-sized TDD plan covering the spec at
docs/superpowers/specs/2026-05-12-search-other-matches-dropdown-design.md.
Nine tasks: extract useLocalStorageBool, lift showOnlySelected, extend
handleRunSelection with runFallback, useSearchOtherMatches hook,
SearchOtherMatchesDropdown component, toolbar wiring, backend smoke
regression-guard, Playwright spec, final rebuild + hand-off.

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

* refactor: extract useLocalStorageBool hook from use-data-table-state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: lift showOnlySelected state to parent route

Move showOnlySelected localStorage state from useDataTableState into
index.tsx so the parent route can read it. DataTable now accepts it as
controlled props; useDataTableState receives it as parameters and resets
pageIndex via useEffect when it changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: guard pageIndex reset and drop setShowOnlySelected pass-through

Add isFirstShowOnlySelectedRender ref guard so the showOnlySelected
useEffect skips the initial mount and only resets pageIndex on real
user toggles. Remove setShowOnlySelected from useDataTableState's
return object — data-table.tsx already owns onShowOnlySelectedChange
as a prop and passes it directly to TableToolbar.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: drop dead setShowOnlySelected param from useDataTableState

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(runs-table): handleRunSelection accepts optional runFallback

Adds a 3rd optional argument `runFallback?: Run` to `handleRunSelection`
so callers can supply a run object when the target run is outside the
current paginated `runs` array (e.g. "Other matches" dropdown). Falls
back to the live array entry when present, making the fallback truly a
last resort.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: configurable matchMedia stub to avoid future redefine errors

Code review nit from Task 3 — without configurable: true, any later
test that tries to redefine window.matchMedia in the same jsdom
process throws TypeError: Cannot redefine property.

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

* feat(runs-table): useSearchOtherMatches hook for out-of-view matches

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor: clarify useSearchOtherMatches contract (hasMore, resultCount, Set stability)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(runs-table): SearchOtherMatchesDropdown component

Dropdown renders out-of-view matches as clickable rows and in-view matches as grayed "In table" badges, with Esc-to-close and optional hasMore footer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(search-other-matches): fix createdAt type cast, loading state, Set lookup

Three nits from code review on Task 5:
- formatCreatedAt now accepts Date | string | undefined; drop the
  unsound `as unknown as string` cast at the call site.
- Show a "Loading…" indicator when isLoading=true with no rows yet so
  the dropdown does not flash an empty shell on first open.
- Precompute the in-view ID set so per-row lookup is O(1) instead of
  O(N×M) (negligible at the 30-row cap, but free).

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

* feat(runs-table): wire SearchOtherMatchesDropdown into toolbar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(runs-table): drop unneeded casts in filterActive memo

Code review nits on Task 6:
- ServerFilters already types fieldFilters/metricFilters/systemFilters
  as concrete param arrays; `as unknown[]` adds noise without benefit.
- Add a comment to inViewRunIds explaining why the second loop matters
  (covers IndexedDB-hydrated selected runs not in the current page).

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

* test(smoke): regression-guard runs.list unfiltered search (dropdown contract)

Adds Test 12.9 to Server-Side Search suite asserting that runs.list
with only `search` and `limit` (no filter params) returns matching
runs. The "Other matches" dropdown depends on this behavior to surface
runs that the main table's filter is hiding.

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

* test(e2e): runs-table search-other-matches dropdown

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(search-other-matches): click-outside dismiss + paint-during-scroll glitch

Two bugs reported during manual testing:

1. Clicking outside the search bar did nothing. Expected: dismiss the
   dropdown, but keep the typed query so the user can come back to it.
   Add onDismiss prop wired to a document mousedown listener that fires
   when the click lands outside the search input's `.relative` wrapper.
   Parent (index.tsx) tracks otherMatchesDismissed; typing in the input
   resets the dismissal so the dropdown can reappear. Esc keeps its old
   semantics (clear input + close).

2. During fast table scroll, the dropdown's underlying toolbar buttons
   ("Filter", "Columns") would briefly paint through. Add `isolate`
   (own stacking context) + `transform-gpu` (own composite layer) so
   the dropdown is promoted off the main paint thread.

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

* fix(runs-table): pagination total ignored sticky out-of-filter selected runs

When a filter is active and the user has runs selected that don't match
the filter, those runs are sticky-appended to displayedRuns via
ensureSelectedRunsIncluded. Pagination computed totalPages from runCount
(the server's filter total) alone, so the sticky rows landed past the
last UI page and became unreachable.

Example: filter matches 10 runs, 2 sticky selected, pageSize=10:
  Before: totalPages = ceil(10/10) = 1 — sticky rows invisible
  After:  totalPages = ceil(max(10,12)/10) = 2 — sticky on page 2

`runsLength` is the size of the actual table-data array passed to
TanStack Table (filter rows + appended sticky). Clamping
effectiveCount to at least runsLength fixes both TablePagination and
PageInput. Verified manually at pageSize=5 (3 pages, sticky on p3) and
pageSize=10 (2 pages, sticky on p2).

Pre-existing bug — not introduced by the search-other-matches branch
but surfaced while debugging it.

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

* fix(search-other-matches): re-open dropdown when search input is refocused

After dismissing the dropdown via click-outside, the input still held
the typed query but the dropdown stayed hidden until the user typed a
new character. Add an onSearchFocus handler that resets the dismissal
state — clicking back into the search bar now restores the dropdown.

The render-gate stack still applies: if there are no out-of-view hits
(filter cleared, query empty, etc.) the dropdown remains hidden.

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

* fix(search-other-matches): dropdown empty when "Display only selected" is on

inViewRunIds was always built from tableRuns (the full server fetch) +
selected. In Display-only-selected mode the table only renders selected
runs — but every loaded run still ended up in inViewRunIds, so a search
that hit any unselected run got partitioned as "in view" and the
dropdown gate (outOfView.length === 0) hid the popover.

Make inViewRunIds conditional on showOnlySelected:
  on  → just selected ids
  off → tableRuns ids + selected ids (existing behavior)

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

* fix(css): missing % on --popover lightness in dark theme

Line 98 had `--popover: 240 8.7% 7.8;` — no % on the lightness. The
generated `hsl(240 8.7% 7.8)` is invalid (lightness must be a
percentage), so any element relying on `bg-popover` for its background
had effectively no fill in dark mode. That's why the "Other matches"
dropdown showed through during fast scroll — the only painted pixels
were the rows themselves (which only have hover backgrounds), and the
container had nothing under it.

Every other variable in the same block uses `%` correctly; this was a
plain typo. Affects all Radix popovers, command menus, and the new
search-other-matches dropdown.

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

* fix(search-other-matches): paint bg-popover on each row, not just container

Even with bg-popover + isolate + transform-gpu on the container, fast
scrolls let the underlying toolbar (Filter/Columns buttons) leak through
between rows. The container's bg layer is opaque per computed-style, but
during rapid scroll the GPU compositor briefly draws the rows before
the parent's bg layer repaints, exposing what's underneath.

Painting bg-popover on each row (and on the header + footer) gives every
visible pixel an explicit fill, so the rendering never depends on the
parent's bg landing on the same frame as the row content.

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

* fix(search-other-matches): drop isolate/transform-gpu — they caused the bleed

Earlier I speculatively added `isolate transform-gpu` thinking they'd
fix paint-during-scroll. They don't — they CAUSE it. Promoting the
dropdown to its own composite layer means the scrolling-contents layer
and the parent bg layer can desync during fast scrolls, which is
exactly the symptom (rows paint a frame ahead of the bg, briefly
exposing the toolbar underneath).

Per-row `bg-popover` (committed earlier) is the actual fix — every
visible pixel has its own opaque fill so the rendering never depends
on layer sync. With per-row bg in place, isolate/transform-gpu were
purely a regression source.

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

* docs: E2E follow-up plan for search-other-matches branch

10 new test cases covering bugs caught during manual testing
(pagination + sticky runs, display-only-selected interaction, click-
outside dismiss + refocus reopens) plus a risk audit of existing specs
that may need expectation updates because the pagination total now
accounts for sticky out-of-filter selected runs.

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

* fix(search-other-matches): Esc dismisses like click-outside (keeps input)

Previously Esc cleared the search input and click-outside left it
alone — two different semantics that the user didn't ask for. Make
Esc behave the same way: dismiss the dropdown but keep the typed
query so refocusing the input brings it back.

Also drop the per-row/header/footer bg-popover additions. They didn't
fix the see-through-on-fast-scroll bug for the user reporting it, and
were never validated as the actual cause. Container bg-popover stays —
that's the original styling.

Consolidates the onClose + onDismiss props into a single onDismiss
since they're now equivalent.

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

* test(e2e): update search-other-matches spec for new dismiss semantics

- Tighten "display-only-selected" test (#3) to assert at least one
  clickable out-of-view row exists. Catches the empty-dropdown
  regression that existed before commit 2c6ceeff — the old assertion
  (dropdown visible) passed even when the dropdown rendered with zero
  actionable rows.
- Update "Esc" test (#4) to match the new dismiss-keeps-input behavior
  (was: clears input).
- Add "click-outside dismisses but keeps input" (#6).
- Add "refocus re-opens dropdown with same query" (#7).

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

* test(e2e): sticky-selected-pagination spec for cfb54945 fix

Four cases covering the pagination fix that ensures sticky-selected
runs (in the selection set but outside the active filter) remain
reachable via the page indicator instead of being silently truncated:

1. pageSize=10 + 10 filter matches + 2 sticky → totalPages >= 2,
   sticky runs visible on the last page.
2. pageSize=5 + same setup → totalPages >= 3, sticky runs on page 3
   (reached via the page-input jump path, not just next-button clicks).
3. No sticky runs → totalPages stays at 1, guarding against the
   inverse regression where the fix unconditionally bumps the count.
4. Clearing the filter mid-test → totalPages jumps up because the
   sticky bump no longer applies; the previously-sticky runs are now
   counted as regular rows.

Reuses existing test-helpers (searchAndSelectRun, getPageInfo) and
mirrors the filter-popover pattern from search-filtering.spec.ts.

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

* review(other-matches): caller-side enabled gate on useSearchOtherMatches

Per PR review (Gemini #1–3): accept an optional `enabled` param on the
hook so the parent can suspend it when the dropdown is dismissed.
Practical effect is small — the hook is debounced and TanStack-cached
— but it does prevent refetchOnWindowFocus from re-firing during a
dismissal cycle, and the hook shouldn't run when its output is unused.

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

* test(e2e): fix Filter button locator — lucide aliased Filter → Funnel

The Filter button used `<Filter />` from lucide-react. In v0.487 that
export aliases to `Funnel`, so the rendered SVG carries class
`lucide-funnel`, not `lucide-filter`. The CSS-class selector
`button:has(svg.lucide-filter)` matches nothing — 9 e2e tests timed
out on `.click()` waiting for an element that never appeared.

The pre-existing `search-filtering.spec.ts` has the same bug but uses
`test.skip(...)` if the button isn't found within 3s, so it silently
skipped instead of failing — worth fixing separately.

Switch both my new specs to `getByRole("button", { name: /^Filter\\b/ })`
which matches by accessible name and won't break if lucide renames the
icon again.

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

* test(e2e): deselect-all in beforeEach — page auto-selects first 5 runs

A fresh visit to the runs page (no ?runs= URL param, no IndexedDB
cache) auto-selects the first 5 runs via use-selected-runs.ts:449
`buildDefaultSelection(runs, 5)`. The test environment hits this every
time, so previous tests assuming an empty starting selection were off
by 5 sticky runs:

- sticky-selected-pagination "no extra page" expected total=1, got 2
- sticky-selected-pagination pageSize=5 jumped to p3, but sticky tail
  lived on p4
- Visible 5 colored avatars in the Stably failure video that I'd been
  attributing to state leak

Call `deselectAllRuns` in beforeEach so every test starts from a
known-empty selection state and sets up only what it needs.

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

* test(e2e): fix Name-field selection in applyNameContainsFilter

Two real bugs in the helper, both caused tests to fail at the
configure-step transition:

1. `filter({ hasText: /^name$/i })` — anchored regex against an option's
   full textContent, which is "Name sys text" (label + source-badge +
   type-badge concatenated). The regex never matched. `search-filtering.
   spec.ts` has the same broken locator but silently `test.skip()`s
   when not found, hiding the bug.

2. After picking the field, I pressed Enter to apply the filter instead
   of clicking the explicit Apply button. Enter doesn't reliably submit
   the form; handleApply is wired only to the button's onClick.

New flow walks every step of the popover UI:

  - Click Filter toolbar button
  - Type "name" in the cmdk search
  - Press Enter → cmdk's keyboard handling selects the auto-highlighted
    first match (the "Name" system field), popover transitions to step
    = "configure". This sidesteps the brittle text-matching entirely.
  - Fill the value input
  - Click Apply → handleApply() validates, calls onAddFilter, and
    closes the popover via setOpen(false). No trailing Esc needed.

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

* test(e2e): tighten applyNameContainsFilter — verified flow end-to-end

Walked through the popover steps manually with a headless-Playwright
script against the dev server before committing. Watched the actual
DOM at each transition:

  - field step has cmdk search input (placeholder="Search columns...")
  - press Enter on that input → cmdk's keyboard handler selects the
    auto-highlighted "Name" item, popover transitions to configure
  - configure step has 1 input with placeholder="Enter value..." and
    4 buttons: contains / AND / Back / Apply
  - filling the value input makes canApply=true, Apply enables
  - clicking Apply runs handleApply → setFilters + setOpen(false)
  - popover unmounts, Filter toolbar button gains "1" badge

Three concrete improvements:

1. Target the value input by its exact placeholder rather than
   `.last()`. Removes any ambiguity if the cmdk input briefly
   co-exists with the configure-step input during the React render
   batch.

2. Click the value input before filling, so the autoFocus race
   (filter-value-input.tsx:44) doesn't drop the typed characters.

3. After clicking Apply, assert BOTH the popover unmount AND the
   Filter button's "Filter <count>" badge. Either failure points the
   reviewer at the helper instead of cascading into "dropdown not
   visible" five lines later.

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

* test(e2e): apply filter via DOM click + verify by Filter badge, not popover unmount

Previous helper waited for the popover wrapper to detach after Apply.
That's wrong: Radix often keeps the [data-radix-popper-content-wrapper]
element attached after the inner content unmounts (animation /
positioning state). The CI failure was the false-negative.

The actual load-bearing signal that Apply worked is the toolbar's
Filter button gaining its count badge (handleApply → onAddFilter →
setFilters([...prev, filter]) → button text becomes "Filter 1").
Assert that instead.

Also switched the click itself to a DOM-dispatched click via evaluate,
which bypasses Playwright's stability / pointer-events checks. The
visible button proves it's the right element; we just need onClick to
fire.

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

* test(e2e): use data-testid for Filter button / Apply / Clear all / count badge

Add four testids to filter-button.tsx:
  - filter-button         — toolbar trigger
  - filter-button-count   — badge that renders when filters.length > 0
  - filter-popover-apply  — Apply button in configure step
  - filter-popover-clear-all — Clear all button in field step

Switch three specs to use them: search-other-matches.spec.ts,
sticky-selected-pagination.spec.ts, and search-filtering.spec.ts
(which was silently `test.skip`ping on the broken lucide-filter
selector). No more role/name string matching, no more popover-scope
ambiguity, no more CSS-class brittleness across lucide-react versions.

Verified locally end-to-end via headless Playwright probe — all four
testid locators resolve and the filter applies / clears as expected.

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

* test(e2e): click cmdk item directly instead of Enter — fixes CI dev-mode flake

CI failure stack from build 2818 showed waiter at line 93
(input[placeholder="Enter value..."]) — field-picker step never
transitioned to configure step. Root cause: cmdk's Enter-keyboard nav
doesn't fire reliably in Vite dev mode, so handleSelectField never ran
and handleApply early-returned at `if (!selectedField) return`.

Replace columnSearch.press("Enter") with a direct click on the cmdk
item by data-value, which calls onSelect synchronously.

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

* fix: secure-context-safe UUID generation in filter & dashboard

CI runs Playwright against http://<IP>:3000 (NOT localhost), which is
not a secure context per the WebCrypto spec — `crypto.randomUUID()` is
therefore undefined and calling it throws. `handleApply` in
filter-button.tsx threw inside the React event handler before
`onAddFilter` ran, so the filter never landed: no badge, popover stuck
open, every `runs.list` query fired with all filter params NULL.

Add `lib/uuid.ts` with a Math.random()-based v4 fallback for non-secure
contexts (test-only — these IDs are local React keys, not crypto
material). Route both call sites through it.

Also fix the tag-filter E2E: for `dataType: "multiOption"` with seeded
options (`needle-tag`), FilterValueInput renders a cmdk option list,
not a text input. Click the option by data-value instead of filling
`Enter value...`.

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

* fix: reopen 'Other matches' dropdown on click into already-focused input

Esc dismisses the dropdown but keeps the input focused, so clicking
back into it didn't fire onFocus and the dropdown stayed closed
(click-outside dismissals worked because the outside click blurred the
input first). Listen to onMouseDown in addition to onFocus — fires on
every click regardless of prior focus state, idempotent with onFocus.

Tests:
- E2E test 7 now uses `searchInput.click()` (real user action) instead
  of `searchInput.focus()` (a no-op when already focused).
- Renamed test 5 to assert the dropdown CLOSES when the only
  out-of-view match is clicked (it now has nothing to show), and that
  the input value is preserved.
- New test 5b: with a multi-match query, clicking one row leaves
  others out-of-view and the dropdown stays open.

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

* chore: remove internal planning docs from PR

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

* fix: guard invalid dates + title attr on truncated run names

Addresses Gemini review feedback on the "Other matches" dropdown:

- formatCreatedAt: an invalid date string produces an Invalid Date
  object rather than throwing, so toLocaleString rendered the literal
  "Invalid Date". Guard with isNaN(d.getTime()) and return "" instead.
- Truncated run names now carry a title attribute so the full name is
  visible on hover.

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

---------

Co-authored-by: Ubuntu <azureuser@ryan-dev-azure-ebd1-27ae-0.hws5gqy4aacuhplmnpd3zr4cxb.bx.internal.cloudapp.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: ryan <ryan@trainy.ai>
public-repo-publish Bot pushed a commit that referenced this pull request Jun 6, 2026
* docs: media loading perf audit (images + videos)

Trace-driven findings on the project comparison page: presigned-URL
signature churn from getS3Url causes the browser HTTP cache to miss on
every refetch and carousel click, costing ~4 MB per click and ~1.3 MB
per minute of idle from the 1m auto-refresh. Source PNGs are also ~17x
larger in area than displayed, and <img>/<video> tags are missing
lazy/decoding/preload/poster attributes.

Doc proposes four fixes ordered by ROI, starting with a server-side
memo on getS3Url (highest impact, smallest change, helps images and
videos, fully compatible with S3 / R2 / MinIO).

No code changes in this PR; implementation handed off to another
machine.

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

* perf: cache presigned S3 URLs + lazy-load media thumbnails

Implements fixes #1 and #2 from docs/2026-05-23-media-loading-perf-audit.md.

Backend: getS3Url now reads through the existing two-tier cache
(L1 LRU + optional L2 Redis) keyed on sha1(endpoint):bucket:key:expiresIn
with a 24h TTL. The underlying SigV4 URL is valid for 5 days, leaving
> 4d of headroom. Eliminates the X-Amz-Date / X-Amz-Signature churn that
defeats the browser HTTP cache on refetch / carousel-click / auto-refresh
(~4 MB redownloaded per carousel click, ~1.3 MB/min idle).

Frontend: thumbnail <img> in image-card.tsx and the GIF fallback in
group/video.tsx get loading="lazy", decoding="async", width/height=256.
Below-the-fold panels now defer until scrolled into view; decode happens
off the main thread.

Out of scope (per the audit doc's ROI ordering):
- Fix #3 (video preload=none) — needs poster (fix #4).
- Fix #4 (server-side thumbnails) — large Rust ingest lift.
- Fix #5 (fetchpriority polish).

Verification:
- New unit test (server/tests/s3-url-memo.test.ts) asserts repeated calls
  return the same URL and the presigner is called once across 20 sequential
  reads. Watched test fail before the memo and pass after.
- Type checks: 0 errors in both @mlop/app and @mlop/server.
- Existing cache.test.ts (21 tests) still passes.
- Frontend Network-tab verification recipe from the doc not executed —
  needs a deployed app. The HTML attribute additions are layout-neutral.

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

* review: address gemini + bugbot feedback on PR #481

Gemini:
- Use the existing buildCacheKey utility (mlop: prefix, sorted params)
  instead of manual string concatenation. Matches the convention used by
  withCache / withBatchCache.
- SHA-1 → SHA-256 for the endpoint hash. The hash is not security-
  sensitive (it's a key-compaction hash, never re-hashed for auth), but
  SHA-256 sidesteps security-scanner noise at zero perf cost.

Bugbot:
- Hoist setCached out of the try block that wraps the presigner. If
  setCached rejects (e.g. transient getRedisClient failure inside the
  cache layer), the already-valid URL is no longer discarded and the
  catch above no longer misattributes the failure as "Failed to generate
  R2 image URL". Cache write is now fire-and-forget with a console.warn,
  mirroring the pattern setCached itself uses for Redis writes.

New regression test exercises the bugbot scenario directly:
mockResolvedValueOnce(null) for the getCached read path, then
mockRejectedValueOnce for the setCached write path. Verified red-green:
with the fix reverted the test fails with the exact misleading error
bugbot called out ("Failed to generate R2 image URL" despite the URL
having been generated); with the fix in place it passes.

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

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Ubuntu <azureuser@andrewDev.iqigxx5hkb2uxpbdcmttsvsjcc.cx.internal.cloudapp.net>
Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 2.1.9 to 4.1.0.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.0/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-version: 4.1.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot force-pushed the dependabot/npm_and_yarn/web/vitest-4.1.0 branch from 85ae00f to c4e4e4c Compare June 6, 2026 00:08
@dependabot @github

dependabot Bot commented on behalf of github Jun 8, 2026

Copy link
Copy Markdown
Author

Superseded by #9.

@dependabot dependabot Bot closed this Jun 8, 2026
@dependabot dependabot Bot deleted the dependabot/npm_and_yarn/web/vitest-4.1.0 branch June 8, 2026 22:31
public-repo-publish Bot pushed a commit that referenced this pull request Jul 7, 2026
…ate, bulk-prune checkbox (#511)

* feat(runs): single live indicator instead of per-row status dots

Per-row colored status dots (green/red/blue) in the run lists are
cognitive overload once there are more than a handful of runs, and a
run's final state is already legible from its text status badge. Keep a
single pulsing "live" glyph that only appears on actively-running runs.

- Add shared RunningIndicator (pulsing dot) under components/core/runs
- Sidebar "Latest Runs": render the indicator only for RUNNING; finished
  runs get an empty, aligned slot rather than a colored dot
- Dashboard "Recent Runs" widget: same treatment (it already shows a
  text status badge for final state)
- Unit tests for RunningIndicator and StatusIndicator

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013oJfZPLPzRBcFURWLTjNFP

* feat(runs): duration column + sortable / filterable run state

Adds the "spot the OOM that died in 90s vs the run that finished cleanly
after 30h" affordances to the experiments table:

- New Duration column (default-visible) showing elapsed wall-clock per
  run. End = terminal status change for finished runs (falls back to
  updatedAt), "now" for a live run. Shares formatDuration() with the
  dashboard Recent Runs widget.
- Status is now sortable, and Duration sorts server-side too: list-runs
  gains a `status` (enum→text) and `duration`
  (COALESCE(statusUpdated, updatedAt) − createdAt) keyset sort key, kept
  in lockstep across the cursor lookup / keyset WHERE / ORDER BY so
  pagination stays stable.
- The Status column header gains an inline "filter by state" menu (the
  prune enabler) that writes through the same RunFilter state as the
  toolbar filter, so the two stay in sync.
- Bumps the saved-columns storage version so Duration shows by default.

Tests: formatDuration, the duration column value/formatting (incl. the
90s statusUpdated case), and StatusColumnHeader sort/filter toggling.
The server-side sort SQL is type-checked here and exercised by CI smoke
tests (running them locally needs a live Postgres/ClickHouse).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013oJfZPLPzRBcFURWLTjNFP

* fix(runs): deterministic duration (display == server sort) + review nits

Addresses automated review feedback on the Duration column / state filter:

- Duration is now computed identically on client and server, with no
  Date.now(): end = updatedAt for a live run, else statusUpdated (falling
  back to updatedAt). This removes the running-run display/sort mismatch
  and the client clock-skew, and keeps keyset pagination stable. The
  server wraps the epoch diff in GREATEST(0, …) to match the client's
  Math.max(0, …).
- Dashboard "Recent Runs" duration ends finished runs at statusUpdated
  too, so it agrees with the experiments-table column.
- Status header filter options use the accessible DropdownMenuCheckboxItem
  (built-in role/aria-checked) instead of a hand-rolled checkbox.
- Status filter id uses generateUuid() (safe in non-secure contexts).

Tests: duration is asserted deterministic — a running run equals its
updatedAt-based value and is stable across calls.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013oJfZPLPzRBcFURWLTjNFP

* feat(runs): dedicated checkbox column for bulk selection + delete

Adds a W&B-style per-row checkbox as the first column, decoupled from the
eye/chart selection: checking a run marks it for bulk operations without
adding it to charts (and vice-versa). Bulk delete now targets the checked
set rather than the charted set, so you can prune runs you aren't plotting.

- New useCheckedRuns hook owns the (in-memory) checked set; setChecked
  handles single toggles, shift-click ranges, and header select-all.
- New "check" base column: the header is a tri-state select-all/none for
  the current page; cells support shift-click range selection mirroring
  the anchor row's state (same behaviour as the eye column).
- Bulk delete (DeleteRunsButton) is fed the checked set; after a delete
  the checked set is cleared and the deleted runs are also dropped from
  the chart selection.

Unit-tested: useCheckedRuns state transitions + referential stability, and
the column-order registration. The checkbox UX (shift-click ranges,
select-all, delete dialog) still needs e2e / manual verification in a live
environment.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013oJfZPLPzRBcFURWLTjNFP

* test(runs): lock client/server duration parity (review #1/#4/#6)

Add focused tests asserting the Duration column display and the server-side
duration sort use the SAME deterministic formula:
  end = RUNNING ? updatedAt : (statusUpdated ?? updatedAt), clamped to >= 0.

- app: clamp-to-0 case (end before start) mirrors server GREATEST(0, …).
- server smoke 20.10: sort by duration and assert the SQL order is monotonic
  per a JS replication of the client formula (and every value >= 0).

The underlying review nits (deterministic duration without Date.now(),
GREATEST/Math.max(0,…), dashboard run-row ending finished runs at
statusUpdated ?? updatedAt, generateUuid() secure-context helper, and
DropdownMenuCheckboxItem in the status header) were already resolved on the
branch; these tests lock that behavior in.

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

* fix(runs): disambiguate bulk-checkbox aria-label from chart-select button

The new bulk-selection checkbox column reused aria-label "Select run"
(and "Deselect run" when checked) — the exact strings the existing
chart-select eye button already uses. Because the checkbox is registered
as an earlier column than the eye toggle, any locator targeting
button[aria-label="Select run"] (notably the shared E2E helper
selectSpecificRuns) matched the checkbox first and toggled bulk-selection
instead of chart-selection. Runs were never added to the chart set, so
?runs= was never set, cascading into ~20 chart/dashboard E2E failures per
shard plus the perf job (charts never rendered).

Rename the checkbox to "Check/Uncheck run for bulk actions" so the eye
button is the sole owner of "Select run"/"Deselect run". Tests that want
the bulk checkbox already target data-testid=run-checkbox. Also a genuine
a11y fix: two controls in one row no longer announce the same label.

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

* feat(runs): duration uses ClickHouse heartbeat for running runs

A live run's Duration ended at PG updatedAt, which steady-state metric
logging never advances (metrics write ClickHouse, not PG; the SDK trigger
poll is read-only) — so running-run duration under-reported. Use the run's
heartbeat (MAX(time) over mlop_metrics, the same signal the stale monitor
and wandb heartbeat_at use) as the end for RUNNING runs; terminal runs keep
statusUpdated ?? updatedAt.

- Client (columns-utils): end = RUNNING ? (heartbeatAt ?? updatedAt) : ...
- Backend: enrich every runs.list return path with heartbeatAt for running
  runs (bounded ClickHouse MAX(time), skipped when none) via finalizeRuns.
- Backend: heartbeat-aware duration SORT (durationSortQuery) as a candidate-
  set sort so display == sort, with a fast path back to the pure-PG keyset
  systemColumnSortQuery when the filtered set has no running runs.
- No materialized heartbeatAt column (kept derived-on-demand) — see the ADR
  comment in list-runs.ts for the rationale.

Tests: client unit (heartbeat / fallback / terminal-ignores-heartbeat);
smoke 20.10 parity now heartbeat-aware; smoke 20.11 asserts the enrichment.

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

* feat(runs): unify selection — checkbox selects/plots, eye is visibility-only

Collapse the two separate row controls into one model:
- The checkbox is now the sole SELECTION control: checking a run plots it on
  the charts (?runs=) AND marks it as the bulk-action (delete) target;
  unchecking removes it. It reuses the existing chart-selection set, capped at
  SELECTED_RUNS_LIMIT, with shift-click range + select-all. Hover tooltip
  'Select run' / 'Deselect run' (which also keeps the E2E selectSpecificRuns
  helper resolving to the right control).
- The eye is now a pure VISIBILITY toggle (show/hide on charts) that renders
  only for selected runs; the separate X deselect button is removed (unchecking
  the checkbox deselects).
- Retire useCheckedRuns; the checkbox drives the chart-selection set directly,
  and bulk delete targets the selected set. Removes the decoupled 'checked'
  scratchpad and its hook/test.

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Ubuntu <azureuser@andrewDev.iqigxx5hkb2uxpbdcmttsvsjcc.cx.internal.cloudapp.net>
public-repo-publish Bot pushed a commit that referenced this pull request Jul 8, 2026
…th clean DOS/PSTT/filter/sorting logic (#524)

* [backend] register distinctGroups tRPC proc

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

* [backend] include group in run listing select blocks

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

* [backend] add Test Suite 36 (Groups Management) to smoke tests

Mirrors Test Suite 7 (Tags) for the new group field + /group/update
HTTP route. Suite number bumped to 36 (max+1) because "12" already
collides with Test Suite 12: Server-Side Search.

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

* [backend] add groups input type to runs.list

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

* [backend] add buildGroupFilter helper to list-runs Prisma path

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

* [backend] add raw-SQL groups filter to list-runs builders

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

* [backend] add groups filter to runs.count proc

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

* [ralph] correct P3.7 to reference Test Suite 36 (Groups), not 12

The loop renamed the suite during P2.8 (Suite 12 was already Server-Side
Search). P3.7's literal reference would confuse a fresh Claude session
that has no memory of the rename.

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

* [backend] document missing cache invalidation API in update-group

No per-key invalidation helper exists in lib/cache.ts — only clearL1Cache.
Per specs/groups/03-list-filter.md §4 fallback, rely on the 30s
GROUPS_CACHE_TTL in distinct-groups.ts and document the limitation at
the top of update-group.ts. Followup logged in fix_plan.md.

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

* [backend] document missing cache invalidation API in HTTP /group/update

Mirror the rationale comment from the tRPC update-group proc to the HTTP
handler so both surfaces document the same 30s-TTL fallback. No per-key
invalidation API exists in web/server/lib/cache.ts.

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

* [backend] add read-side smoke tests 36.6-36.9 for runs.group filter

Seeds runs via the HTTP create endpoint and reads them back with a direct
Prisma query mirroring buildGroupFilter (list-runs.ts) and the distinct-
groups.ts raw SQL. The smoke harness has no session-cookie auth so the
protectedOrgProcedure tRPC procs can't be hit directly; per spec §5
fallback we use the "HTTP create + Prisma read" path. Follow-up tracked
in fix_plan.md to upgrade these to true tRPC coverage when the harness
gains session auth.

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

* [ralph] scaffold Phase 4 (frontend, Scope A) for Run Groups

Adds specs/groups/04-frontend.md, appends P4.1-P4.9 to fix_plan.md,
wires the new spec into PROMPT.md stack allocation, and adds the
phase-4 file allowlist to AGENT.md. Old Phase 3 follow-ups are
marked [DEFERRED] so the loop skips them (they require infra outside
any phase allowlist).

Scope A: group column in runs table + edit popover, Group card on run
overview page, "Group by group" toolbar toggle with TanStack grouping.
No generic group-by-any-field dropdown — that's Scope B (separate phase).

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

* [ralph] verify P4.1 — FE Run/get-run types already include group

Inferred end-to-end via tRPC (list-runs proc has group:true in selects;
get-run uses default Prisma select). @mlop/app check-types passes — no
explicit FE type declarations needed.

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

* [frontend] P4.2 — add useDistinctGroups FE query

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

* [frontend] P4.3 — add useUpdateGroup FE mutation hooks

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

* [frontend] P4.4 — add GroupEditorPopover component

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

* [frontend] P4.5 — add GroupCell table renderer

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

* [frontend] P4.6 — wire GroupCell column + plumb getAllGroups/onGroupUpdate

Adds a `col.source === "system" && col.id === "group"` block to columns.tsx
adjacent to the tags block, rendering GroupCell with sortable single-string
semantics (mirrors the notes block pattern). Plumbs `allGroups` +
`onGroupUpdate` from index.tsx through data-table.tsx using the
useDistinctGroups query and useUpdateGroup mutation. Group column will
not yet appear in the column picker — registering it in
use-column-config.ts is tracked as a follow-up (file outside Phase 4
allowlist).

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

* [frontend] P4.7 — add Group card to run summary page

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

* [frontend] P4.8 — add Group-by toolbar toggle + localStorage state

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

* [frontend] P4.9 — wire TanStack grouping for Group-by toggle

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

* [ralph] scaffold Phase 5 (W&B-parity UX) for Run Groups

Phase 5 reshapes the interaction model to match W&B exactly:
- Per-row "⋯" menu (View run logs / Move to another group / Delete run)
- Single-select GroupPickerPopover modeled on PR #477's tag picker
- Group column registered as default-but-hidden (EXTRA_SYSTEM_COLUMNS,
  no STORAGE_VERSION bump)
- Strip phase-4 inline-pencil edits from group cell + run summary card
- Single-run delete reuses bulk useDeleteRuns([runId]) with mirrored
  type-to-confirm Dialog from delete-runs-button.tsx
- Old GroupEditorPopover deleted

Defaults locked: Group card on summary page = plain read-only (not link);
"⋯" placement = hover-revealed icon at row end. No backend changes.

The Phase 4 follow-up about registering the column (was [BLOCKED]) is
superseded by P5.1 in this phase's widened allowlist.

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

* [frontend] P5.1 — register Group in EXTRA_SYSTEM_COLUMNS (opt-in)

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

* [frontend] P5.2 — strip inline edit from group-cell, drop popover

Pencil-on-hover and the GroupEditorPopover mount are gone. The cell is
now pure display: a Badge for a set group or a muted "—" when null.
GroupCellProps shrinks to { group: string | null }; columns.tsx stops
passing allGroups/onGroupUpdate at the call site (excess-property check
would otherwise fail). The surrounding columns plumbing keeps
getAllGroups and onGroupUpdate intact for the row-actions menu coming
in P5.6–P5.8.

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

* [frontend] P5.3 — strip edit-on-hover from run-summary Group card

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

* [frontend] P5.4 — delete obsolete group-editor-popover

After P5.2 (group-cell stripped) and P5.3 (summary card stripped), no
application code imports GroupEditorPopover. Removing the file.

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

* [frontend] P5.5 — add group-picker-popover (single-select)

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

* [frontend] P5.6 — add run-row-actions-menu (⋯ menu)

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

* [frontend] P5.7 — append row-actions pseudo-column to runs-table

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

* [frontend] P5.8 — verify row-actions wiring satisfies spec

All callback plumbing for RunRowActionsMenu was already completed by
upstream phases (P4.6, P5.6, P5.7). This commit marks P5.8 done after
confirming no orphan props remain and check-types passes.

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

* [frontend] relocate row ⋯ menu into Name cell + restore pencil in Group cell

User feedback: the ⋯ row-actions menu belongs inside the Name column
(hover-revealed next to the run name), not in a separate end-of-row column
that pushes the actions off-screen. The Group column should mirror Tags —
a pencil-on-hover scoped to group editing only — not carry the broader
row actions.

- GroupCell: read-only badge + pencil-on-hover that opens
  GroupPickerPopover (single-select).
- Name cell: RunRowActionsMenu now mounted as a sibling of the run-name
  Link, hover-revealed via group-hover/row, stopPropagation on click so
  it doesn't trigger the link.
- Drop the end-of-row row-actions pseudo-column entirely.
- Wire onRunDeleted from index.tsx → DataTable (deselect the run on
  successful delete; the useDeleteRuns mutation's onMutate handles cache
  removal optimistically).

check-types clean both workspaces.

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

* [frontend] fix group pencil styling + dropdown→popover open race

Two user-reported issues:

1. Clicking "Move to another group" in the ⋯ menu opened the picker
   for a single frame, then it closed. Cause: Radix DropdownMenu's
   close-then-focus-restore fires in the same tick as our synchronous
   setPickerOpen(true), and the popover's outside-click detection
   reads the focus restoration as a click outside. Fix: setTimeout(0)
   defers the open to the next tick so the dropdown is fully unmounted
   first. Same fix applied to the Delete confirm dialog for the same
   reason.

2. Group cell pencil was hover-revealed and a different size from the
   Tags/Notes pencils. Rewritten to match those cells verbatim:
   variant=ghost size=icon h-6 w-6 shrink-0, Pencil h-3 w-3,
   title="Edit group", always visible. Pencil is now pushed to the far
   right via flex-1 spacer (same pattern as notes-cell).

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

* [frontend] prevent dropdown focus-restoration from closing the picker

The setTimeout(0) defer from the previous commit was not enough — the
GroupPickerPopover still closed within ~400ms of opening. Verified the
race with Playwright: picker opens at T=100ms, gone by T=500ms.

Root cause: when DropdownMenu closes, Radix restores focus to the
trigger button. This focus restoration dispatches a synthetic pointer
event that the just-opened Popover treats as an interaction outside,
firing its onOpenChange(false).

Fix: onCloseAutoFocus={(e) => e.preventDefault()} on DropdownMenuContent
suppresses Radix's focus restoration. Verified end-to-end with Playwright
that the picker now stays open and renders "Search or add group...",
"No groups found.", "Current group: (none)" stably.

The Delete confirm Dialog uses a portaled overlay (not anchored), so it
was unaffected by this same race — the existing setTimeout(0) is
sufficient for that path.

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

* [frontend][backend] group picker UX polish + cache freshness

Verified end-to-end via Playwright. Four fixes addressing user feedback:

1. useUpdateGroup now invalidates the distinctGroups React Query in
   onSettled (was only invalidating runs queries). Without this, the
   `allGroups` list staying stale meant a freshly-created group showed
   "No groups found." on the next picker open.

2. Dropped the 30s server-side L1/L2 cache from distinct-groups.ts.
   Even with FE invalidation the server would have served the stale
   list for up to 30s. The underlying query is a single COUNT GROUP BY
   on an indexed column, so caching adds little. Caching can come back
   when web/server/lib/cache.ts grows a per-key invalidator (tracked
   already as a Phase 3 follow-up).

3. group-picker-popover hides the "Current group:" footer entirely
   when currentGroup is null (matches the tag picker empty state). No
   more "Current group: (none)" line for runs that have no group.

4. group-cell renders the badge OR nothing — dropped the "—"
   placeholder. Matches the Tags column convention (blank when empty).

Playwright run confirmed: 'a' appears in row-2 picker after creation
on row-1, no footer when empty, no "—" in empty cells.

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

* [frontend] group cell pencil layout + collapse/expand fix

Two user-reported bugs, verified with Playwright.

1) Pencil clipped on long group names. The badge was max-w-[180px] with
   the parent flex having overflow-hidden; when the column was just wide
   enough for the badge to hit its max, the pencil was pushed past the
   overflow boundary and clipped (z-index was not the issue — overflow
   was). Fix: badge is now min-w-0 flex-1 (shrinks to fit available
   space, truncates internally), dropped the spacer, dropped the
   overflow-hidden from the parent. Pencil sibling stays shrink-0 and
   is always visible.

2) Collapse/expand chevron did nothing. The expanded state was a
   hardcoded `const expanded: ExpandedState = true` — TanStack's
   getToggleExpandedHandler called the internal setExpanded but the
   table had no onExpandedChange so the toggle silently no-op'd.
   Switched to uncontrolled expanded state via `initialState.expanded:
   true` (TanStack v8 quirk: state.expanded === true is honored only
   after the first user toggle, so passing it as controlled state
   renders the table collapsed on mount — not what we want). Now all
   groups default-expanded and the chevron toggles each group's state
   via TanStack's internal store.

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

* [frontend] fix client-side sort for system columns (createdAt etc.)

User reported Created desc sort showing rows in ascending order. Root
cause was a pre-existing tableId-mismatch bug in sortRunsByColumn.

columns.tsx builds dynamic column ids as `custom-${source}-${id}`:
  source=system   → custom-system-createdAt
  source=systemMetadata → custom-systemMetadata-hostname
  source=config   → custom-config-lr

But sortRunsByColumn's lookup was:
  source=system   → custom-systemMetadata-${id}   ← WRONG
  source=systemMetadata, config → custom-${source}-${id}  (correct)

So for any sort on a registry system column (createdAt, updatedAt,
statusUpdated, notes), the function couldn't resolve the column and
returned the input unsorted. That's invisible when the input is
already server-sorted, but breaks visibly when pinned-selected runs
are mixed in: their out-of-page tail arrives in insertion order and
the no-op client sort lets it through to the user.

Fix: replicate columns.tsx's tableId formula exactly. Also updated the
two sort-pinned-runs tests that were validating the buggy format
(`custom-systemMetadata-createdAt` for a source=system column) to use
the correct format. All 850 unit tests pass; Playwright run with
group-by ON + selection ON confirms desc order is now correct.

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

* [frontend] fix sortRunsByColumn for Date-typed createdAt values

Page 1 → page 4 → page 1 navigation surfaced May 18 (Mon) runs above
May 14 (Thu) runs despite an ASC sort. Root cause was String() on Date
objects in this branch's commit ad62d2d53: superjson deserializes
createdAt/updatedAt to Date instances in some React Query cache states,
and String(Date) is "Thu May 14 2026 ..." which lex-sorts by day-of-week
letter — 'M'on < 'T'hu, so May 18 ends up before May 14.

Before that commit sortRunsByColumn was a no-op for system columns (a
separate tableId-mismatch bug), so the buggy comparison never ran and
the server-side ORDER BY was passed through unchanged. Once the no-op
was removed, the date-stringification surfaced as wrong ordering after
pages got refetched.

Fix: normalize Date instances to ISO strings (which ARE lex-sortable in
chronological order, and match the server-side string format) before
comparing. Existing 28 sort unit tests still pass.

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

* [frontend][backend] sort by Group + save groupBy/expanded in preset

- backend: add `group` to SYSTEM_SORT_FIELDS so runs.list accepts
  sortField="group" (NULLS LAST, double-quoted reserved word).
- columns-utils: client-side getCustomColumnValue handles "group" so
  in-memory sort of selected/pinned runs matches server order.
- index.tsx: controlled ExpandedState persisted to localStorage; pass
  expanded + setExpanded down to DataTable and into the RunTableView
  config. handleLoadView applies config.groupBy and config.expanded
  (defaults preserve old views without these fields).
- data-table + use-data-table-state: thread expanded/onExpandedChange
  through, replacing the prior `initialState: { expanded: true }`
  uncontrolled approach.
- run-table-view-selector: getCurrentConfig now includes groupBy and
  expanded; props accept currentGroupBy / currentExpanded.

* [backend][frontend] persist groupBy/expanded in RunTableView config

- backend: add groupBy and expanded to RunTableViewConfigSchema so Zod
  stops stripping them on create/update. groupBy is `"group" | null`;
  expanded matches TanStack's ExpandedState (`true | Record<...>`).
- frontend: hasUnsavedChanges normalization now backfills missing
  groupBy (null) and expanded (true) on legacy snapshots, matching
  how pageSize was already handled — otherwise the "unsaved" dot
  appeared on every page load against pre-existing views.

* [testing] unit + smoke + e2e coverage for run-groups feature

Covers the runs-table grouping work shipped in this branch:
  - per-row Group cell + GroupPickerPopover
  - ⋯ menu → "Move to another group"
  - sort-by-group on the runs.list endpoint
  - toolbar Group-by toggle + per-group collapse/expand
  - groupBy + expanded fields round-tripping through RunTableView config

Source touches are selector-only — three new data-testids on the
existing UI (`group-by-toggle`, `group-row-chevron`,
`distinct-group-option`) plus the data-group-value/data-group-expanded
attributes on the grouped <tr>. No behavior changes.

Seed: new step 5h in setup.ts seeds a `run-groups-test` project with 5
runs across 3 named groups + 1 null (alpha ×2, beta, gamma, plus
rg-solo). Lives in its own project so mutating e2e tests can't pollute
smoke-test-project.

Smoke (server/tests/smoke.test.ts):
  - 20.10 sort by `group` ASC → NULLS LAST
  - 20.11 sort by `group` DESC → NULLS LAST
  - 19.13 round-trip groupBy + expanded through runTableViews.create/get
  - 19.14 update view to groupBy: null / expanded: true sentinels
  - 19.15 legacy view config without the new fields still loads

Unit:
  - server/tests/run-table-view-types.test.ts — 6 tests over
    RunTableViewConfigSchema (legacy, new, bogus shapes)
  - app/.../runs-table/__tests__/columns-utils.test.ts — append
    `getCustomColumnValue` for the system `group` column (returns
    run.group ?? null, NOT "-")

E2E (web/e2e/specs/runs/run-groups.spec.ts, 8 tests, serial):
  #1 Group cells render seeded values, dropdown lists distinct groups
  #2 Pencil: assign existing → create new → clear (state restored)
  #3 ⋯ → "Move to another group" doesn't flash-close the picker
  #4 Sort by Group ASC + DESC honors NULLS LAST in both directions
  #5 Group-by toggle pins Group leftmost + renders grouped rows
  #6 Collapsing a group persists across reload (localStorage path)
  #7 Saved view restores groupBy AND collapsed group state
  #8 Removing the Group column while in group view exits group view

Each mutating e2e test restores run.group via tRPC in a finally block
so subsequent tests see the seeded shape.

* [frontend][bugfix] preserve Group column on post-refresh group-view exit + stop picker click bubbling

Two fixes flagged by bot review on PR #483:

1. exitGroupView lost the Group column entirely when no snapshot was
   available — the case after a page refresh where groupBy="group" is
   restored from localStorage but enterGroupView never fired this
   session. The old `else { updateColumns(rest) }` branch stripped the
   column, forcing users to re-add it from the picker. Now we leave the
   Group column at its current index with `isPinned: false`, so toggling
   group view off just unpins it.

2. GroupPickerPopover's PopoverContent now stops click event propagation.
   Mirrors what notes-cell.tsx already does on its popover. The picker
   renders inside table cells (GroupCell + RunRowActionsMenu) and React
   synthetic events bubble up through the React tree even though Radix
   portals the DOM — without this, a click target listening on an
   ancestor row would fire on every option select.

* [testing] run-groups e2e: drop serial mode, idempotent column add, broader localStorage reset

Three fixes to the run-groups spec:

1. Remove `test.describe.configure({ mode: "serial" })`. Serial mode
   skipped tests #3–#8 when #2 failed, hiding what would have been
   independent failures. Each test is already self-contained — restores
   its own mutations in finally, beforeEach wipes view + localStorage
   state — so they can run in any order without cascading.

2. Replace `toggleColumn(page, "Group")` with `ensureColumnVisible`,
   an idempotent helper that only adds the column if not present in
   `<thead>`. `toggleColumn` is XOR: after a reload inside a test,
   localStorage still has the column visible, so re-toggling REMOVED
   it (then assertions on the cell failed). #2 was exactly this.

3. beforeEach now clears `mlop:columns:*`, `mlop:col-base-overrides:*`,
   and `run-table-*` localStorage keys in addition to the group-by /
   expanded keys, and reloads after cleanup so the frontend renders
   the clean state. Prevents column-config leak across tests now that
   they aren't serial.

* [testing] run-groups e2e: per-test projects for parallel-safe state isolation

Playwright config is fullyParallel: true with 4 CI workers, so tests in
this file race against the same backend. Following the codebase pattern
(custom-dashboard.spec.ts etc. use Date.now()-suffixed names per test),
each test that mutates backend state owns its own project. Read-only
tests share the canonical project.

setup.ts now seeds 6 run-groups projects (canonical + 4 mutation + 1
view-save), each with the same 5-run shape. Spec dispatches by test:
  #1, #4, #5, #6, #8 → canonical (read-only)
  #2a, #2b, #2c, #3  → per-test mutation projects
  #7                 → per-test view-save project

#2 was split into #2a/#2b/#2c (one mutation per test); #5/#6 assertions
fixed (4 group buckets incl. null bucket from rg-solo).

* [frontend][testing] reset-to-default also clears grouping + tighten e2e waits

handleResetToDefault now clears groupBy and expanded alongside the
columns/filters/sorting/pageSize reset. DEFAULT_COLUMNS doesn't include
the Group column, so without this, picking "Default" while in group view
would leave a dangling groupBy=group pointing at a column that no longer
renders.

The empty positioning span in RunRowActionsMenu drops its aria-hidden
attribute. The span is decorative (no content, no children) so screen
readers ignore it either way; aria-hidden was making it match
tags-column-width.spec.ts's `table tbody [aria-hidden="true"]` selector,
which is meant to find the Tags column's measurement row.

E2E:
- #6: after the reload, don't call waitForSeededTable (which loops over
  every run name) — alpha is correctly collapsed, so rg-alpha-1/2 are
  hidden. Wait for <thead> instead, then assert collapse state.
- #7: rewritten without a reload. Save preset → switch to Default →
  assert group view off + all rows visible → switch back to preset →
  assert group view on + alpha collapsed.

* [testing] run-groups e2e: reset target run.group on every mutation test

Playwright CI runs with retries: 2. A mutation test that succeeded at
writing `delta` to rg-gamma and then failed on a later step would leave
that mutation in place for its retry — and the retry would find that
"delta" already exists in distinctGroups, so the "Add new group" button
never renders.

setupProject() now accepts an optional `resets` map and force-writes the
target run.group values via `runs.updateGroup` before the final reload.
Each mutation test passes its own resets:
  #2a  → rg-solo: null
  #2b  → rg-gamma: gamma  (also drops any stale "delta")
  #2c  → rg-alpha-1: alpha
  #3   → rg-beta: beta

Read-only tests (#1, #4, #5, #6, #7, #8) don't need resets — they share
the canonical project but never write to it.

* [frontend][bugfix] exitGroupView drops Group column when it wasn't present before

The previous snapshot-vs-no-snapshot branching collapsed two cases that
should behave differently:

  snap = { entry: null, index: -1 } means the snapshot was captured AND
  the Group column was absent before enterGroupView added it. The correct
  thing on exit is to drop the column (restore "wasn't there" state).

  snap = null means enterGroupView never fired this session (page reload
  with groupBy=group from localStorage, or a loaded saved view). We don't
  know the prior layout, so unpin Group in place rather than silently
  strip a column that may be intentional in the user's saved config.

The old `if (snap?.entry)` mapped null entry into the same branch as
"no snapshot at all" → the column stuck around after a toggle on/off
from a default column layout that didn't include Group.

* [frontend][quality] move localStorage write out of setState updater; tighten reconciliation effect; lift useDeleteRuns to data-table

Three quality fixes flagged in bot review:

- `expanded` is now persisted via a `useEffect`, not inside the state
  updater function. State updaters must be pure — React Strict Mode and
  concurrent rendering can invoke them multiple times, so any side effect
  inside risks double writes.

- The group-column reconciliation `useEffect` no longer lists
  `customColumns` as a dep. It writes back to `customColumns`, so the
  dep was causing the effect to refire whenever any unrelated column
  edit happened while in group view. The effect now reacts only to
  `groupBy` transitions and reads the latest columns via a ref.

- `useDeleteRuns` is lifted from `RunRowActionsMenu` (one instance per
  visible row) to `data-table.tsx` (single instance for the table).
  The menu receives an `onDelete` callback and tracks its own per-row
  pending state with a local `useState`. Matches how `onTagsUpdate`,
  `onGroupUpdate`, etc. already flow.

* [frontend] lock Group column position while in group view

The Group column must stay at index 0 and pinned while group view is
on — otherwise the grouping state and the column state can disagree
(e.g. user unpins Group and the sticky/dark-bg styling drops out, or
drags Group to index 5 and the visual layout no longer matches the
"grouped by Group" intent).

  - Header menu no longer renders the Pin/Unpin entry for Group while
    `groupBy === "group"`.
  - The TH render skips the drag handle and the grab cursor for Group
    while group view is on.
  - `handleToggleColumnPin` and `handleReorderColumns` in index.tsx are
    no-ops for the Group column while group view is on — defense
    against any programmatic / saved-view path that bypasses the UI.

* [frontend][ux] picker: clicking the currently-selected group deselects it

The X chip in the picker footer was the only path to "no group" from
the picker, which was easy to miss — most users tried clicking the
checked row first and got a no-op close.

Match common picker UX: clicking the row whose checkmark is showing
toggles the run back to no group, same as the chip.

* [frontend][backend][cleanup] sticky/full-row group headers + drop dead code + SQL dedup

UX:
- The grouped-row bar is now clickable across its full width (not just
  the chevron + label). Cursor changes to pointer.
- The "Group: foo (N runs)" label is `position: sticky; left: 0` so it
  stays visible at the left edge when the table is scrolled
  horizontally — previously the label scrolled off-screen.
- Keyboard: Space/Enter on the grouped row toggles expand/collapse.

Cleanup:
- Delete the dead `(run)/.../~queries/update-group.ts` — not imported
  anywhere; the run-detail Group card is read-only.
- Drop the `ralph/` and `specs/groups/` scaffolding. The autonomous
  loop driver and phase docs were dev-only; nothing in production or
  CI references them.
- Strip the stale `specs/groups/03-list-filter.md` / `GROUPS_CACHE_TTL`
  comments from update-group.ts, runs-openapi.ts, smoke.test.ts, and
  use-data-table-state.ts. The "30s TTL" they referenced doesn't exist;
  the real "uncached for freshness" decision is documented in
  distinct-groups.ts.

SQL dedup (no behavior change):
- Extract `buildGroupFilterSql(groups, params): string | null` and
  `export buildGroupFilter` from list-runs.ts.
- Replace the three inline raw-SQL `groups` filter blocks in
  list-runs.ts and the matching one in runs-count.ts with calls to
  the helper.
- runs-count.ts now imports `buildGroupFilter` instead of carrying its
  own copy.

* [frontend] make Group-by and Pin-selected-to-top mutually exclusive

The pinned-overlay table and TanStack's grouped row model render
selected runs in fundamentally different shapes — turning both on
produces the broken layout in #483 where pinned rows show up
ungrouped above a partial group-headers list.

Treat them as mutually exclusive view modes (W&B-style):
- Turning Group-by on auto-disables Pin-selected-to-top.
- Turning Pin-selected-to-top on auto-disables Group-by.
- One-time mount-guard normalizes the inconsistent state for users
  whose localStorage was set to both true before this PR landed.

Implementation: lifted pinSelectedToTop from useDataTableState to
index.tsx so the mutex wrappers can sit next to handleGroupByChange.
The hook now receives pinSelectedToTop + onPinSelectedToTopChange as
inputs instead of owning them.

* [backend][frontend][perf] cap distinct-groups at 500 + server-side typing search

Matches the tags-dropdown pattern (PR #477) and column/metric-name
search. Groups can scale on a per-project basis the same way tags did
— without the cap, a project with thousands of distinct groups would
drop the full list into the picker DOM the moment any user clicks a
pencil, and re-render it for every keystroke.

Backend (distinct-groups.ts):
- `LIMIT 500` (`MAX_LIMIT`), clamped server-side.
- `ORDER BY count DESC, MAX(createdAt) DESC, value ASC` — adds the
  recency tiebreaker so a newly-created group with count=1 bubbles
  ahead of dormant count=1 groups (previously a fresh group landed
  at the bottom of an alphabetical tail).
- Optional `search` param with ILIKE + escaped metacharacters.

Frontend:
- New `useGroupSearch` hook (mirror of `useTagSearch`) — 200ms
  debounce, fires only when the search term is non-empty.
- `GroupPickerPopover` accepts `organizationId` + `projectName`,
  uses server results while the user types and the loaded
  `allGroups` (already ≤500 from useDistinctGroups) otherwise.
- Backward-compat: when project context isn't provided, the picker
  falls back to a local fuzzy filter over `allGroups` only.
- Wired through `GroupCell` (from columns.tsx) and
  `RunRowActionsMenu`.
- Renders a small "Searching…" indicator while the debounced query
  is in flight.

Net effect: bounded DOM cost no matter how many groups a project
has, and groups beyond the top-500 default are still reachable by
typing their name.

* [plan] grouping v2 — wandb-style general grouping (write-up only, no code yet)

* [backend][frontend] rip out v1 group column + endpoints + UI

Pivot to wandb-style grouping. Drops:
- runs.group column + index (new drop migration, v1 add migration deleted)
- runs.updateGroup, runs.distinctGroups tRPC procs
- /api/runs/group/update OpenAPI route + create-body group field
- GroupPickerPopover, GroupCell, useGroupSearch frontend pieces
- group-by toggle in TableToolbar, group system column,
  RunTableViewConfig.{groupBy,expanded}

Backfilled existing dev data: rows with `group` get a `group:<value>` tag
before the column drops. Smoke tests around groups/sort-by-group deleted;
the new wandb-style grouping API will be smoke-tested in a follow-up.

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

* [backend] grouping v2 — backend API + group:* tag invariant

Adds the W&B-style grouping primitives on the backend:

- runs.distinctGroupValues({ field, parentFilters, search?, valueSearch?,
  limit?, offset?, ...regularFilters }) — paginated distinct values for
  one grouping field, scoped by the same filter set the table uses.
  Supports four field kinds: `system:status|name|creator.name`,
  `config:<key>`, `systemMetadata:<key>`, `tag-prefix:group`. Per-key
  dataType is loaded from ProjectColumnKey so numeric configs use
  numericValue (not textValue) for the GROUP BY.

- runs.list and runs.count accept `groupFilters: { field, value? }[]`,
  translated at the input boundary into existing systemFilters /
  fieldFilters / tags arrays. Null values drill into the "unset" bucket
  for config / systemMetadata (operator: "not exists"). Tag-prefix null
  buckets are surfaced in distinct-group-values but drill-in is deferred.

- New lib/group-tag.ts utility: GROUP_TAG_PREFIX = "group:", helpers
  `isGroupTag`, `extractGroupValue`, `dedupGroupTagsKeepLast`,
  `hasMultipleGroupTags`.

- Enforce the at-most-one `group:*` invariant at all write boundaries:
  - tRPC runs.updateTags throws BAD_REQUEST on ambiguous payloads (UI
    must resolve the conflict before submit).
  - POST /api/runs/create and POST /api/runs/tags/update silently
    dedup last-wins (SDK-derived group:* clobbers stale ones).

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

* [frontend][backend] grouping v2 — wandb-style picker UI

Adds the chip-stack picker in the runs-table toolbar:
- Group button → popover with ordered chip stack of active fields
- Each chip: field label + source badge + ▲/▼ reorder + ✕ remove
- Clicking the chip's label swaps in the field picker so users can
  replace one level without removing it
- + Add grouping field → field picker with four sections:
  System, Tag-derived, Config (recent 100), System metadata (recent 100)
- Clear button wipes the stack

State lives at the project page (run-table-groupBy:v2 localStorage
key); flows DataTable → TableToolbar → GroupByPicker. Picker is opt-in
and renders nothing in the table yet — multi-level bucket rendering
ships in the next phase, but the new endpoints already return correct
data when called from elsewhere.

Backend fix folded in: the groupFilter translator was emitting operator
"equals" for numeric fieldFilters, which buildValueCondition's number
switch doesn't accept. Switch to "is" (the canonical operator the
number switch recognises, and a synonym for "equals" in the text
switch). Verified end-to-end via runs.distinctGroupValues +
runs.list/count with `groupFilters` against live ryandevvm2 data.

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

* [backend][testing] grouping v2 — unit + smoke tests

- tests/group-tag.test.ts (13 tests): GROUP_TAG_PREFIX helpers — isGroupTag,
  extractGroupValue, dedupGroupTagsKeepLast, hasMultipleGroupTags. Includes
  the surprising case where dedupGroupTagsKeepLast preserves order of the
  surviving group:* tag at its original position.

- tests/group-field.test.ts (22 tests): parseGroupField/encodeGroupField
  round-trip + applyGroupFiltersToInput — covers all four field kinds,
  null-bucket semantics (config → not exists, system → drop, tag-prefix →
  no-op), numeric/text dataType routing, and the no-mutation guarantee.

- smoke.test.ts Test Suite 17c (8 tests): exercises runs.distinctGroupValues
  with parentFilters / valueSearch / pagination + runs.list/count with
  groupFilters against the seeded run-groups-test project. Verifies the
  unknown-field / malformed-input quiet-empty paths.

- smoke.test.ts Test Suite 17d (2 tests): runs.updateTags rejects 2 group:*
  tags but accepts exactly one.

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

* [backend][frontend] grouping v2 — persist groupBy in saved views

RunTableViewConfig gains an optional groupBy: string[] field.
- server schema: z.array(z.string()).optional() on RunTableViewConfigSchema
- frontend selector: currentGroupBy threaded through hasUnsavedChanges
  + view-load flow. Legacy views without the field normalize to [] so
  they don't show "unsaved changes" on open.
- handleLoadView / handleResetToDefault now reset groupBy alongside
  columns/filters/sorting.

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

* [frontend] grouping v2 — inline bucket tree (MVP)

Renders when groupBy is non-empty: a lazy multi-level tree of bucket
headers inside the runs-table body, replacing the flat row list.

- BucketLevel queries runs.distinctGroupValues({field, parentFilters}),
  paginated 10-at-a-time with a "Show 10 more" affordance per level.
- BucketHeaderRow shows the field source badge, label, value, count;
  click to expand/collapse. Indent grows with depth.
- Leaf buckets lazily fetch runs.list({groupFilters: trail}); each run
  renders as a single-row link with status + tag chips + relative time.
- Expand state lives in a top-level Set<string> keyed by the JSON-
  stringified bucket trail.

MVP intentionally drops per-row selection, custom-column rendering,
pinning, drag-zoom, and inline sort inside the grouped view — the user
is browsing buckets, not selecting runs. Re-adding those is the next
iteration; the backend API is already shaped to support them.

Verified end-to-end via curl against ryandevvm2 dev data:
  config:batch_size → activation nested → 506 runs in 3 buckets ✓
  tag-prefix:group bucket drill-in returns runs with correct group:* tag ✓

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

* [backend] grouping v2 — lenient parse of legacy groupBy

v1 saved RunTableViews stored `groupBy: "group" | null` (a string sentinel).
The v2 schema introduced groupBy: string[], so opening a project that had any
v1 view crashed in RunTableViewConfigSchema.parse with "expected array,
received string".

Added a preprocess transform on the groupBy field:
- null / undefined → undefined (no grouping)
- string "group" → ["tag-prefix:group"] (semantic equivalent)
- any other lone string → single-element array
- arrays pass through

Dev DB backfill (manual SQL, applied) converts the same two semantics so the
stored rows look canonical to the v2 path on write.

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

* [frontend] grouping v2 — bucket rows use the real run table

Phase 8 follow-up: drop the hand-rolled simplified run row and render
buckets through the standard <RunRow> + memoizedColumns. Each leaf bucket
now mounts its own mini useReactTable that shares:
  - the parent's column defs (visibility eye, name, tags, notes, custom
    config/metric columns — all of it)
  - columnOrder (so pinned columns stick in the same place)
  - rowSelection derived from selectedRunsWithColors (toggling the eye
    in any bucket flows into the same selection state the flat table
    uses)
  - pinnedColumnMap + tableBodyRef

Knock-on fixes:
  - tags overflow tooltip ("+2" now lists the hidden tags) — comes for
    free since TagsCell is rendered by the real column
  - dropped the redundant "tag" badge from bucket headers; the picker
    already conveys the field source, repeating it on every row was noise
  - removed the simplified status badge + TagBadge imports

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

* [frontend] grouping v2 — tighten status column

Shrink the status-indicator column from 36px to 20px and left-align the
dot. The previous right-align (justify-end pr-1) left ~50px of empty
status-column space between the visibility eye and the green status
dot, which was barely noticeable in the flat table but stood out under
bucket headers in grouping view. Status dot now sits flush against the
eye in both views.

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

* [backend][frontend] grouping v2 — persist expanded buckets in saved views

Lifts the bucket-expand `Set<string>` from inside <GroupedBucketTree> up
to the project page level, then threads it through saved views.

- RunTableViewConfig schema gains `expanded: z.array(z.string()).optional()`
  with a lenient preprocess that drops v1's `true | Record<string, boolean>`
  sentinel (no v2 translation; collapse all).
- index.tsx owns `expandedGroups: string[]`; handleLoadView restores it
  from the saved view, handleResetToDefault clears it, and
  handleGroupByChange clears it on field change (since the prior trails
  reference fields that may no longer apply).
- DataTable / RunTableViewSelector / GroupedBucketTree receive the
  lifted state + onChange callback.

Per the user: no localStorage backing — reload-without-loading-a-view
collapses every bucket.

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

* [frontend] grouping v2 — fix status clipping, X overlap, sticky bucket headers

Three layout fixes the user surfaced after PR #483:

1. Status indicator was clipped on the right.
   Root cause: I shrunk the status column to 20px to close the eye →
   dot gap, but <TableCell> has px-2 = 16px combined padding, leaving
   only ~4px content area for a ~10px dot. Bumped to 28px (just enough
   to clear px-2 with the dot's ring).

2. The deselect-X badge on a selected row was being covered by the
   status cell. Root cause: every pinned cell got z-index:1, so DOM
   order (status renders after select) put the status cell's
   background on top of the X overflowing from select via `-right-3`.
   Lifted the select cell to z-index:2 so its overflow renders above
   neighbors.

3. Bucket-header label disappeared off-screen during horizontal scroll
   in grouped view. The header is a single colspan cell spanning the
   whole table width, which scrolls with the body. Wrapped the inner
   button in a `position: sticky; left: 0` div so the label stays
   pinned at the left edge of the visible viewport while the rest of
   the row scrolls under it — mirroring wandb's grouped-table sticky
   bucket labels.

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

* [backend][frontend] grouping v2 — sticky/full-row group headers + drop dead code + SQL dedup

Two user-visible fixes:

1. Whole bucket-header row is now the click target and the hover bg
   tints the entire bar. Previously the inner button had its own
   `hover:bg-accent/40` while the cell behind it had a static
   `bg-muted/15`, producing a brighter rectangle inside a darker bar.
   Lifted onClick + aria-expanded to <TableCell>, used a
   `group/bucket` parent + `group-hover/bucket:bg-muted/30` so the
   whole cell tints uniformly.

2. Runs without any `group:*` tag now show up as an "(unset)" bucket
   under `tag-prefix:group` (and any future tag-prefix grouping).
   - Re-added FilterableInputShape.tagPrefixExclusions; the
     translator pushes `"group:"` onto it for null tag-prefix buckets.
   - New buildTagPrefixExclusionConditions helper emits
     `NOT EXISTS (SELECT 1 FROM UNNEST(r.tags) AS t WHERE t LIKE $1 || '%')`
     called from every raw-SQL path in list-runs / runs-count /
     distinct-group-values.
   - The default-cursor (Prisma) path now forks to raw SQL when
     tagPrefixExclusions is present.
   - distinct-group-values runs a separate `NOT EXISTS` count to
     surface the null bucket (only on offset=0, skipped when
     valueSearch is active since `null` can't substring-match).

Verified against ryandevvm2/updatedSeededData: 4 named groups + 598
ungrouped runs returned by distinctGroupValues; drill-in returns only
runs without a `group:*` tag.

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

* [frontend][cleanup] drop run-row actions menu

The "..." dropdown in each row's name cell (View run logs + Delete run)
was the only consumer of run-row-actions-menu.tsx; removing it lets us
delete:
- run-row-actions-menu.tsx file
- the menu's import / render block in columns.tsx
- ColumnsProps.onRunDeleted + onDeleteRun + their destructure
- DataTableProps.onRunDeleted + the lifted useDeleteRuns mutation +
  handleDeleteRun (the toolbar's delete-runs button still uses
  useDeleteRuns directly)
- index.tsx's onRunDeleted={...} prop

View-run-logs already accessible from the run detail page; deleting a
run still works via the toolbar Delete button with rows selected.

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

* [frontend] grouping v2 — bucket coloring (Phase 9, A)

Each bucket gets a deterministic color from the Kelly-dark palette,
hashed off the JSON-stringified bucket trail (so a given
{tag-prefix:group, value:ca} bucket lands on the same color across
reloads, page navigations, and after re-grouping/re-saving views).

UX:
- Bucket header gains a small color swatch between the chevron and
  the field label, matching the bucket's assigned color.
- Each leaf bucket's BucketRuns pushes the bucket color into the
  page-level color state (handleColorChange) on fetch, with a dedup
  guard so we don't re-fire when the color already matches.

Chart color propagation (no chart code change needed):
- The page's selectedRunsWithColors / runColors is the source of
  truth for chart line colors. Since BucketRuns updates that state,
  runs that were lines on the chart automatically re-paint to the
  bucket color the moment their bucket is expanded.

Phase 9 is scoped to color only — wandb-style chart aggregation
(one line/group, min-max band, group-aware tooltip) is Phase 10
and comes in its own PR with a separate plan doc.

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

* [frontend] grouping v2 — hide per-row color picker in grouped view

When groupBy is non-empty, the name column's ColorPicker is suppressed
— the bucket owns the color for every run in it, and the eye +
bucket-header swatch already convey that. Eliminates the confusing
case where a user could mutate a single run's color and break the
bucket-wide visual association.

Threaded a new `isGrouped` flag from data-table.tsx → columns(). Flat
mode behaviour is unchanged.

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

* [frontend] grouping v2 — subgroup counts + leaf-only colors

Mirrors wandb's grouped header behavior:

- Color swatch now renders only on LEAF buckets (the deepest grouping
  level — the one whose runs share the color). Parent buckets in a
  multi-level groupBy are pure navigation containers and don't carry
  a color, matching wandb where `User: rhayame3` has no swatch but
  `Group: group1` underneath does.

- Non-leaf parent headers gain a "K subgroups" badge alongside the
  existing "N runs" badge, e.g. `Group: ca · 3 subgroups · 4 runs`.
  Each parent fires a background distinctGroupValues against the next
  groupBy field; the probe doubles as a prefetch so expand is instant.
  Beyond PAGE_SIZE (10) we show "10+" rather than running a separate
  exact count.

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

* [plan] grouping v2 — chart aggregation (Phase 10, B)

Scope-locked design doc for the line-chart side of the grouping
feature. Backed by the user's decisions on:
- mean + min/max band only (v1)
- per-chart override deferred (wandb has it, future PR)
- hidden runs excluded from the aggregate
- lineage stitching off in grouped mode
- drag-zoom works for free

Not implemented yet — code lands in follow-on commits.

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

* [backend] grouping v2 — chart aggregation endpoint (Phase 10, B-1)

Backend half of the chart-side grouping work.

queryRunMetricsGroupedBatchBucketed (lib/queries/run-metrics.ts):
- New ClickHouse helper. Same column shape as the flat path
  (BucketedMetricDataPoint) but groups by `(logName, groupKey,
  bucket)` instead of `(logName, runId, bucket)`. Single CH query
  via an inline CTE that joins runId→groupKey arrays passed from
  Node — perfect bucket alignment across all groups, no per-group
  fan-out.
- count is now COUNT(DISTINCT runId) so the frontend can tell how
  many runs contribute at each bucket (useful for sparse groups
  where a band collapses to a single line).

graphMultiMetricBatchBucketedGrouped proc:
- Resolves the run universe from base toolbar filters + parent
  groupFilters, then computes each run's leaf-bucket trail
  (system fields off the row; config/sysmeta off run_field_values;
  tag-prefix off r.tags) before calling into the CH helper.
- hiddenRunIds are subtracted from the universe before aggregation
  per locked decision #3 — toggling the eye reshapes the band.
- Output keyed by groupPathKey matching the runs-table tree.

lib/group-run-assignment.ts:
- Pure helper that maps a Run row + field-values bag → its bucket
  pathKey. 13 unit tests cover tag-prefix, system fields, config
  numeric/text, nested chains, unknown fields.

Verified against ryandevvm2/updatedSeededData (`train/loss`,
groupBy=[tag-prefix:group]): 5 buckets returned with mean lines +
min/max envelopes; the `ca` group's high-variance band
(min=3.84, max=204.4) confirms the across-runs aggregation works.

Frontend (uPlot band rendering + tooltip rewrite) lands next.

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

* [frontend] grouping v2 — chart aggregation render path (Phase 10, B-2 MVP)

When the page has an active groupBy, chart widgets in CUSTOM DASHBOARDS
now render through a new GroupedLineChart component instead of
MultiLineChart.

What it does:
- Fires the new graphMultiMetricBatchBucketedGrouped endpoint with the
  page's groupBy + hiddenRunIds.
- Builds LineData[] with one main line series (the mean) per group + an
  envelope (min/max) wired via the existing `envelopeOf` / `envelopeBound`
  hooks, so buildBandsConfig.ts in line-uplot draws the band.
- Color comes from bucketColorFor(pathKey) — the same hash that drives
  the runs-table bucket header swatch + in-bucket run colors. Chart and
  table now agree on color.
- Tooltip / legend / zoom / log scale all flow through LineChartUPlot
  unchanged.

Plumbing:
  page index → MetricsDisplay → DashboardBuilder → WidgetRenderer →
  ChartWidget → GroupedLineChart

Out of scope for this MVP (TODO follow-ups, documented in
PLAN-grouping-v2-charts.md):
- Default "All Metrics" view (not a custom dashboard). The All Metrics
  grid still uses the per-run line path. Users hit grouping by opening
  any custom dashboard view.
- Zoom-refetch in grouped mode (the existing useZoomRefetch is tied to
  per-run logic).
- Smoothing/EMA on aggregated lines.
- Time x-axis (only "step" for v1).
- Lineage stitching (locked off per decision #4).

Verified against ryandevvm2/updatedSeededData earlier with curl:
groupBy=[tag-prefix:group] over train/loss returns 5 buckets with
mean+min+max columns; the GroupedLineChart pipeline now feeds those
into the same uPlot bands code path the flat per-run envelope already
exercises.

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

* [frontend] grouping v2 — chart aggregation in the Charts tab (Phase 10, B-3)

Extends the grouped chart path from custom dashboards to the default
"All Metrics" / Charts tab.

- MultiGroup gains an optional groupBy prop. Inside its renderChart
  callback, METRIC widgets branch to <GroupedLineChart> when groupBy is
  non-empty, and stay on <MultiLineChart> otherwise. Non-line widget
  types (histogram, audio, image, video) keep their existing per-run
  rendering — matches the locked scope (media untouched by grouping).

- arePropsEqual now also short-circuits the memo on groupBy changes,
  by value. Without that, toggling grouping at the page level would be
  swallowed by the memo and the user would see stale per-run lines
  until something else invalidated the props.

- metrics-display.tsx threads `groupBy` from its existing props into
  MemoizedMultiGroup so the Charts tab picks it up automatically.

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

* [frontend] grouping v2 — fullscreen chart widget honors groupBy

The fullscreen <ChartFullscreenDialog> rendered its <WidgetRenderer>
without the groupBy/hiddenRunIds props that drive the new grouped
chart path. So expanding to fullscreen reverted to per-run lines,
exactly matching the user's "19 series instead of 14 grouped" report.

Plus a new tests/e2e/seed_grouping_test.py — predictable 14-run layout
across 4 named groups × 3 batch_sizes + 2 ungrouped runs, every run
logging train/loss at every step. Lets you eyeball "N subgroups in
the runs table === N lines in the chart" without media noise.

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

* [frontend] grouping v2 — populate RUN NAME / METRIC columns in grouped tooltip

The chart tooltip reads `runName` / `metricName` straight off LineData
to fill its RUN NAME and METRIC columns. GroupedLineChart wasn't
setting either, so the tooltip showed an empty RUN NAME for every
grouped line and only the numeric value told the user which row was
which — confusing for a chart with 14+ lines.

Now the RUN NAME column shows the bucket trail
(`Group: ca · batch_size: 8`) — the wandb analogue for grouped
charts — and METRIC shows the underlying metric name.

Known remaining quirks in grouped-mode charts (documented in
PLAN-grouping-v2-charts.md, deferred to a follow-up phase):
- Smoothing/EMA: per the plan, smoothing doesn't apply to the
  aggregated path yet. The slider has no effect when groupBy is set.
- Tooltip "mean (min, max)" formatting: still shows just the value;
  envelope min/max not surfaced in the tooltip itself.
- Fullscreen tooltip can overflow / overlap on wide screens.

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

* [frontend] grouping v2 — bucket-row hover highlights chart line + preset-switch fix

Two fixes the user surfaced after the first round of chart aggregation:

1. Hovering a leaf bucket row in the runs table now highlights the
   matching group's line in every chart (and dims the others), exactly
   like hovering a run row does in flat mode. Implementation:
   - GroupedLineChart writes each series' _seriesId as
     `<pathKey>:<metricName>` (was `<metricName>::<pathKey>`). The
     chart-sync `seriesKeyMatches` does a `startsWith(target + ':')`
     check, so prefixing with pathKey lets the bucket header dispatch
     just the pathKey and match across every chart.
   - BucketHeaderRow gains onMouseEnter/onMouseLeave handlers that
     dispatch the same `run-table-hover` CustomEvent flat run rows
     already use. Leaf buckets only — parents would need their full
     descendant pathKey set, deferred to a follow-up.
   - Also added runId=pathKey on grouped LineData for tooltip parity.

2. Switching saved presets (e.g. flat preset → grouped preset) no
   longer required a hard refresh. MultiGroup's `components` useMemo
   was missing `isGrouped` + `groupBy` from its deps array, so its
   inline render functions stayed frozen against the previous
   isGrouped value. Added both to the deps.

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

* [frontend][testing] grouping v2 — fullscreen legend + DISPLAY ID + verify seed

Three things from the user's review pass:

1. Fullscreen chart now has its legend in the sidebar. MultiLineChart
   passes showLegend={true} so uPlot creates `.u-legend` for the
   fullscreen dialog's polling code to relocate into the right
   sidebar. GroupedLineChart wasn't passing it, so the sidebar stayed
   permanently empty and you saw only the leftover divider.

2. DISPLAY ID column in the grouped tooltip no longer shows the raw
   JSON pathKey. Dropped runId from grouped LineData — RUN NAME
   already carries the meaningful bucket trail ("Group: alpha ·
   batch_size: 8"); the DISPLAY ID column simply renders blank for
   grouped lines, which is the right answer when there isn't a
   per-run display ID.

3. New tests/e2e/seed_grouping_verify.py — `groupingVerify` project
   with 12 runs whose train/loss values are CONSTANT per run, so
   mean/min/max are mathematically trivial to predict and eyeball.

   Verified via curl against the new endpoint:
     const-zero/4   line=0      band=[0,0]      ✓
     const-zero/8   line=5      band=[5,5]      ✓
     spread-50/4    line=50     band=[0,100]    ✓
     spread-50/8    line=50     band=[10,90]    ✓
     spread-25/4    line=25     band=[0,50]     ✓
     skew/4         line=25.75  band=[1,100]    ✓

   The skew bucket (mean of [1,1,1,100] = 25.75) confirms the
   aggregator weights every run, not just min/max.

Plus a known-limitations section appended to
PLAN-grouping-v2-charts.md covering the parent-hover gap,
smoothing/EMA, tooltip mean-(min,max) format, per-chart override,
and fullscreen tooltip overflow — all explicitly punted to a
follow-up so future-me has a record.

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

* [frontend] grouping v2 — fullscreen sizing wrapper around LineChartUPlot

GroupedLineChart returned LineChartUPlot bare. MultiLineChart wraps it
in `<div className="relative h-full w-full">` so the chart sizes
correctly inside ChartFullscreenDialog's flex container. Without that
wrapper the chart spilled past the dialog padding and read as "no
padding / overflow" — visible as the chart edge running under the
Export / Chart Settings buttons in the header. Adding the same wrapper
in the grouped path closes the gap; mini-widget rendering is unaffected
(the inline flex parent there already constrains size).

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

* [frontend] grouping v2 — DISPLAY ID column shows contributing-run count

Per user request, the previously-blank DISPLAY ID column on grouped
chart tooltips and legends now surfaces the bucket's contributing-run
count (`2 runs`, `47 runs`, etc.). Reading "wide band + 2 runs"
immediately signals "small sample, high variance"; "narrow band + 50
runs" signals "trust the mean". We use the max count across buckets
rather than the per-step count — sparse-logging fluctuations are noisy
and the user mostly cares about how many runs the bucket COULD have.

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

* [plan] grouping v2 — flesh out post-MVP TODO list with analysis

Per user feedback, the limitations section was too light — items were
listed without the analysis a future implementer (or future-me) needs
to prioritise. Rewrote with: what the gap is, where in code it lives,
rough impact, rough complexity, and any open design questions.

Also dropped the bogus "fullscreen tooltip / sidebar overflow" item
after checking the source: `.fullscreen-legend-sidebar` has
`overflow-y: auto` and the in-chart tooltip's `cachedMaxH` path
already applies a content max-height. Pre-existing handling; works
identically with grouped series. Added a "NOT a limitation" footnote
recording the investigation so the next person doesn't re-discover.

No code change.

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

* [frontend] grouping v2 — Phase 10-C: tooltip band, parent hover, smoothing, per-chart override

Four chained TODO items from PLAN-grouping-v2-charts.md, in order.

1) Tooltip VALUE column now renders `mean (min, max)` for grouped
   chart rows. tooltip-plugin already collects envelope sibling
   values into `minValue` / `maxValue`; the value formatter now
   reads both and appends the band edges when present. Flat per-run
   charts are unaffected (no envelope siblings).

2) Parent-bucket hover. Bucket headers ONE level above leaf now
   synthesise descendant pathKeys from the cached subgroup probe
   data and dispatch them as an array via `run-table-hover` (the
   chart-sync handler already supported string[] payloads). Higher-
   depth parents still no-op for v1 — that's a cascading-probe
   problem, deferred. BucketHeaderRow's hover handler was
   restructured into a `hoverDispatch` discriminated-union prop so
   leaf vs parent-of-leaf logic stays close to the dispatch site.

3) Smoothing in grouped mode. GroupedLineChart now reads
   useLineSettings(...) and applies smoothData to ONLY the mean line
   when smoothing is on — band edges stay raw min/max per the user's
   call (matches non-grouped behaviour). settingsRunId plumbed
   through ChartWidget; MultiGroup (Charts tab) passes undefined so
   useLineSettings falls back to the workspace-wide "full" key.

4) Per-chart grouping override. ChartScalePopover gains a
   "Group runs in this chart" toggle that only appears when the page
   has active grouping. The toggle persists into
   ChartWidgetConfig.groupingOverride ("auto" | "off") so it's saved
   with the rest of the dashboard view config. ChartWidget reads
   `effectiveGroupBy = override === "off" ? undefined : groupBy`.
   Plumbing: dashboard-builder.tsx → widget-grid.tsx → widget-card.tsx
   → chart-scale-popover.tsx.

   Charts tab (chart-card-wrapper.tsx) doesn't have a per-widget
   persisted config, so the override only applies in dashboards.
   Documented inline.

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

* [backend][frontend][plan] grouping v2 — Phase 10-C: zoom-refetch + time x-axis + plan refresh

Two TODO items from PLAN-grouping-v2-charts.md.

### Zoom-refetch in grouped mode

GroupedLineChart now fires a second graphMultiMetricBatchBucketedGrouped
query with `stepMin`/`stepMax` + `buckets: 1000` when the user
drag-zooms. The base + zoom responses are merged per (logName,
groupKey) with zoom data preferred. Caveat: step-x only — in time-x
mode the step bounds don't translate to a time window, so the zoom
query is `enabled: false`. Timeline zoom needs a separate timeMin/
timeMax pair (deferred follow-up).

### X-axis modes

Backend: queryRunMetricsGroupedBatchBucketed gains an `xAxis: "step" |
"time"` param. Time mode replaces the step-bucket math with
`toUnixTimestamp64Milli(time)` and runs an inline min/max(time)
bounds CTE against mlop_metrics_v2 (mlop_metric_summaries_v2 doesn't
carry time bounds). Returned bucket time is the bucket's start time
as DateTime64(3). Response shape unchanged.

Frontend: GroupedLineChart gains `xAxis?: "step" | "time"`. When
time, x-values are extracted from the columnar `times` field via
parseChTimeMs and `isDateTime` is forwarded to LineChartUPlot so
uPlot renders date labels + tooltips.

Verified against ryandevvm2/groupingVerify (the constant-value
project): time-x mode returns plausible mean-per-time-bucket values
(0+5 → 2.5 for const-zero, etc.) confirming the SQL bucket math.

### Deferred (plan doc updated)

- Relative-time x-axis: needs per-run baselining inside the SQL
  aggregator (subtract each run's min(time) before bucketing). Not
  trivial.
- Custom-metric x-axis (`train/loss` vs `optim/learning_rate`):
  requires a metric-on-metric join on (runId, step), then aggregate
  vs the x-metric's value range.
- Lineage stitching in grouped mode (locked off per original
  decision #4; needs a design pass on whether parent's pre-fork data
  should count toward the child's group).

PLAN-grouping-v2-charts.md was reorganised: items 1-6 marked SHIPPED
or PARTIAL with what landed and what's still open; deferred items now
have a clearer scope so future-me knows what to do.

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

* [backend][frontend] grouping v2 — Phase 10-C revisions per user feedback

Four follow-ups on the Phase 10-C batch:

1. Revert the `mean (min, max)` VALUE-column format. User pointed out
   the tooltip already has Min and Max as opt-in columns via the gear
   popover — duplicating them inside VALUE was unnecessary.

2. Per-chart override toggle in Chart Settings renamed and flipped:
   - Label: "Override Grouping" (was "Group runs in this chart")
   - Semantics: ON = override (force per-run for this chart);
     OFF / default = follow workspace.
   - Plumbing change: `groupingEnabledForChart` (true=group)
     → `groupingOverridden` (true=override).

3. Relative-time x-axis added (was deferred). New SQL branch in
   queryRunMetricsGroupedBatchBucketed: a per-run baseline CTE
   (`min(time)` per runId) is joined into the bounds + main query so
   each run's clock is subtracted before bucketing. Bucket-start
   relative-ms is encoded in the response's `step` field; frontend
   divides by 1000 to plot seconds since baseline. uPlot's
   isDateTime is false in relative mode; xlabel reads "time (s)".

4. ChartWidget's xAxis mapping now covers all three modes (step,
   absolute-time, relative-time). Custom-metric-x still falls back
   to step — see plan doc.

Verified all 3 modes via curl against groupingTest:
  step           → bucket0 step=0, value=3.55
  time           → bucket0 absolute time, value=2.37
  relative-time  → bucket0 baselined, value=3.88
(distinct values across modes confirm the bucket math actually
differs per axis as expected.)

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

* [plan] grouping v2 — mark relative-time x-axis as shipped

Plan doc was still listing relative-time x-axis as deferred. Updated
the entry to reflect what landed in the Phase 10-C rev…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants