Skip to content

Restore note-detection pill controls + legacy section order - #16

Merged
byrongamatos merged 2 commits into
mainfrom
feat/detection-controls
Jul 8, 2026
Merged

Restore note-detection pill controls + legacy section order#16
byrongamatos merged 2 commits into
mainfrom
feat/detection-controls

Conversation

@gionnibgud

@gionnibgud gionnibgud commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Restore note-detection pill controls + legacy section order

Follow-up that restores two options dropped when staffview's own note detection
was replaced by the core note-detection domain, and realigns the pill's section
order with the pre-namespace (legacy) version.

Stacked PR. Base is feat/study-mode (#15) → #14#13#12#8.
Review/merge those first; this PR's own diff is the single feat(pill) commit.

What's here

  • NOTE DETECTION section (new, top of the pill):
    • Detect toggle — master on/off for scoring. Off keeps the monitor synth
      (play/listen along) but skips judging, the miss sweep, and note-detection
      reporting. The sweep cursor still tracks the play head while off, so
      re-enabling mid-song doesn't retroactively flood the skipped span.
    • Clear on seek toggle — whether a seek clears miss dots for the
      seeked-over / replayed region (on) or leaves them in place (off).
    • Both persisted to localStorage.
  • Legacy section order — the pill now reads
    NOTE DETECTION → STUDY → HAND → MIDI (+ Sound + Volume) → LAYOUT → ZOOM,
    matching the original, with a consistent separator on the MIDI section.

Notes for review

  • Defaults are unchanged behaviour: Detect on, Clear-on-seek on — purely
    additive unless toggled.
  • Note explorer (the third legacy NOTE DETECTION item) is intentionally
    not here — it lives in its own PR (Note explorer: alt-click / double-tap pitch tooltip #9, feat/note-explorer).

Verification

  • Deployed to the local docker stack; verified on the v3 UI with a MIDI
    keyboard: Detect off = synth only, no scoring; re-enable mid-song doesn't
    dump misses; Clear-on-seek on/off behaves as described; both persist across
    reload; pill order/separators correct.
  • npm test green (54/54).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added persistent Note Detection controls to Staff View’s options pill, including a Detect toggle and a Clear on seek option.
    • Users can enable/disable note scoring while cursor tracking continues, and choose whether miss markers are cleared during seeking.
    • Settings are saved and restored automatically.
  • Bug Fixes

    • Updated seek behavior so swept miss markers/counters are cleared only when Clear on seek is enabled.
    • When Detect is off, playback tracking continues without counting note hits or misses.

Restores two pill controls dropped when staffview's own note detection was
replaced by the core domain, and realigns the section order with the legacy
pill.

- NOTE DETECTION section:
  - Detect toggle — master on/off for scoring. Off keeps the monitor synth
    but skips judging, the miss sweep, and note-detection reporting; the sweep
    cursor still tracks the play head so re-enabling doesn't flood misses.
  - Clear on seek toggle — whether a seek clears miss dots for the seeked-over
    / replayed region, or leaves them in place.
  - Both persisted to localStorage.
- Section order now mirrors the legacy pill:
  NOTE DETECTION → STUDY → HAND → MIDI (+ Sound + Volume) → LAYOUT → ZOOM,
  with a consistent separator on the MIDI section (previously the first).

Note explorer stays in its own PR (#9); it is not part of this stack.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: gionnibgud <gionnibgud@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 34631c91-903e-40f8-91eb-64235845173e

📥 Commits

Reviewing files that changed from the base of the PR and between 3c146ce and 475f336.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • screen.js
  • tests/score.test.js

📝 Walkthrough

Walkthrough

Adds persistent "NOTE DETECTION" controls to the Staff View options pill, backed by new localStorage keys. Detection toggling changes note scoring and miss-sweep tracking, while the clear-on-seek setting gates miss-dot rollback during seeks. Test coverage and changelog text were updated.

Changes

Note-detection controls

Layer / File(s) Summary
Storage keys and factory state
screen.js
Adds staffview_detect and staffview_clear_on_seek localStorage keys, plus factory state _svDetectEnabled, _svClearOnSeek, and cached _svDetectBtnEl.
Options pill UI and section ordering
screen.js
Adds NOTE DETECTION section with Detect toggle and Clear on seek checkbox, reorders popover sections to show it first, adds _svUpdateDetectBtn(), and nulls button reference on teardown.
Detection-dependent scoring, sweep, and seek behavior
screen.js, tests/score.test.js
Skips judge-hit/miss evaluation in _handleNoteOn when detection is off, advances miss-sweep cursor without recording misses when disabled, gates seek-time miss-dot/tally rollback on _svClearOnSeek, and updates seek test harness with the new flag.
Changelog entry
CHANGELOG.md
Documents the new NOTE DETECTION pill controls and localStorage persistence.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: byrongamatos

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/detection-controls

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
screen.js (1)

3298-3316: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Study mode should respect Detect off screen.js:3304 _handleNoteOn enters _svStudyHandleNoteOn() before the Detect check, and that path still updates hits/misses and calls _svNdReport() / _svEmitNoteResult(). If Detect is meant to be the master scoring toggle, gate the Study-mode branch too or make the exception explicit.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@screen.js` around lines 3298 - 3316, _handleNoteOn currently routes
study-mode note events into _svStudyHandleNoteOn() before checking
_svDetectEnabled, so study mode can still score and report when Detect is off.
Update the gating in _handleNoteOn so the study-mode path is also blocked by the
Detect toggle, or make the study-mode exception explicit in that branch. Keep
the behavior centered around _svStudyHandleNoteOn, _svNdReport, and
_svEmitNoteResult so Detect remains the master scoring switch.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@screen.js`:
- Around line 3298-3316: _handleNoteOn currently routes study-mode note events
into _svStudyHandleNoteOn() before checking _svDetectEnabled, so study mode can
still score and report when Detect is off. Update the gating in _handleNoteOn so
the study-mode path is also blocked by the Detect toggle, or make the study-mode
exception explicit in that branch. Keep the behavior centered around
_svStudyHandleNoteOn, _svNdReport, and _svEmitNoteResult so Detect remains the
master scoring switch.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 73b5f627-0635-43c5-b0ed-a29fb554536f

📥 Commits

Reviewing files that changed from the base of the PR and between 5e4cdf4 and 3c146ce.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • screen.js

Reconcile clear-on-seek toggle (#16) with the seek counter-rollback fix
(#14): gate the miss-dot loop AND its tally decrement on _svClearOnSeek;
keep hit-claim/wrong-key rollback unconditional. Define _svClearOnSeek in
the score-test seek harness (default true) so the rollback tests exercise
the clearing path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@byrongamatos
byrongamatos changed the base branch from feat/study-mode to main July 8, 2026 08:25
@byrongamatos
byrongamatos merged commit c9bc941 into main Jul 8, 2026
2 of 3 checks passed
@byrongamatos
byrongamatos deleted the feat/detection-controls branch July 8, 2026 08:29
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.

2 participants