Cover current delete behavior across LiveView index and show paths, and strengthen existing delete tests with persistence assertions.\n\nValidation: mise run dev:precommit
6.1 KiB
id, title, status, assignee, created_date, updated_date, labels, dependencies, references, documentation, modified_files, parent_task_id, priority, ordinal
| id | title | status | assignee | created_date | updated_date | labels | dependencies | references | documentation | modified_files | parent_task_id | priority | ordinal | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ML-169.10.1 | Add baseline delete coverage for current LiveView paths | Done |
|
2026-05-20 16:31 | 2026-05-20 16:37 |
|
|
|
|
ML-169.10 | medium | 34000 |
Description
Add focused test coverage for current deletion behavior without implementing the async optimistic UI changes from ML-169.10. This task covers the three stream-backed index paths called out in ML-169.10 and verifies whether other existing user-facing deletion paths lack tests. Scope is limited to tests for current behavior; production delete handlers should not be changed here unless a test reveals an existing broken path that cannot be tested as-is.
Acceptance Criteria
- #1 Collection index delete is covered by a LiveView test that removes the record from the page and verifies the record is deleted through the Records context.
- #2 Wishlist index delete is covered by a LiveView test that removes the record from the page and verifies the record is deleted through the Records context.
- #3 Scrobbled tracks index delete is covered by a LiveView test that removes the track from the page and verifies the track is deleted through ListeningStats.
- #4 Existing user-facing delete handlers are audited for missing coverage, and any untested current-behavior paths found in that audit receive focused tests or are documented as intentionally out of scope.
- #5 Existing delete tests that only assert UI removal are strengthened with persistence assertions where practical.
- #6 Focused tests for the touched delete paths pass.
Implementation Plan
Implementation Plan
-
Add baseline LiveView delete tests for the three ML-169.10 stream-backed index paths without changing production code:
test/music_library_web/live/collection_live/index_test.exstest/music_library_web/live/wishlist_live/index_test.exstest/music_library_web/live/scrobbled_tracks_live/index_test.exs
-
Audit current user-facing delete handlers for missing deletion tests. Based on the initial scan, add focused current-behavior tests for untested deletion paths in:
test/music_library_web/live/collection_live/show_test.exstest/music_library_web/live/wishlist_live/show_test.exstest/music_library_web/live/artist_live/show_test.exstest/music_library_web/live/record_set_live/index_test.exs
-
Strengthen existing UI-only deletion tests with persistence assertions where practical:
test/music_library_web/live/online_store_template_live/index_test.exstest/music_library_web/live/scrobble_rules_live/index_test.exs
-
Run focused tests for the touched files, then update the task with modified files, audit notes, and checked acceptance criteria.
Implementation Notes
Audited current deletion coverage by scanning user-facing delete handlers and existing delete tests. Added baseline coverage for the three ML-169.10 stream-backed index paths: collection index, wishlist index, and scrobbled tracks index. Added current-behavior coverage for untested delete paths found in collection show, wishlist show, artist record list deletion, and record set index deletion. Strengthened existing UI-only delete tests for online store templates, scrobble rules, and record set show deletion with persistence assertions. Also strengthened Records.delete_record/1 to assert the record is actually gone while preserving the PruneArtistInfo enqueue assertion.
Did not add async success/error/exit handle_async tests from ML-169.10 because those paths do not exist yet; adding them would require implementing the async optimistic UI issue, which is intentionally out of scope for this task.
Final Summary
Added baseline test coverage for current delete behavior without changing production delete handlers.
Covered the three ML-169.10 stream-backed index paths: collection index record deletion, wishlist index record deletion, and scrobbled tracks deletion. Also covered additional untested current user-facing delete paths found during the audit: collection show, wishlist show, artist record list deletion, and record set index deletion. Strengthened existing delete tests for online store templates, scrobble rules, record set show deletion, and Records.delete_record/1 so they assert persisted deletion through context lookups.
Validation: mix test --max-failures 5 test/music_library/records_test.exs test/music_library_web/live/collection_live/index_test.exs test/music_library_web/live/wishlist_live/index_test.exs test/music_library_web/live/scrobbled_tracks_live/index_test.exs test/music_library_web/live/collection_live/show_test.exs test/music_library_web/live/wishlist_live/show_test.exs test/music_library_web/live/artist_live/show_test.exs test/music_library_web/live/record_set_live/index_test.exs test/music_library_web/live/record_set_live/show_test.exs test/music_library_web/live/online_store_template_live/index_test.exs test/music_library_web/live/scrobble_rules_live/index_test.exs passed with 115 tests.