feat(core): working-tuning lifecycle — launch default, verified decay, idempotent re-injection + tests (working-tuning PR 9a)#669
Merged
Conversation
…, idempotent re-injection + tests (working-tuning PR 9a)
Hardens the host workingTuning capability (PR 1) with the "polish & safety"
lifecycle:
- Idempotent re-injection: a second load of the module no longer replaces the live
state with a fresh (empty) one — it early-returns once registered.
- Opt-in "launch tuning" default (setLaunchDefault/getLaunchDefault/clearLaunchDefault):
a per-instrument, localStorage-backed seed the player can opt into ("start me in
THIS tuning on app open"). Boot seeds from it when set, else /api/settings as before.
Off by default — a SEED only; the live tuning still resets on restart.
- Verified decay: on song:loading the current instrument's 'verified' provenance
decays to 'assumed' (offsets kept) — a per-string mic check is only trustworthy for
the context it was done in, so a stale 'verified' can never suppress a needed prompt.
Adds a state-machine smoke suite (tests/js/working_tuning_capability.test.js, 12/12):
defaults, per-instrument isolation, both-directions, verified-invalidation-on-retune,
decay-on-song-load, resetToDefault, launch-default set/seed/clear, idempotent
re-injection, the change event.
The opt-in UI + the mic-verify writer land with the tuner (PR 9b).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QbexxfTt8q2tAn436MqGWF
byrongamatos
force-pushed
the
feat/v3-working-tuning-lifecycle
branch
from
July 1, 2026 09:07
40bea32 to
38f7e83
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Working-tuning PR 9a (Phase E — polish & safety, capability half). Stacked on #658 → base
feat/host-working-tuning.What
Hardens the host
workingTuningcapability with the lifecycle pieces from the design's PR 9, plus the state-machine test suite the capability was missing.How
workingTuning.version === 1already exists. Previously theObject.freeze(...)assignment was unguarded, so re-running the source replaced the live state with a fresh (empty) one.setLaunchDefault/getLaunchDefault/clearLaunchDefault(per-instrument,localStorage-backed)._seedFromSettingsseeds from the launch default when one is set for the booting instrument, else/api/settings. Off by default — a SEED only; the live working tuning still resets on restart.song:loading, the current instrument'sverifiedprovenance decays toassumed(offsets kept). A choreographed per-string mic check is only trustworthy for the context it was done in, so a staleverifiedmust never suppress a needed prompt (fail toward re-checking).Test
tests/js/working_tuning_capability.test.js— 12/12 (node --test): defaults / per-instrument isolation / both-directions / verified-invalidation-on-retune / decay-on-song-load / resetToDefault / launch-default set+seed+clear / idempotent re-injection / the change event.Follow-up (PR 9b)
The opt-in UI (calling
setLaunchDefault) and the mic-verify writer (the choreographed per-string check that promotesassumed→verified) land with the tuner, on #660.🤖 Generated with Claude Code
https://claude.ai/code/session_01QbexxfTt8q2tAn436MqGWF