fix(h3d-carve-15): resolve Creed r1 F1/F2/F3 + camera import + smoke tests

F1: return { update, _prewarmStatic, _prewarmChart } from createRenderer;
    screen.js destructures all three (callers at :7377/:7461 were getting undefined).

F2: _applyNoteCamTargets read cameraLockLow/cameraLockZoom as free variables;
    replaced with getCameraLockLow() / getCameraLockZoom() getter calls.

F3: add dZ, renderOrderForLayerAtZ to geometry.js import; DI TS, S_BASE,
    FRET_LABEL_GOLD_HEX, FRET_LABEL_IDLE_HEX as shorthands from screen.js.

Camera import fix: camera.js only exports createCamera; remove the broken
    import of lookaheadBootstrapTime/ComputeFretBounds/TargetWorldX from
    camera.js (caused SyntaxError on module load); DI them as shorthands
    from screen.js createCamera() destructure at line 6755.

DI count: 177 → 184 (+7 shorthands).

Tests: 6 new execution-readiness guards (17-22) in highway_3d_renderer.test.js,
    each RED at 7180eff and GREEN at this tip. Suite 1402/1403 (pre-existing #46).

ESLint gate: Creed F1/F2/F3 names cleared; 160 remaining no-undef identifiers
    documented in hive/plans/h3d-cut15-creed-fix.md (categories B-G: deferred
    screen.js consts/fn-refs and renderer-internal closure state — carve-15b).

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-06 00:23:32 +02:00
co-authored by Claude Sonnet 4.6
parent 7180eff05d
commit d475899c5a
3 changed files with 110 additions and 18 deletions
+3 -1
View File
@@ -6847,7 +6847,7 @@ import { createRenderer } from './src/renderer.js'; // h3d-carve-15
// extracted to src/renderer.js (createRenderer factory).
// HONEST GAPS: _prewarmStatic/_prewarmChart need ren.compile() — documented
// in renderer.js with ponytail: comments.
const { update } = createRenderer({
const { update, _prewarmStatic, _prewarmChart } = createRenderer({
// ── Consts ─────────────────────────────────────────────────────
K, NFRETS, NW, NH, AHEAD, BEHIND, S_GAP,
CAM_FOCUS_BLEND_RATE,
@@ -6859,6 +6859,7 @@ import { createRenderer } from './src/renderer.js'; // h3d-carve-15
INLAY_LABEL_FRETS,
GHOST_HOLD_AFTER_ONSET,
CHORD_FRAME_RIM_MIN, CHORD_FRAME_RIM_FRAC_H,
TS, S_BASE, FRET_LABEL_GOLD_HEX, FRET_LABEL_IDLE_HEX,
// ── Fn-refs ─────────────────────────────────────────────────────
sY, xFret, xFretMid, fretLabelScaleForFret, pbBeg, pbEnd, pbReportTick,
hwyFirstRelevantFrettedTime, _syncOpenStringPitchLabels, txtMat, _setLabelMap,
@@ -6866,6 +6867,7 @@ import { createRenderer } from './src/renderer.js'; // h3d-carve-15
drawNote, drawArpBrackets, chordHarmonyLabels,
// createCamera outputs:
camUpdate,
lookaheadBootstrapTime, lookaheadComputeFretBounds, lookaheadTargetWorldX,
// createArp outputs:
chordWireHighDensity, chordTemplateLabel, chordTemplateMarkedArpeggio,
chordHandShapeArpeggioHint,
+6 -9
View File
@@ -4,12 +4,7 @@
// VERBATIM-MOVE rule: function bodies moved exactly; only DI rewires applied.
// Call-argument fidelity gate: every moved call verified against baseline.
import { lowerBoundT, camBaseDistU, camLowFretPullbackU } from './geometry.js';
import {
lookaheadBootstrapTime,
lookaheadComputeFretBounds,
lookaheadTargetWorldX,
} from './camera.js';
import { lowerBoundT, camBaseDistU, camLowFretPullbackU, dZ, renderOrderForLayerAtZ } from './geometry.js';
// ─────────────────────────────────────────────────────────────────────────────
export function createRenderer({
@@ -24,6 +19,7 @@ export function createRenderer({
INLAY_LABEL_FRETS,
GHOST_HOLD_AFTER_ONSET,
CHORD_FRAME_RIM_MIN, CHORD_FRAME_RIM_FRAC_H,
TS, S_BASE, FRET_LABEL_GOLD_HEX, FRET_LABEL_IDLE_HEX,
// camAhead, camTau: re-declared as let vars inside update() — not DI
// ── Stable fn-refs (shorthand) ────────────────────────────────────────
sY, xFret, xFretMid, fretLabelScaleForFret, pbBeg, pbEnd, pbReportTick,
@@ -32,6 +28,7 @@ export function createRenderer({
drawNote, drawArpBrackets, chordHarmonyLabels,
// createCamera outputs:
camUpdate,
lookaheadBootstrapTime, lookaheadComputeFretBounds, lookaheadTargetWorldX,
// arp.js outputs (from createArp destructure in screen.js):
chordWireHighDensity, chordTemplateLabel, chordTemplateMarkedArpeggio,
chordHandShapeArpeggioHint,
@@ -128,7 +125,7 @@ function lookaheadSmoothCamStep(dtSec, tgtXWorld, tgtSpanInt) {
// getPrevLockActive() from the returned value).
function _applyNoteCamTargets(wX, wSum, distMin, distMax, distGot,
camHystF, camDistHystF, skipDistHyst) {
const lockActive = cameraLockLow && (!distGot || distMax <= 12);
const lockActive = getCameraLockLow() && (!distGot || distMax <= 12);
if (lockActive) {
// Locked view: frets 0-12 fit in frame, with the peak
// low-fret bonus baked in so nut chords stay framed.
@@ -141,7 +138,7 @@ function _applyNoteCamTargets(wX, wSum, distMin, distMax, distGot,
// and MAX (furthest). Default 0.5 maps to ~1.0× so existing
// users see the same locked view as before this slider.
const lockZoomMul = CAM_LOCK_ZOOM_MIN +
(CAM_LOCK_ZOOM_MAX - CAM_LOCK_ZOOM_MIN) * cameraLockZoom;
(CAM_LOCK_ZOOM_MAX - CAM_LOCK_ZOOM_MIN) * getCameraLockZoom();
setTgtX(xFretMid(CAM_LOCK_CENTER_FRET));
setTgtDist((lockedBaseU + lockedBonusU) * K * lockZoomMul);
setPrevLowFretBonus(lockedBonusU);
@@ -3616,5 +3613,5 @@ function update(bundle) {
pbEnd(0);
pbReportTick();
}
return { update };
return { update, _prewarmStatic, _prewarmChart };
}