Skip to content

feat(tuner): mic-verify — promote working tuning assumed→verified via a per-string check (working-tuning PR 9b)#670

Merged
byrongamatos merged 2 commits into
mainfrom
feat/v3-tuner-mic-verify
Jul 1, 2026
Merged

feat(tuner): mic-verify — promote working tuning assumed→verified via a per-string check (working-tuning PR 9b)#670
byrongamatos merged 2 commits into
mainfrom
feat/v3-tuner-mic-verify

Conversation

@ChrisBeWithYou

Copy link
Copy Markdown
Contributor

Working-tuning PR 9b (Phase E — polish & safety, tuner / mic-verify half). Stacked on #660 → base feat/v3-tuner-uses-working-tuning. Completes the working-tuning series (PRs 1–9).

What

The choreographed per-string mic verification that promotes the working tuning assumedverified — the only thing that may claim verified (the audio-engine honesty rule from the design). The player plays each string; once every one reads in tune (±6¢) and holds stable for 8 frames, the tuner stamps provenance: 'verified' + verifiedStrings.

How

  • screen.js — a pure verify state machine (verifyStart / verifyFeed / verifyCancel / verifyState, exposed on the tuner API for testing) + _publishVerified (workingTuning.set({ verifiedStrings }, { provenance: 'verified' })). Cancels on tuner close.
  • ui.jsupdateUI feeds each processed frame (its matched target string + cents-off) into the session and reflects progress; a "Verify tuning" button + per-string ✓ + a status line, shown for a selected (non-free) tuning.

Pairs with 9a's lifecycle: a verified decays back to assumed on the next song:loading, so this is a per-session confidence boost, never a sticky claim.

Test

tests/js/tuner_auto_open.test.js +4 — 33/33 (node --test): all-strings-in-tune-and-stable → verified (with verifiedStrings); an out-of-tune string never completes; the in-tune streak resets on a drift; the API is exposed and it's the only place that stamps verified.

⚠ Needs an on-device pass

Only the state machine is headless-verified (synthetic frames). The real per-string mic detection and the button/progress flow need a device — verify a real guitar completes the flow and that the ±6¢ / 8-frame thresholds feel right.

🤖 Generated with Claude Code
https://claude.ai/code/session_01QbexxfTt8q2tAn436MqGWF

@byrongamatos
byrongamatos force-pushed the feat/v3-tuner-uses-working-tuning branch from 6cf14be to 36fd8d1 Compare July 1, 2026 07:23
ChrisBeWithYou and others added 2 commits July 1, 2026 11:24
… via a per-string check (working-tuning PR 9b)

Adds the choreographed per-string mic verification the design reserved for
'verified' provenance (audio-engine's honesty rule — nothing else may claim it):
the player plays each string, and once every one reads in tune (±6 cents) and
holds stable for 8 frames, the tuner stamps the working tuning
provenance:'verified' + verifiedStrings via workingTuning.set.

- screen.js: a pure verify state machine (verifyStart/verifyFeed/verifyCancel/
  verifyState, exposed on the tuner API) + the set-verified writer; cancels on close.
- ui.js: updateUI feeds each processed frame (matched string + cents) into the
  session; a "Verify tuning" button + per-string progress + status, shown for a
  selected (non-free) tuning.

Pairs with the 9a lifecycle: a 'verified' decays back to 'assumed' on the next
song load, so mic-verify is a per-session confidence boost, never a sticky claim.

Tests: tests/js/tuner_auto_open.test.js +4 (all-strings->verified, out-of-tune
never completes, streak resets on drift, API exposed / only it claims verified) —
33/33. The state machine is headless-verified with synthetic frames; the real
per-string mic detection + the button flow need an on-device pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QbexxfTt8q2tAn436MqGWF
…icter streak (PR #670 review)

Review fixes for mic-verify (working-tuning PR 9b):

- 'verified' could attach to STALE offsets: _publishVerified stamped provenance
  without writing offsets, so the slot's pre-tuning offsets got marked verified.
  verifyStart(targets, offsets) now captures the confirmed tuning's offsets, and
  _publishVerified writes offsets + stringCount + instrument + referencePitch +
  verifiedStrings ATOMICALLY with provenance:'verified' into the selected slot
  (and refuses to stamp verified with no concrete offsets).
- The assumed publish-on-clear immediately clobbered a just-earned 'verified':
  disable() now skips it when a mic-verify wrote verified this session
  (_verifiedPublished).
- The per-string streak could accumulate across silence / wrong-string frames.
  verifyFeed now requires CONSECUTIVE in-tune frames: the one confirmed string
  advances, every other unfinished string resets each frame.
- A mid-verify tuning change (song switch) left stale captured offsets; verify is
  now cancelled in _syncCurrentTuning when the song tuning changes.

Tests: verify writes the confirmed offsets (not stale); source-guard for the
no-clobber path. 47 tuner + 77 tuner/capability tests green. Codex-reviewed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@byrongamatos
byrongamatos force-pushed the feat/v3-tuner-mic-verify branch from 5cf8d02 to 988b7fc Compare July 1, 2026 09:33
@byrongamatos
byrongamatos changed the base branch from feat/v3-tuner-uses-working-tuning to main July 1, 2026 09:33
@byrongamatos
byrongamatos merged commit 2910a3c into main Jul 1, 2026
@byrongamatos
byrongamatos deleted the feat/v3-tuner-mic-verify branch July 1, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants