soulsync/tests/metadata
Broque Thomas 30f017d1f0 Stop writing TRCK as "6/0" when album total_tracks is unknown
Discord report (netti93): downloaded album tracks were tagged with
TRCK = "6/0" instead of "6/13" when source data was incomplete. The
retag tool wrote correct "6/13" because core/tag_writer.py already
handled the case.

Trace: core/metadata/enrichment.py:105 formatted unconditionally as
f"{track_number}/{total_tracks}" and many album-dict construction
sites pass total_tracks: 0 (per types.py, 0 means "unknown" — not a
real count). That 0 propagated straight to disk.

Fix at the consumer boundary so every album-dict constructor stays
unchanged. Lifted to pure helper
core/metadata/track_number_format.py:format_track_number_tag that
drops the /N suffix when total is 0 / None / negative — emits just
"6" instead. Matches retag's behavior + ID3 spec convention (TRCK
can be "N" or "N/M"). MP4 trkn tuple gets the same treatment via
format_track_number_tuple returning (6, 0) per spec's "unknown
total" marker.

Wired into all three format-write sites in enrichment.py: ID3 (TRCK),
Vorbis (tracknumber), MP4 (trkn). When source data has correct
total_tracks (album downloads via the metadata-source pipeline,
retag flow), behavior unchanged — still writes "6/13".

16 boundary tests pin every shape: known total / zero total / none
total / none track / zero track / negative inputs / string coercion
/ unparseable strings / floats truncate.

Full suite: 3113 passed.
2026-05-14 15:25:16 -07:00
..
test_album_mbid_cache.py Fix album MBID inconsistency: detector + persistent release-MBID cache 2026-05-03 17:16:39 -07:00
test_album_type_normalization.py Pin type='track' / type='artist' collision case for album-type normalizer 2026-05-12 21:15:58 -07:00
test_artist_resolution.py Fix Soulseek downloads losing collab artist tags 2026-05-13 22:11:20 -07:00
test_artist_source_detail.py Move metadata helpers into package modules 2026-04-29 11:28:42 +03:00
test_artist_source_lookup.py Group metadata tests under tests/metadata 2026-04-27 19:54:44 +03:00
test_build_album_info_typed_path.py Migrate album-info builders to typed Album path 2026-05-03 22:53:12 -07:00
test_deezer_cover_url_upgrade.py Deezer cover-art download: fallback to original URL on CDN refusal 2026-05-10 18:29:36 -07:00
test_deezer_search_query.py Deezer search: free-text fallback when advanced query returns 0 2026-05-10 09:16:13 -07:00
test_deezer_track_cache_validity.py Fix Deezer contributors tagging silently dropping for cache-polluted tracks 2026-05-14 11:10:51 -07:00
test_discography_filters.py Skip already-owned tracks during download discography 2026-05-12 15:10:41 -07:00
test_discography_typed_path.py Migrate discography + quality scanner to typed Album path 2026-05-04 08:12:40 -07:00
test_enrichment_events.py Drop old per-service enrichment routes after registry cutover 2026-05-01 20:43:18 -07:00
test_image_url_normalization.py Move image URL normalization into metadata helpers 2026-05-02 22:02:36 +03:00
test_metadata_album_tracks.py Move metadata helpers into package modules 2026-04-29 11:28:42 +03:00
test_metadata_artist_image.py Move metadata helpers into package modules 2026-04-29 11:28:42 +03:00
test_metadata_cache.py Move profile Spotify cache into registry 2026-04-29 12:36:37 +03:00
test_metadata_cache_batch_lookup.py Move metadata API into package 2026-04-29 08:10:18 +03:00
test_metadata_discography.py Move metadata helpers into package modules 2026-04-29 11:28:42 +03:00
test_metadata_enrichment.py Fix album MBID inconsistency: detector + persistent release-MBID cache 2026-05-03 17:16:39 -07:00
test_metadata_gap_filler.py Fix: maintenance findings badge inflated when scan dedup-skipped 2026-05-04 08:55:13 -07:00
test_metadata_musicmap.py Move metadata helpers into package modules 2026-04-29 11:28:42 +03:00
test_metadata_registry.py Simplify service status and labels 2026-05-01 12:06:58 +03:00
test_multi_artist_tag_settings.py Fix Soulseek downloads losing collab artist tags 2026-05-13 22:11:20 -07:00
test_musicbrainz_search.py Group metadata tests under tests/metadata 2026-04-27 19:54:44 +03:00
test_relevance.py Fix Deezer search relevance — issue #534 2026-05-10 08:53:42 -07:00
test_runtime_bundle.py fix post-download tagging, and enable tagging for hifi 2026-05-02 07:50:12 -06:00
test_track_number_format.py Stop writing TRCK as "6/0" when album total_tracks is unknown 2026-05-14 15:25:16 -07:00
test_typed_metadata_types.py Add Qobuz + Tidal album converters 2026-05-03 22:30:19 -07:00