Repository navigation
feat(web): zoom-to-selection (brush) for the session context-trajectory chart - #2492
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3619-pr.2492.e5ff940This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2492.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 PR Review — zoom-to-selection (brush) #2489 Reviewed the full diff (8 files, +602/−15) against issue #2489's acceptance criteria, ran the web-UI test lanes locally, and pushed two review findings to the branch. Current head: ① Direction check (原 issue): ✅ The mechanism is right — the ledger data is already client-side in the detail payload, so zoom = re-running the same ② Regression audit (既有行为清点) — touched paths and their existing behaviors:
③ Defect found & fixed (the important one): ④ CI state: the earlier red ⑤ Test quality: assertions have teeth — exact hover-column counts (1200→121), exact column width (7.4), exact maxY recompute (480K→129K), tick re-equispacing, nested-zoom absolute mapping ([410,430]), all three reset paths restoring the exact full-view SVG, narrow/full-width drags ignored, overlay lifecycle during drag. Golden follows #1304 discipline (regen script + justification requirement). The 结构化八问
行为变更披露(old→new):相对 PR 原 head( 分支状态备注:分支基点仍在 结论:可合 —— 待 |
[bot] 🏷 Follow-up to my review above — CI on The Windows failure: golden file EOL, not code
Verification done locally (targeted, per testing discipline)
The fixOne line in Note: while I was preparing this, the author session independently pushed CI on
|
…red (#2489 byte parity) The zoom feature time-filtered fold/seam marks even in the FULL view, silently dropping any mark whose timestamp falls outside the sample range — while the pre-#2489 renderer clamped such marks to the nearest edge. That made the 'identical inputs -> identical SVG' acceptance criterion hold only when all event timestamps happen to be in-range. Full view now hands the unfiltered lists straight to the renderer (zoomed windows keep their time filter), and a regression test pins a late fold + early seam round-tripping unchanged.
…rer (#2489) Rebased onto master, where #2929 replaced the three fixed horizontal x-axis labels with pixel-thinned rotated ones (tStep = ceil(24/barW)) and added a vertical spine line per miss-cause band. The full-view fixture now gets ticks on seq 1200/1167/.../12 instead of 1/600/1200; zoomed-window assertions are unchanged (their grids still include the asserted seqs). Golden regenerated via scripts/update-web-trajectory-golden.ts.
daf37c6 to
64dcac6
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.465-master.a2a6db3 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #2489
Long sessions (e.g. 962 requests/day from #917 @xfyang728's screenshot) pack every sample into the fixed 960px canvas: hover hit-columns drop below 1px past ~944 samples and fold marks already needed pixel-bucket merging to stay legible. This adds the requested Zoom-to-Selection so any range can be inspected.
What
trajectorySvgrenderer re-runs overlines[i0..i1]only; folds/seam events are time-filtered into the visible window. X-axis becomes equidistant again, Y-axis auto-fits the visible segment (window ceiling line stays visible when relevant). Pure client-side — no server round-trip, no new endpoint.当前视图 #a–#b(start → end)plus a reset button; double-clicking the chart or pressing Esc resets to the full view. Nested zooms compose (a brush inside a zoomed view maps back to absolute indices).Implementation notes
TRAJ_W/H/PL/PR/PT/PB) so the gesture code shares the renderer's math;trajectorySvgoutput is byte-identical for unchanged inputs.#traj-chartwrap now starts empty and is filled by a single render path (bindTrajectoryBrush→trajRender), so full and zoomed states go through the same code.detailSeam/detailSeamActivehelpers (logic verbatim, shared by the card HTML and the brush state).Tests
tests/web-trajectory-brush.test.ts: hermetic mini-DOM driving the real client IIFE via vm.tests/golden/web-trajectory/small-full.svg(covers window ceiling, baseline, burst-fold merge, cause bands, seam marks); regen scriptscripts/update-web-trajectory-golden.ts.Config surface
None added — pure Web UI rendering capability, per the issue's non-goals (no server endpoint, no ledger model change, no config fields/env vars).
Behavior-change disclosure
#traj-chartvia one extra synchronous write right afterhost.innerHTMLinstead of being inlined in the initial HTML string; final DOM is identical..chart-wrapgainsposition: relative(only used by this chart, grep-verified) to anchor the brush overlay.