Address review: sparse overrides, hfov clear, readout prune

Three fixes from PR review of the per-pane tuner:

- Sync no longer writes back. _syncAspectPanel dispatches synthetic input
  events to refresh slider labels; guard those with _aspectSyncing so the
  slider handler skips the write. Previously opening/switching a target
  populated a full override for every field (defeating sparse inherit) and
  spammed localStorage.

- Unchecking "Override held hFOV" on a pane target now clears the override
  key (via _aspectClearVal) so the pane re-inherits the base value, instead
  of pinning hfovDeg:null in the override. On the base target it still sets
  the explicit auto (null).

- _aspectPrunePanes now prunes the matching __h3dAspectReadout slot and drops
  a dangling __last, so the readout cache can't grow unbounded as songs and
  arrangements churn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: topkoa <topkoa@gmail.com>
This commit is contained in:
topkoa
2026-07-01 02:27:01 -04:00
co-authored by Claude Opus 4.8
parent 5ef163e9f9
commit 9f914770c6
2 changed files with 80 additions and 17 deletions
+28
View File
@@ -207,6 +207,34 @@ test('the target dropdown prunes dead panes and does not rebuild while focused',
'_aspectBuildTargets must skip rebuilding while the select is focused');
});
test('programmatic sync does not write back into the tune', () => {
// _syncAspectPanel dispatches synthetic input events to refresh labels; the
// slider handler must skip the write while syncing, else opening/switching a
// target would populate a full override for every field.
assert.match(src, /_aspectSyncing\s*=\s*true[\s\S]*?finally[\s\S]*?_aspectSyncing\s*=\s*false/,
'_syncAspectPanel must set/reset the _aspectSyncing guard');
assert.match(src, /if\s*\(\s*!_aspectSyncing\s*\)\s*_aspectWriteVal\(\s*f\.k\s*,/,
'the slider input handler must skip the write while syncing');
});
test('unchecking hfov override clears a pane override key (re-inherits base)', () => {
assert.match(
src,
/function\s+_aspectClearVal\s*\(\s*k\s*\)[\s\S]*?delete\s+ov\[k\][\s\S]*?delete\s+m\[\s*_aspectEditTarget\s*\]/,
'_aspectClearVal must delete the pane override key (and empty object)',
);
assert.match(src, /else\s+_aspectClearVal\(\s*'hfovDeg'\s*\)/,
'unchecking the hfov override must call _aspectClearVal');
});
test('pruning drops the matching readout slot and a dangling __last', () => {
assert.match(
src,
/delete\s+reg\[k\]\s*;[\s\S]*?delete\s+ro\[k\]\s*;\s*if\s*\(\s*ro\.__last\s*===\s*k\s*\)\s*delete\s+ro\.__last/,
'_aspectPrunePanes must prune the readout cache alongside the registry',
);
});
test('the panel has a dismiss (close) control', () => {
assert.match(
src,