feedBack/tests
Byron Gamatos 8d0e270345
refactor(app): carve the JUCE/desktop audio shims out of app.js (R3a) (#893)
* refactor(app): carve resume-session out of app.js (R3a)

static/js/resume-session.js (157) — the snapshot taken when you leave a song and the
pill that offers it back. Bodies VERBATIM. app.js 7,727 → 7,601.
Fifth slice out of the strongly-connected core. ONE hook (playSong) + a
currentFilename getter.

S.pendingResume JOINS THE CONTAINER — on demand, exactly as intended. app.js WRITES
it (playSong({ resume }) arms it; the song:ready listener consumes it) while this
module reads it, so it cannot be a plain export: an imported binding is read-only.
Same reason isPlaying is there. The container grows one field per carve that needs
it, never speculatively.

THE CONTRACT TEST CAUGHT THE MISSING HOOK, again on a path nothing executes:
"playSong is read by a module but never wired by app.js — it would throw at runtime".
Second time it has caught a real wiring gap the moment it appeared.

A REAL TRAP, worth remembering: I first did the S.pendingResume rewrite by feeding
acorn's identifier RANGES from node into python, and it corrupted the file
(`_pS.pendingResume null;`). **Acorn's offsets are UTF-16 code units; Python's string
indices are code points.** static/app.js contains emoji, so every offset past one
drifts. Do an AST-driven rewrite in the SAME language that produced the offsets.
`node --check` caught it; a silent version of that bug is very easy to imagine.

VERIFIED. A/B against origin/main in two browsers, real song: the window API
(resumeLastSession / _snapshotResumeSession / _readResumeSession /
_clearResumeSession), snapshot, read-back, and clear — IDENTICAL, zero page errors.
HONEST LIMIT: my probe never got the snapshot to actually PERSIST (there is a guard
beyond the 3s minimum position that a scripted playSong does not satisfy), so that
path is verified only as identical-to-main, not as observed-working. The real
coverage is tests/browser/resume-session.spec.ts, which drives the flow properly.

Zero harnesses broke. pytest 2396, node 1040/1040, ESLint 0 (no-cycle clean),
tailwind clean, Codex 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(app): carve the JUCE/desktop audio shims out of app.js (R3a)

static/js/juce-audio.js (994) — bodies VERBATIM. app.js 7,603 → 6,643.
THE LARGEST SINGLE SLICE of the whole carve phase: 960 lines, ~13% of what was left.

Three self-installing IIFEs:
  _installJuceEngineRoutingWatcher (444)  routes a song to the JUCE engine or HTML5 as
                                          the desktop output enters/leaves exclusive/ASIO
  _installRendererBusFeeder        (337)  feeds the highway renderer bus from whichever
                                          transport is actually running
  _installJuceAudioElementShim     (156)  patches audio.play/pause so the rest of the app
                                          keeps talking to the <audio> element while JUCE
                                          owns the transport

They EXPORT NOTHING — all three publish through `window.*` (_juceMode,
_reevaluateJuceRouting, _reevaluateRendererBus, …). So app.js needs only a
side-effect import plus the one binding it actually uses
(_resetJuceAudioShimChain, which the shim IIFE assigns).

THE ORDERING QUESTION, CHECKED RATHER THAN ASSUMED. Importing this module runs the
IIFEs EARLIER than before: imports evaluate ahead of app.js's body, and therefore
ahead of configureHost(). A hook read at IIFE-execution time would THROW. So I walked
the AST at IIFE-body depth to see what they actually touch when they run: nothing but
listener registration, and `audio.play`/`audio.pause` patching — and `audio` is itself
an imported module now. Verified in the browser: both are patched on the carved build
exactly as on main, which proves the shim installs correctly at its new, earlier point.
(Had I got this wrong, host.js throws loudly rather than silently misbehaving — which
is the whole reason it has no no-op defaults.)

VERIFIED. A/B against origin/main in two browsers: the entire window.* surface the
IIFEs publish (_juceMode, _juceOutputIsExclusive, _reevaluateJuceRouting,
_reevaluateRendererBus, _clearJuceRerouteMemo), audio.play/pause patched, a real song
loading and togglePlay driving the public mirror — IDENTICAL, zero page errors.

Harnesses: juce_engine_reroute (19 tests) + renderer_bus_feeder (13) slice the IIFEs by
signature — retargeted, and each sandbox gains a `host` object routed at its EXISTING
stubs so every assertion holds unchanged. test_plugin_runtime_idempotence is SPLIT: 3 of
its 4 source-asserts stayed in app.js, the sm.emit('song:resume') one moved.

pytest 2396, node 1040/1040, ESLint 0 (no-cycle clean), tailwind clean, Codex 0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 22:44:03 +02:00
..
browser feat(v3): DOM-virtualize the Songs grid (#636 item 3 stage 2) (#643) 2026-06-29 12:26:29 +02:00
fixtures
js refactor(app): carve the JUCE/desktop audio shims out of app.js (R3a) (#893) 2026-07-11 22:44:03 +02:00
plugins fix(tuner): anchor injectPlayerButton to a direct-child button (feedBack#800) 2026-07-07 09:54:06 +02:00
__init__.py
conftest.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_acoustid_match.py feat(enrichment): AcoustID audio-fingerprint identification (opt-in) (#759) 2026-07-05 00:17:43 +02:00
test_albums_view.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_appstate.py feat(server): add appstate.py, the router seam (R3) (#833) 2026-07-10 15:06:22 +02:00
test_art_candidates.py refactor(server): extract the album-art routes into routers/art.py (R3) (#862) 2026-07-11 11:56:53 +02:00
test_art_layer.py refactor(server): extract the album-art routes into routers/art.py (R3) (#862) 2026-07-11 11:56:53 +02:00
test_artist_alias.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_artist_page.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_artist_sort_title_order.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_audio_bundled.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_audio_effect_mappings.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_audio_local_path.py refactor(server): extract the media/file-serving routes into routers/media.py (R3) (#869) 2026-07-11 15:36:22 +02:00
test_audio.py
test_batch_user_meta.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_builtin_diagnostic_seed.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_builtin_starter_seed.py feat(library): add Star-Spangled Banner + Ode to Joy starter content (#744) 2026-07-03 22:58:39 +02:00
test_collections_api.py refactor(server): extract library + collections routes + the provider registry (R3) (#866) 2026-07-11 14:56:12 +02:00
test_context_menu_api.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_correlation_id.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_curated_album.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_demo_mode.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_diagnostics_bundle.py fix(tests): isolate plugin routes modules + redact .feedpak filenames (#736) 2026-07-03 13:01:07 +02:00
test_diagnostics_hardware.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_diagnostics_redact.py fix(tests): isolate plugin routes modules + redact .feedpak filenames (#736) 2026-07-03 13:01:07 +02:00
test_dlc_junction.py fix(library): serve art/load for songs mounted through a library junction (#766) 2026-07-05 00:15:50 +02:00
test_drums_lib.py
test_enrichment_plumbing.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_env_compat.py refactor(ui)!: remove the classic v2 shell — v3 is the only UI (R3a) (#871) 2026-07-11 16:33:03 +02:00
test_feedpak_extension.py refactor(server): extract the settings routes into routers/settings.py (R3) (#863) 2026-07-11 12:35:05 +02:00
test_field_overrides.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_gap_fill.py feat(v3 library): "Fix metadata" popup — per-song override + lock, cover picker, MusicBrainz + AcoustID (#777) 2026-07-05 21:09:38 +02:00
test_gp2midi.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_gp2notation.py fix: correctly import and notate multi-staff (piano/keys) tracks from GP8 (#692) 2026-07-02 08:40:20 +02:00
test_gp2rs_drums.py feat(drums): capture velocities alongside times in unmapped-percussion reporting (#808) 2026-07-07 23:58:49 +02:00
test_gp2rs_gpx.py fix(gpx): clamp partial final BCFS sector so GP6 .gpx import works (#749) 2026-07-05 00:20:31 +02:00
test_gp2rs.py fix(gp2rs): write beat times at 6-decimal precision so imported tempo matches Guitar Pro (#819) 2026-07-10 13:12:10 +02:00
test_gp_audio_sync.py
test_gp_autosync_warp.py feat(gp_autosync): piecewise time-warp helpers + refine_sync onset pass (#787) 2026-07-05 20:08:19 +02:00
test_group_filter_law.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_highway_3d_routes.py
test_highway_ws_authors.py refactor(server): extract the highway WebSocket into routers/ws_highway.py (R3) (#844) 2026-07-10 21:12:54 +02:00
test_highway_ws_instrument_routing.py refactor(server): extract the highway WebSocket into routers/ws_highway.py (R3) (#844) 2026-07-10 21:12:54 +02:00
test_highway_ws_notation.py refactor(server): extract the highway WebSocket into routers/ws_highway.py (R3) (#844) 2026-07-10 21:12:54 +02:00
test_library_filters.py feat(library): sort and badge by personal difficulty rating (#810) 2026-07-07 23:57:20 +02:00
test_library_keyset.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_library_providers.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_lift_keys_notation.py
test_logging_setup.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_loops_concurrency.py fix(loops): take the DB lock for the count+insert and the list read (#840) 2026-07-10 19:16:01 +02:00
test_loose_traversal.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_loosefolder.py
test_lyrics_transcribe.py
test_mb_enrichment.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_mb_match.py feat(enrichment): alias-aware scoring — auto-confirm non-Latin-primary artists (#772) 2026-07-05 01:11:38 +02:00
test_midi_import_drums.py feat(drums): capture velocities alongside times in unmapped-percussion reporting (#808) 2026-07-07 23:58:49 +02:00
test_midi_import.py fix(midi): guard non-positive division in the legacy inline tempo path (#805) 2026-07-07 10:27:45 +02:00
test_midi_tempo_map.py feat(midi): convert_midi_tempo_map — extract tempos, time signatures, beat grid (#796) 2026-07-07 10:27:17 +02:00
test_minigames_routes.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_notation_lib.py
test_notation_lift.py fix: correctly import and notate multi-staff (piano/keys) tracks from GP8 (#692) 2026-07-02 08:40:20 +02:00
test_notation_to_notes.py
test_packaging.py fix(build): move appstate.py + routers/ under lib/ so the desktop app ships them (#836) 2026-07-10 17:16:34 +02:00
test_parse_arrangement.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_playlist_cover_errors.py fix(playlists): split cover decode (400) from persist (500), unique temp, existence re-check (#842) 2026-07-10 20:16:22 +02:00
test_playlists_api.py refactor(server): extract the playlists routes into routers/playlists.py (R3) (#841) 2026-07-10 19:58:09 +02:00
test_plugin_manifest_contract.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_plugin_runtime_idempotence.py refactor(app): carve the JUCE/desktop audio shims out of app.js (R3a) (#893) 2026-07-11 22:44:03 +02:00
test_plugin_src_route.py R0: module-migration rails (src/ serving, live-edit cache, scriptType loading, governance) (#812) 2026-07-08 10:14:40 +02:00
test_plugins.py feat(plugins): full-screen (immersive) plugin screens via manifest opt-in (#590) 2026-06-25 00:02:16 +02:00
test_practice_suggestions.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_profile_api.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_profile_domains.py
test_progression_api.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_progression.py
test_safepath.py
test_scraper_options.py refactor(server): move the metadata-enrichment subsystem into lib/enrichment.py (R3) (#861) 2026-07-11 11:32:21 +02:00
test_settings_api.py refactor(server): extract the settings routes into routers/settings.py (R3) (#863) 2026-07-11 12:35:05 +02:00
test_settings_export_library_db.py refactor(server): extract the settings routes into routers/settings.py (R3) (#863) 2026-07-11 12:35:05 +02:00
test_settings_export.py refactor(server): extract the settings routes into routers/settings.py (R3) (#863) 2026-07-11 12:35:05 +02:00
test_settings_instrument.py settings: add host instrument profiles (#753) 2026-07-05 00:16:42 +02:00
test_sloppak_cent_offset.py
test_sloppak_cover_art.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_sloppak_drumtab_load.py
test_sloppak_feedpak_version.py feat(core): adopt feedpak_version — read on load + stamp on manifest writes (spec §4) (#530) 2026-06-20 21:59:04 +02:00
test_sloppak_file_traversal.py refactor(server): extract the media/file-serving routes into routers/media.py (R3) (#869) 2026-07-11 15:36:22 +02:00
test_sloppak_jsonc_load.py feat(core): read .jsonc data files (strip C-style comments) (feedpak-spec §8) 2026-06-20 14:10:04 -07:00
test_sloppak_keys_load.py
test_sloppak_notation_load.py
test_sloppak_original_audio_load.py feat(sloppak): expose full-mix original_audio alongside stems (#583) 2026-06-23 18:05:45 +02:00
test_sloppak_song_timeline_load.py
test_song_score.py
test_song_stats_api.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_song_user_meta.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_song.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_songmeta.py fix: Edit Metadata persists into .feedpak files (suffix gate predated the rename) (#725) 2026-07-02 20:51:57 +02:00
test_starter_suggestions.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_startup_status.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_tailwind_rebuild.py rename: slopsmith → feedBack, byron → got-feedBack (#537) 2026-06-23 11:03:01 +02:00
test_tones.py
test_tunings.py Serve exact MIDI notes from GET /api/tunings (tuningMidis) (#829) 2026-07-10 13:05:39 +02:00
test_version_endpoint.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_vocal_pitch.py
test_wanted_api.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_work_charts_api.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_work_grouping.py fix(tests): join background scan/enrich workers before closing the DB (#735) 2026-07-03 12:15:43 +02:00
test_ws_highway_disconnect.py fix(ws_highway): swallow a mid-stream WebSocketDisconnect quietly (#845) 2026-07-10 21:30:53 +02:00
test_xp.py