Commit Graph

299 Commits

Author SHA1 Message Date
Claudio Ortolina 2d8989a8d0 ML-169.8: keep latest record query synchronous
get_latest_record is a single fast ORDER BY LIMIT 1 query --
no reason to async-load it. Removes the <.async_result> wrapper
and the now-unnecessary render_async() from its test.
2026-05-25 09:42:14 +03:00
Claudio Ortolina f347f56218 ML-169.8: reduce Stats mount sync queries to 3
Move 7 non-critical queries out of synchronous mount into assign_async
and start_async tasks with skeleton loading placeholders.

Only scalar badge counters (collection count, wishlist count, scrobble
count) remain synchronous. All async sections use <.async_result> with
loading and failed slots. Scrobble activity preserves LiveView streams
via handle_async. On-this-day date changes use AsyncResult.ok/2.
2026-05-25 09:31:43 +03:00
Claudio Ortolina 27d3a9f285 Try and reduce test flakiness 2026-05-23 06:56:52 +01:00
Claudio Ortolina 3f2e5f2e27 ML-169.10: drop socket-internals delete tests
Remove 12 unit tests that accessed socket internals via :sys.get_state
and called handle_async directly — these leak implementation details and
error/exit paths can't be reached through the DOM.

Keep the 3 integration delete tests that use pure DOM assertions: visit,
assert_has, click, refute_has, render_async, DB verification.
2026-05-22 16:27:42 +01:00
Claudio Ortolina b10be7ba3c ML-169.10: async delete actions with initial implementation 2026-05-22 16:19:54 +01:00
Claudio Ortolina ff3f809c2c ML-170: add enrichment fields to collection API
Add MusicLibrary.Collection.Enrichment module with batch scrobble, artist
country, and selected release enrichment from existing tables.

Wire enrichment into all four collection API endpoints (index, latest,
random, on_this_day). New JSON fields: scrobble_count, last_listened_at,
artist_country, selected_release.

Uses 3 fixed-count batch queries regardless of page size — no N+1 risk.
No schema changes or migrations required.
2026-05-22 13:21:14 +01:00
Claudio Ortolina d8a67cd475 ML-181: harden assets endpoints 2026-05-22 08:20:35 +01:00
Claudio Ortolina 5601d681e9 Make some tests async 2026-05-22 07:42:54 +01:00
Claudio Ortolina ca01e94d47 ML-194: add selective smoke coverage
Add smoke tests for bulk cron workers, CSP browser header, and
on_mount hooks (GetTimezone/StaticAssets). 9 tests across 4 files,
all passing alongside 135 existing related tests.
2026-05-21 12:01:32 +01:00
Claudio Ortolina ec6980eea0 ML-193: add secondary parser, search, and API coverage tests
Add ~80 focused tests across 10 files covering:

- Record set search by name, description, contained record title, artist name
- Navigation events for records, artists, record sets, links, and view-all actions
- MusicBrainz.ReleaseGroup parser (artist credits, included RGs, release IDs, types)
- MusicBrainz.ReleaseSearchResult edge cases (missing RG, unknown formats)
- LastFm.Session XML edge cases (non-subscriber, missing nodes)
- MusicLibrary.HttpError default status-kind mapping
- Discogs.API.ErrorResponse fallback message and retry-delay behavior
- ArtistRefreshWikipediaData {:cancel, :no_english_wikipedia} worker path
- StatsComponents grouped on-this-day records and anniversary labels
2026-05-21 10:45:29 +01:00
Claudio Ortolina 66fb688b2a Fix toasts not appearing for notes and barcode scan 2026-05-21 07:49:36 +01:00
Claudio Ortolina 2983313426 ML-192: add high value missing tests
- Record editing + cover search
- Barcode scan errors + cart editing
- Notes
- Scrobble rules application over set of tracks
- Image conversion
2026-05-21 06:38:02 +01:00
Claudio Ortolina 23960b5b23 ML-169.10.1: Add delete coverage
Cover current delete behavior across LiveView index and show paths, and strengthen existing delete tests with persistence assertions.\n\nValidation: mise run dev:precommit
2026-05-20 18:04:29 +01:00
Claudio Ortolina 73046bb0f5 ML-190: fix record subscription lifecycle 2026-05-19 12:10:34 +01:00
Claudio Ortolina e204e555bd ML-188: guard PubSub record updates during edit mode
Add live_action guard to handle_info({:update, record}) in both
CollectionLive.Show and WishlistLive.Show. When the user is editing,
background worker updates are skipped and a warning toast is shown
instead of overwriting the socket. Normal show-mode updates and
mismatched-ID no-ops are unchanged.

6 tests added covering all three code paths.
2026-05-19 11:38:42 +01:00
Claudio Ortolina 4ae55ea0ad Use negative assertion to debug CI failures 2026-05-17 21:34:00 +01:00
Claudio Ortolina 122c07836b ML-182.5: migrate blocked LiveView tests
Replace direct LiveView PID and isolated component test patterns with PhoenixTest-backed page flows while keeping narrow unwrap bridges where PhoenixTest cannot express the component interaction.

Precommit: mise run dev:precommit
2026-05-17 21:24:29 +01:00
Claudio Ortolina a630c58578 Once again, increase timeout due to CI performance 2026-05-16 22:41:50 +01:00
Claudio Ortolina 90ac4fa23a Extract LiveView async test helper 2026-05-16 22:27:46 +01:00
Claudio Ortolina 4fa05d6ad1 Make test wait longer due to CI performance 2026-05-16 22:16:09 +01:00
Claudio Ortolina 5212b8607e Reduce api medium cover size to 400px 2026-05-16 17:46:47 +01:00
Claudio Ortolina 9f5a26198f ML-182.4: convert tests to phoenix_test 2026-05-16 16:30:42 +01:00
Claudio Ortolina 07d65fe78f ML-182.3: finish wave-3 of conversion LiveViewTest to PhoenixTest 2026-05-16 15:23:53 +01:00
Claudio Ortolina b4710e10c8 ML-185.1: expose named cover sizes in collection API 2026-05-15 22:49:06 +01:00
Claudio Ortolina 8391cf275a ML-180: remove backup download feature
Delete ArchiveController, its routes, the maintenance UI backup
button, and the test file. Management scripts and Litestream
supersede this functionality.
2026-05-15 07:13:33 +01:00
Claudio Ortolina 73c469e83d ML-182.3: migrate scrobble rules tests to PhoenixTest 2026-05-15 07:00:15 +01:00
Claudio Ortolina 9eda49ed46 ML-182.3: migrate record_set/show tests to PhoenixTest 2026-05-15 06:47:25 +01:00
Claudio Ortolina bd09840443 ML-182.3: convert record_set_live/index_test to PhoenixTest 2026-05-15 06:31:50 +01:00
Claudio Ortolina 2237c7db20 ML-182.3: partial progress in conversion 2026-05-14 23:23:15 +01:00
Claudio Ortolina dda700ad96 ML-182: convert 4 test files to PhoenixTest only
Waves 1-2: scrobble_live/index, scrobbled_tracks_live/index, release_group_show, release_show. Dropped unwrap/2 bridges and page_title/1 usage. Search form tests use visit with query params. page_title tests use assert_has("title", ...).
2026-05-14 23:22:02 +01:00
Claudio Ortolina a59dd22a18 ML-168: broadcast index_changed event after background import
Import workers now broadcast :records_index_changed on
"records:index_changed" after successful import via
Records.broadcast_index_changed/0.

CollectionLive.Index and WishlistLive.Index subscribe to the
topic in mount/3 and reload their record streams on receipt,
with a live_action guard to skip reloads when the grid is
hidden behind a modal (:import, :barcode_scan).

IndexActions.handle_index_changed/1 refreshes total_entries
before reloading to keep the pagination bar accurate.
2026-05-14 17:15:06 +01:00
Claudio Ortolina ba62d54cc5 ML-177: implementation 2026-05-10 20:39:18 +01:00
Claudio Ortolina a3bc6d7cf3 ML-176.1: support search in collection api controller 2026-05-10 14:52:01 +01:00
Claudio Ortolina 621b35d824 Open universal search modal instantly via client-side JS
Replace phx-click server event with Fluxon.open_dialog for zero-latency
modal opening. The modal DOM is now always present (no :if conditional) so
it can be shown instantly; the server syncs state in the background.

Fix test selectors that now match the always-present modal form by scoping
to forms without phx-target (which the modal form always has).
2026-05-07 20:43:15 +01:00
Claudio Ortolina 0a9fafd35e Add micro_cover_url 2026-05-05 23:22:37 +01:00
Claudio Ortolina be76d0f214 Provide mini covers (150px) 2026-05-05 16:33:43 +01:00
Claudio Ortolina cccd28a9f9 ML-165: implementation 2026-05-05 13:43:18 +01:00
Claudio Ortolina 1ddef07bcc fix(api): handle non-integer error ids, clamp negative pagination params
- show/2: use case instead of bare Integer.parse match so
  /api/v1/errors/not-an-id returns 404 instead of crashing
- index/2: clamp limit to >= 1 and offset to >= 0 to prevent
  SQLite from treating negative values as unlimited
- Add 3 tests: non-integer id 404, negative limit/offset clamping
2026-05-04 14:17:45 +01:00
Claudio Ortolina 51bd24d5b4 ML-162: enable /api/v1/errors endpoint 2026-05-04 13:14:40 +01:00
Claudio Ortolina c489fde1cc ML-152: add /api/v1/ version prefix to all API routes 2026-04-30 11:57:43 +01:00
Claudio Ortolina f2839dfaf1 Test needs to be sync 2026-04-29 22:50:29 +01:00
Claudio Ortolina 252caf31ce ML-11: Improve performance of Telemetry.Storage with in-memory buffer 2026-04-24 10:30:28 +01:00
Claudio Ortolina 0784fc5e0c Fix page title for scrobble anything release page 2026-04-23 21:06:32 +01:00
Claudio Ortolina 1bd5707cb4 Fix page title for scrobble anything index and release group route 2026-04-23 21:06:12 +01:00
Claudio Ortolina 8911afad94 Add tests for Top Albums component 2026-04-23 16:41:44 +01:00
Claudio Ortolina c7c7e1fe4e Navigate from scrobble search to release-group page 2026-04-23 14:47:50 +01:00
Claudio Ortolina 0dcd6eab83 Replace /scrobble/:release_id with nested route 2026-04-23 14:39:26 +01:00
Claudio Ortolina d8041dc0dd Add /scrobble/:rg_id release-group page 2026-04-23 14:35:58 +01:00
Claudio Ortolina 4c48bda7b2 Refactor Release component to take release_id 2026-04-23 14:19:11 +01:00
Claudio Ortolina f7f38d580e Enable unaliased modules ex_slop check 2026-04-22 20:37:09 +01:00