chore(staffview): drop two redundant structures (ponytail) - #18
Conversation
- 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>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughMiss-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. ChangesMiss Tracking and Study Gate Refactor
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
_svStudyGateTimeand derived the active gate’sgateTimedirectly from_svStudyGates[_svStudyGateIdx]at the single read site. - Folded
_svMissEntryByKeyinto_svMissNotesby switching_svMissNotesfromSet<noteKey>toMap<noteKey, entry>. - Updated the
_svHandleSeektest harness to seed_svMissNotesas aMapconsistent 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.
| 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 }); |
Two behavior-preserving simplifications on the now-merged staffview code:
_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._svMissEntryByKeyinto_svMissNotes— Set + parallel all-notes Map → oneMap<noteKey, entry>, dropping a per-chart O(n) index build.Net −14 lines in screen.js. Full
node:testsuite green (104/104). Codex preflight clean.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Summary by CodeRabbit