feat(h3d-carve-14): extract V-section (note renderer) into src/note-renderer.js

Carve cut 14 of the h3d-carve epic. Moves the full V-section (note renderer):
  drawNote, drawArpBrackets, drawNotedetectLabels, chordHarmonyLabels
  and 14 private helpers (~1,433 lines)
from screen.js into plugins/highway_3d/src/note-renderer.js
as a factory-DI ES module: createNoteRenderer({137 DI params}).

Beyond-subst (3 sites):
  _ndVerdictSawAlpha = true  → setNdVerdictSawAlpha(true)
  _ndVerdictMaxAlpha = v     → setNdVerdictMaxAlpha(v)
  _streakHits = 0/++         → setStreakHits(0/getStreakHits()+1)

Tests:
  - New: tests/js/highway_3d_note_renderer.test.js (22 assertions)
    wiring guard (137 params), export contract, chordHarmonyLabels
    behavioral kills, beyond-subst sentinel, tombstone checks
  - Updated 8 existing test files to search note-renderer.js
    alongside screen.js for moved patterns (h3d-carve-14 retarget)

Bumps plugin.json 3.49.0 → 3.50.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014uZ169yfoFYArXz962g7KW
This commit is contained in:
byrongamatos
2026-09-05 20:32:15 +02:00
co-authored by Claude Sonnet 4.6
parent 66aa829362
commit c58c40f1ed
12 changed files with 2000 additions and 1452 deletions
+8 -2
View File
@@ -17,6 +17,10 @@ const highwayJs = path.join(__dirname, '..', '..', 'static', 'highway.js');
// cannot import per-instance state without two panels sharing it.
const primitivesJs = path.join(__dirname, '..', '..', 'static', 'js', 'highway-state-primitives.js');
const highway3dJs = path.join(__dirname, '..', '..', 'plugins', 'highway_3d', 'screen.js');
// h3d-carve-14: V-section (drawNote) moved to note-renderer.js; tests that
// pin its patterns must now also search note-renderer.js.
const _h3dNoteRendererJs = path.join(__dirname, '..', '..', 'plugins', 'highway_3d', 'src', 'note-renderer.js');
const _h3dNoteRendererSrc = fs.readFileSync(_h3dNoteRendererJs, 'utf8');
// Brace-balanced extraction (same helper shape as highway_visibility.test.js).
function extractBlock(src, signature) {
@@ -138,7 +142,9 @@ test('default 2D renderer threads note state into drawNote / drawSustains / chor
});
test('3D highway captures bundle.getNoteState and overrides legacy hit/miss with the provider verdict', () => {
const src = fs.readFileSync(highway3dJs, 'utf8');
// h3d-carve-14: _ndGetNoteState captured in update() (screen.js); _showHit
// and its drawNote body are now in note-renderer.js — search both.
const src = fs.readFileSync(highway3dJs, 'utf8') + '\n' + _h3dNoteRendererSrc;
assert.match(src, /_ndGetNoteState\s*=\s*\(bundle\s*&&\s*typeof\s+bundle\.getNoteState\s*===\s*['"]function['"]\)\s*\?\s*bundle\.getNoteState\s*:\s*null/, 'update() must capture bundle.getNoteState into _ndGetNoteState');
// Provider verdict wins: miss => not _showHit; otherwise provider state
// or the legacy fallback (`hit`) plus the pre-hit ghost window preview.
@@ -146,7 +152,7 @@ test('3D highway captures bundle.getNoteState and overrides legacy hit/miss with
});
test('3D highway captures _ndHasProvider via bundle.getNoteStateProvider (feedBack#254)', () => {
const src = fs.readFileSync(highway3dJs, 'utf8');
const src = fs.readFileSync(highway3dJs, 'utf8') + '\n' + _h3dNoteRendererSrc;
// Detect-mode behavior — verdict-window cull extension, chord-frame
// hold floor, and the smart drawNote cull — must be gated on a real
// provider being registered, not on the always-present bundle.