fix(tuner): mic-verify stamps the tuning it actually checked + on-device test plan (#684)

Working-tuning follow-ups:

- Mic-verify used _state.currentSongOffsets for the 'verified' stamp, but for a
  MANUALLY-selected tuning (tuner opened off a song) that's a stale/different
  song's tuning — so verify could mark the WRONG tuning verified. It now derives
  the verified offsets from the tuning actually being checked (its target freqs;
  the player's reference pitch cancels in the ratio), so 'verified' always
  attaches to the tuning the player confirmed. Explicit offsets still win.

- Adds docs/working-tuning-on-device-tests.md: the checklist for the parts that
  can't be covered headlessly — the auto-open/gate flow, both-directions prompts,
  mic-verify detection, and the tuner-mic-vs-note_detect ASIO/exclusive-mode
  contention flagged in the design charrette.

Test: mic-verify with no explicit offsets / no song context derives the correct
offsets (Drop-D). 55 tuner tests green.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Byron Gamatos
2026-07-01 11:45:26 +02:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 2910a3c8cb
commit 96a84996a2
3 changed files with 92 additions and 2 deletions
+15
View File
@@ -717,6 +717,21 @@ test('mic-verify: all strings in-tune-and-stable promotes to verified (with the
assert.equal(sets[0].n.verifiedStrings.length, 6);
});
test('mic-verify: derives the verified offsets from the tuning being checked (no song context)', () => {
// A manually-selected tuning (no '_current' song) must still stamp the RIGHT offsets,
// derived from the freqs being verified — not a stale currentSongOffsets.
const sandbox = createTunerSandbox();
const sets = [];
sandbox.window.feedBack.workingTuning = { get: () => ({ offsets: [0, 0, 0, 0, 0, 0] }), set: (n, o) => sets.push({ n, o }) };
const api = sandbox.window._tunerAutoOpen;
const DROP_D_FREQS = [73.42, 110, 146.83, 196, 246.94, 329.63]; // drop-D guitar
assert.ok(api.verifyStart(DROP_D_FREQS)); // NO explicit offsets, no song context
for (const f of DROP_D_FREQS) { for (let i = 0; i < 8; i++) api.verifyFeed(f, 2); }
assert.equal(api.verifyState().complete, true);
assert.equal(sets.length, 1);
assert.deepEqual(Array.from(sets[0].n.offsets), [-2, 0, 0, 0, 0, 0]); // derived Drop D
});
test('mic-verify: an out-of-tune string never completes; cancel clears', () => {
const sandbox = createTunerSandbox();
sandbox.window.feedBack.workingTuning = { get: () => ({}), set() {} };