Skip to content

[claude] fix(benchmarks-website): preserve visible center on chart scope change#7781

Merged
connortsui20 merged 1 commit intoct/benchmarks-v3from
claude/benchmarks-v3-zoom-preserve-center
May 4, 2026
Merged

[claude] fix(benchmarks-website): preserve visible center on chart scope change#7781
connortsui20 merged 1 commit intoct/benchmarks-v3from
claude/benchmarks-v3-zoom-preserve-center

Conversation

@connortsui20
Copy link
Copy Markdown
Contributor

Summary

Adjusting a chart's zoom (toolbar slider, future zoom shortcuts) while the
user had pan-scrolled to a historical window was snapping the visible
range back to the most recent N commits — losing whatever they were
inspecting.

applyScope calls visibleRange(commitCount, scope) on every slider
input, and visibleRange always returned [maxIdx - (scope - 1), maxIdx],
i.e. unconditionally right-anchored. This commit threads the chart's
current chart.options.scales.x.{min, max} into visibleRange so it can
preserve the visible CENTER when the chart is already panned away from
the right edge.

When the chart is at the right edge or already covers everything, the
right-anchor behavior is unchanged — that is still the right default at
first load and after "show all". onPan / onZoom continue to route
through rebuildVisibleAndUpdate directly (not applyScope), so they
don't regress, and syncSliderFromRange still updates the slider readout
on every pan.

The fix is purely client-side: no refetch, no server-side commit cap
change, no slider re-binding. STATIC_ASSET_VERSION is bumped to
bench-v3-ui-17 so cached browsers pick up the new JS; the three
snapshot files that embed the version string are refreshed.

Files

  • benchmarks-website/server/static/chart-init.jsvisibleRange takes
    an optional currentRange; applyScope reads the chart's current
    {x.min, x.max} and passes it through. Added an invariant comment
    above visibleRange per the request to document the new behaviour.
  • benchmarks-website/server/src/html.rs — bump STATIC_ASSET_VERSION.
  • benchmarks-website/server/tests/snapshots/{landing_page,chart_page_query,group_page_query}.snap — version string refresh.

Test plan

  • cargo test -p vortex-bench-server — 54/54 pass (21 lib + 10
    ingest + 23 web_ui snapshots)
  • cargo +nightly fmt --all — clean
  • cargo clippy -p vortex-bench-server --all-targets --all-features
    clean
  • Local smoke: /health returns OK, /static/chart-init.js serves
    the new visibleRange(commitCount, scope, currentRange) signature, the
    landing page references chart-init.js?v=bench-v3-ui-17.
  • Manual UI smoke (browser): expand a group, pan to mid-history,
    drag the toolbar slider — visible window should grow/shrink around
    the current center, not snap to the newest commits.

Generated by Claude Code

@connortsui20 connortsui20 added the changelog/fix A bug fix label May 4, 2026 — with Claude
@connortsui20 connortsui20 changed the title fix(benchmarks-website): preserve visible center on chart scope change [claude] fix(benchmarks-website): preserve visible center on chart scope change May 4, 2026
The toolbar slider's `applyScope` always called `visibleRange` which
unconditionally returned the right-anchored window
`[maxIdx - (scope - 1), maxIdx]`. So any scope change while the user
had pan-scrolled to inspect a historical window snapped the chart back
to the most-recent commits — losing whatever they were looking at.

Pass the chart's current `chart.options.scales.x.{min, max}` into
`visibleRange` so it can preserve the visible CENTER when the chart is
already panned away from the right edge. When the chart is at the
right edge or already covers everything, the right-anchor behavior is
preserved — that is still the right default at first load and after
"show all". Pan/zoom callbacks are unchanged: they go through
`rebuildVisibleAndUpdate` directly, not `applyScope`.

Bump `STATIC_ASSET_VERSION` to `bench-v3-ui-17` so cached browsers
pick up the new JS, and refresh the snapshot tests that reference the
versioned asset URLs.

Signed-off-by: Claude <noreply@anthropic.com>
@connortsui20 connortsui20 force-pushed the claude/benchmarks-v3-zoom-preserve-center branch from b9d2f55 to 3796974 Compare May 4, 2026 16:24
@connortsui20 connortsui20 merged commit 4a97c94 into ct/benchmarks-v3 May 4, 2026
58 of 60 checks passed
@connortsui20 connortsui20 deleted the claude/benchmarks-v3-zoom-preserve-center branch May 4, 2026 16:26
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 4, 2026

Merging this PR will improve performance by 33.23%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 1168 untouched benchmarks
⏩ 138 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation new_bp_prim_test_between[i64, 32768] 236.4 µs 177.4 µs +33.23%

Comparing claude/benchmarks-v3-zoom-preserve-center (3796974) with ct/benchmarks-v3 (116e5a7)

Open in CodSpeed

Footnotes

  1. 138 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

connortsui20 added a commit that referenced this pull request May 4, 2026
…ope change (#7781)

## Summary

Adjusting a chart's zoom (toolbar slider, future zoom shortcuts) while
the
user had pan-scrolled to a historical window was snapping the visible
range back to the most recent N commits — losing whatever they were
inspecting.

`applyScope` calls `visibleRange(commitCount, scope)` on every slider
`input`, and `visibleRange` always returned `[maxIdx - (scope - 1),
maxIdx]`,
i.e. unconditionally right-anchored. This commit threads the chart's
current `chart.options.scales.x.{min, max}` into `visibleRange` so it
can
preserve the visible CENTER when the chart is already panned away from
the right edge.

When the chart is at the right edge or already covers everything, the
right-anchor behavior is unchanged — that is still the right default at
first load and after "show all". `onPan` / `onZoom` continue to route
through `rebuildVisibleAndUpdate` directly (not `applyScope`), so they
don't regress, and `syncSliderFromRange` still updates the slider
readout
on every pan.

The fix is purely client-side: no refetch, no server-side commit cap
change, no slider re-binding. `STATIC_ASSET_VERSION` is bumped to
`bench-v3-ui-17` so cached browsers pick up the new JS; the three
snapshot files that embed the version string are refreshed.

## Files

- `benchmarks-website/server/static/chart-init.js` — `visibleRange`
takes
  an optional `currentRange`; `applyScope` reads the chart's current
  `{x.min, x.max}` and passes it through. Added an invariant comment
  above `visibleRange` per the request to document the new behaviour.
- `benchmarks-website/server/src/html.rs` — bump `STATIC_ASSET_VERSION`.
-
`benchmarks-website/server/tests/snapshots/{landing_page,chart_page_query,group_page_query}.snap`
— version string refresh.

## Test plan

- [x] `cargo test -p vortex-bench-server` — 54/54 pass (21 lib + 10
  ingest + 23 web_ui snapshots)
- [x] `cargo +nightly fmt --all` — clean
- [x] `cargo clippy -p vortex-bench-server --all-targets --all-features`
—
  clean
- [x] Local smoke: `/health` returns OK, `/static/chart-init.js` serves
the new `visibleRange(commitCount, scope, currentRange)` signature, the
  landing page references `chart-init.js?v=bench-v3-ui-17`.
- [ ] Manual UI smoke (browser): expand a group, pan to mid-history,
  drag the toolbar slider — visible window should grow/shrink around
  the current center, not snap to the newest commits.


---
_Generated by [Claude
Code](https://claude.ai/code/session_01U5VP7x7Tduk2GX7DSjP5Hk)_

Signed-off-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants