feedBack/tests
Byron Gamatos e729c44d5b
perf(paths): resolve the library root once, not on every path check (#966)
`Path.resolve()` is a filesystem call — it lstats every component of the path.
`_resolve_dlc_path` and `safe_join` both re-resolved their ROOT on every single
call, and those run once per song, per art fetch, per scanned row.

Found while profiling a 2-fps report: on a real 50,944-song library the server
was issuing ~23,500 stat/lstat calls per second, re-walking the same three
parent directories over and over, and burning ~50% of a core doing it. It is
worst exactly where big libraries live — the library was on an NTFS-3G (FUSE)
mount, where every stat is a userspace round trip through mount.ntfs-3g (itself
visible in top). The cost was the constant re-resolution, not the work.

A root is fixed for the life of the process, so resolve it once
(safepath.resolved_root, lru_cache). Measured, 5,000 lookups against a real
library path:

    before:  15,264 stat syscalls   (54.2 ms)
    after:       277 stat syscalls   ( 0.8 ms)     55x fewer

Containment is unchanged, which is the part that matters:
  - safe_join still resolves the CANDIDATE on every call — following its
    symlinks IS the zip-slip / traversal defence, so it is never cached. Only
    the server-owned root is.
  - _resolve_dlc_path keeps its lexical containment check (deliberately does not
    follow symlinks, so junction-mounted libraries keep working).

Tradeoff, documented on resolved_root: if a root's symlink is re-pointed at a
NEW target while the server runs, the old target stays in effect until restart.
Fine for a library path fixed at startup; the cache is keyed on the Path, so
switching library dir is a different key.

Tests: root resolved once across 500 lookups (the regression), a different root
is a different entry, and the containment contract re-pinned — traversal,
Windows drive-absolute, backslash, NUL, empty, and a symlink escaping the root
must still be refused. Full suite green.
2026-07-14 19:48:39 +02:00
..
browser test(highway): the R3c perf gate — measure the render loop before carving it (R3c) (#910) 2026-07-12 11:36:11 +02:00
fixtures
js feat(career): bundle the AXA club venue pack (career stage 2) (#963) 2026-07-14 16:54:08 +02:00
plugins feat(career): bundle the AXA club venue pack (career stage 2) (#963) 2026-07-14 16:54:08 +02:00
__init__.py
conftest.py refactor(server): carve the library scanner into lib/scan.py (R3b) (#901) 2026-07-12 01:26:02 +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
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 refactor(server): carve builtin-content seeding into lib/builtin_content.py (R3b) (#900) 2026-07-12 00:50:50 +02:00
test_builtin_starter_seed.py refactor(server): carve builtin-content seeding into lib/builtin_content.py (R3b) (#900) 2026-07-12 00:50:50 +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(demo): the janitor re-entry guard actually works now (#902) (#909) 2026-07-12 11:30:53 +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
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): carve the library scanner into lib/scan.py (R3b) (#901) 2026-07-12 01:26:02 +02:00
test_field_overrides.py feat(library): effective genre falls back to MusicBrainz enrichment (#949) 2026-07-13 16:53:06 +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
test_gp2notation.py
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
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_remote.py fix: remote transcription posts to /transcribe, not /align (stem-splitter#17) (#959) 2026-07-14 01:58:24 -04:00
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_migrate_full_mix_stem.py fix(sloppak): the full mix is a stem — drop the invented original_audio key (#946) 2026-07-13 12:22:42 -04: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
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
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_context_contract.py test(plugins): pin the plugin_context contract before carving server.py (R3b) (#898) 2026-07-12 00:29:48 +02:00
test_plugin_manifest_contract.py
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 fix(plugins): make a module plugin actually re-evaluate on reload (#879) (#897) 2026-07-12 00:19:59 +02:00
test_plugins.py test(plugins): pin the plugin_context contract before carving server.py (R3b) (#898) 2026-07-12 00:29:48 +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 refactor(server): carve builtin-content seeding into lib/builtin_content.py (R3b) (#900) 2026-07-12 00:50:50 +02:00
test_progression.py
test_resolved_root_cache.py perf(paths): resolve the library root once, not on every path check (#966) 2026-07-14 19:48:39 +02:00
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): carve the library scanner into lib/scan.py (R3b) (#901) 2026-07-12 01:26:02 +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
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_full_mix_load.py fix(sloppak): the full mix is a stem — drop the invented original_audio key (#946) 2026-07-13 12:22:42 -04:00
test_sloppak_jsonc_load.py
test_sloppak_keys_load.py
test_sloppak_notation_load.py
test_sloppak_song_timeline_load.py
test_sloppak_unpack_cache.py fix(sloppak): bound the unpack cache; add read_member_bytes() so callers stop unpacking whole songs (#950) 2026-07-13 17:13:08 +02:00
test_song_score.py
test_song_stats_api.py test(stats): prove seconds-only recency on a fresh row (#948) 2026-07-13 15:36:05 +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
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_spec_gate.py ci: cover gap-fill manifest key scans 2026-07-13 13:25:44 +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 refactor(server): carve demo mode into lib/demo_mode.py (R3b) (#903) 2026-07-12 01:32:46 +02:00
test_tailwind_rebuild.py
test_tailwind_runtime_path.py fix(tailwind): stop the dev server rewriting a tracked file (#911) (#918) 2026-07-12 13:25:16 +02:00
test_tones.py
test_tuning_provider_isolation.py fix(server): a raising tuning provider no longer takes down get_merged() for everyone (#899) (#904) 2026-07-12 01:25:08 +02:00
test_tunings.py Harden freqs_to_midis against NaN/Inf; badges read exact tuningMidis 2026-07-12 15:24:39 -05: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