Skip to content

chore(staffview): drop two redundant structures (ponytail) - #18

Merged
byrongamatos merged 1 commit into
mainfrom
chore/ponytail-cleanup
Jul 8, 2026
Merged

chore(staffview): drop two redundant structures (ponytail)#18
byrongamatos merged 1 commit into
mainfrom
chore/ponytail-cleanup

Conversation

@byrongamatos

@byrongamatos byrongamatos commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Two behavior-preserving simplifications on the now-merged staffview code:

  • Remove _svStudyGateTime — a cached copy of _svStudyGates[_svStudyGateIdx].gateTime (written in 6 places, read in 1). Derived at the single read; other sites already derived it inline.
  • Fold _svMissEntryByKey into _svMissNotes — Set + parallel all-notes Map → one Map<noteKey, entry>, dropping a per-chart O(n) index build.

Net −14 lines in screen.js. Full node:test suite green (104/104). Codex preflight clean.

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

Summary by CodeRabbit

  • Bug Fixes
    • Improved miss-dot updates after relayouts and seeks, so missed notes are restored more reliably.
    • Fixed study mode timing so gate pauses now follow the active gate state more consistently.
  • Tests
    • Updated seek-related test coverage to match the revised missed-note handling.

- Remove _svStudyGateTime: a cached copy of _svStudyGates[idx].gateTime
  written in 6 places but read in one; derive it at the single read.
- Fold _svMissEntryByKey into _svMissNotes (Set -> Map<noteKey,entry>),
  deleting the parallel all-notes index and its per-chart O(n) build.

Behavior-preserving; full node:test suite green (104).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 8, 2026 09:02
@byrongamatos
byrongamatos merged commit 1151657 into main Jul 8, 2026
3 of 4 checks passed
@byrongamatos
byrongamatos deleted the chore/ponytail-cleanup branch July 8, 2026 09:02
@coderabbitai

coderabbitai Bot commented Jul 8, 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: eda3e2aa-a7a2-45b2-a6ee-7d3095ebaee7

📥 Commits

Reviewing files that changed from the base of the PR and between c9bc941 and 3aa34d9.

📒 Files selected for processing (2)
  • screen.js
  • tests/score.test.js

📝 Walkthrough

Walkthrough

Miss-note tracking in screen.js is refactored from a Set-plus-lookup-map to a single Map keyed by note key mapping to judge-list entries, updating redraw, seek rollback, and sweep logic. Study mode's gate timing scalar is removed in favor of reading gate time from the gate list by index. Tests are updated accordingly.

Changes

Miss Tracking and Study Gate Refactor

Layer / File(s) Summary
Miss note Map refactor
screen.js
_svMissNotes becomes a Map of noteKey → judge entry, replacing a Set plus separate _svMissEntryByKey lookup; _svRedrawAllMissDots(), _svHandleSeek(), _svSweepMisses(), judge-list rebuild, and teardown are updated to use .set()/.get()/.keys()/.clear() on the Map.
Study gate timing via index
screen.js
_svStudyGateTime scalar is removed; activation, deactivation, hand isolation switching, gate advancement, platform seek handling, teardown, and the draw() pause condition now derive gate timing from _svStudyGates[_svStudyGateIdx].
Test harness alignment
tests/score.test.js
runSeek() builds an entryByKey map from notes, derives missSeed pairs, and seeds _svMissNotes as a Map, replacing the prior missEntryByKey payload passed into the compiled harness function.

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

Possibly related PRs

  • got-feedBack/feedBack-plugin-staffview#4: Both PRs modify screen.js seek handling — this PR refactors miss-dot rollback within _svHandleSeek(), while the linked PR rewires click-to-seek timing/seek behavior in the same code path.
✨ 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 chore/ponytail-cleanup

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

Copilot AI 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.

Pull request overview

This PR performs two behavior-preserving simplifications in the staffview runtime by removing a redundant cached study-gate timestamp and consolidating miss-dot tracking into a single Map<noteKey, entry> structure (eliminating a parallel Set+Map representation).

Changes:

  • Removed _svStudyGateTime and derived the active gate’s gateTime directly from _svStudyGates[_svStudyGateIdx] at the single read site.
  • Folded _svMissEntryByKey into _svMissNotes by switching _svMissNotes from Set<noteKey> to Map<noteKey, entry>.
  • Updated the _svHandleSeek test harness to seed _svMissNotes as a Map consistent with the runtime change.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/score.test.js Updates the _svHandleSeek test harness to seed miss-dot state using a Map<noteKey, entry> (missSeed) instead of Set + separate index.
screen.js Removes _svStudyGateTime and consolidates miss-dot bookkeeping into _svMissNotes: Map<noteKey, entry>, eliminating _svMissEntryByKey.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/score.test.js
wrongKeyMisses: _svWrongKeyMissTimes.length,
};`;
return new Function('A', harness)({ notes, missEntryByKey, hitKeys, missKeys, c: counters, newTime, wrongKeyMissTimes });
return new Function('A', harness)({ notes, missSeed, hitKeys, missKeys, c: counters, newTime, wrongKeyMissTimes });
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