Skip to content

Marshaling: no rulings before commit — kill click-to-insert; unified re-detection preview#354

Merged
ryan-johnson2 merged 1 commit into
develfrom
tune-preview-safety
Jul 3, 2026
Merged

Marshaling: no rulings before commit — kill click-to-insert; unified re-detection preview#354
ryan-johnson2 merged 1 commit into
develfrom
tune-preview-safety

Conversation

@ryan-johnson2

Copy link
Copy Markdown
Contributor

Live-testing findings (user): adjusting thresholds produced audit rulings BEFORE commit, and the side-by-side preview-vs-official lap lists confused.

Root cause (verified live): the trace svg carried a click-to-insert handler that sent an unconfirmed InsertLap on ANY click — and finishing a threshold drag synthesizes exactly such a click, so every drag planted a phantom "Lap inserted" at the cursor. This also explains the earlier "Lap inserted while removing laps" confusion.

  • Click-to-insert is gone. The labeled "Add lap here" button in the cursor readout is the only add path; hover hint updated; marker select-clicks unchanged. Regression tests: a trace click sends nothing; a full drag + browser-synthesized click sends nothing; the button still sends the exact heat-tagged insert.
  • One chronological preview list replaces the side-by-side: kept laps plain, added laps +-accented, dropped passes struck − pass at Xs — removed — built by a new pure previewRows (5 unit tests). Commit batch untouched.

Verified against the live rig: drag + three bare trace clicks → audit count unchanged, tuning still works, zero page errors. Gates: 544 console tests, both check passes, lint clean. Frontend-only.

🤖 Generated with Claude Code

…fied re-detection preview

Live-testing surfaced rulings appearing BEFORE any explicit commit while
tuning detection thresholds, plus baffling "Lap inserted" audit entries
while removing laps. Root cause: the RSSI trace svg carried an onclick
that IMMEDIATELY sent an InsertLap at the cursor time — and the browser
synthesizes a click on the svg when a threshold drag (pointerdown →
pointerup on a handle) finishes inside it, so EVERY drag planted a
phantom lap; stray clicks did the same.

Fix 1 — no direct click-to-insert, ever (RssiGraph.svelte):
- The svg's click-to-insert path is removed entirely. The ONLY add path
  is the explicit, labelled "Add lap here" button in the cursor readout
  under the plot (deliberate, un-misfireable).
- The in-plot hover hint now points at that button ("add lap ↓ below");
  the crosshair cursor cues the position readout, not a click action.
- Lap-marker clicks (select-lap) keep working unchanged.
- Tests: a trace click sends NOTHING (component + screen level); a full
  threshold drag followed by the browser-synthesized svg click sends
  NOTHING; the readout button still sends the exact heat-tagged
  InsertLap.

Fix 2 — unified re-detection preview (redetect.ts + Marshaling.svelte):
- New pure `previewRows(current, detected, tolerance?)`: ONE
  chronological list telling the whole story — laps derived from the
  surviving pass chain, each `kept` (closing pass matched an official
  one) or `added` (new), interleaved with `removed` rows for every
  official pass the re-detection drops (passes leaving the record — no
  lap number). Unit-tested: kept/added classification, removed
  interleaving in time order, pure-kept diffs, tolerance matching.
- The tune panel's side-by-side preview-vs-official lap lists are
  replaced by that single list: kept rows plain, added rows
  accent-marked "+", removed rows struck/dimmed "− pass at Ts —
  removed". The "Would be N laps (+A, −R)" summary stays; the exact
  commit command batch (VoidDetection/InsertLap) is untouched —
  render-only.

Gates: rd-console svelte-check (both passes) clean; vitest 42 files /
544 tests green; frontend eslint + prettier clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ryan-johnson2 ryan-johnson2 merged commit cb25b9c into devel Jul 3, 2026
3 checks passed
@ryan-johnson2 ryan-johnson2 deleted the tune-preview-safety branch July 3, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant