Files
music_library/backlog/completed/ml-169.4 - Phase-1-Async-message-audit-LiveComponent-→-Parent-handle_info-coverage.md
T
Claudio Ortolina c537ea0d21 Backlog cleanup
2026-05-20 13:15:11 +01:00

4.0 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, references, parent_task_id, priority, ordinal
id title status assignee created_date updated_date labels dependencies references parent_task_id priority ordinal
ML-169.4 Phase 1: Async message audit (LiveComponent → Parent handle_info coverage) Done
2026-05-08 08:59 2026-05-19 08:50
audit
ready
audits/phase1-async-message-coverage
ML-169 medium 3000

Description

Audit every LiveComponent message producer against its parent LiveView's handle_info clauses. Identify any missing or dead handlers.

Pre-flagged concern: the Release component renders in CollectionLive.Show with on_release_loaded={:release_loaded}, but CollectionLive.Show has no handle_info({:release_loaded, _}) clause. Needs investigation — is this a dead message or a missing handler?

Acceptance Criteria

  • #1 Every send(self(), ...) call site in lib/music_library_web/components/ matched against handle_info in its consumer LiveViews
  • #2 Release component's {:release*loaded, *} message traced end-to-end in CollectionLive.Show context — either confirmed harmless or flagged as bug
  • #3 All 11 message-producing components verified: RecordForm, AddRecord, Chat, Release, ArtistLive.Form, RecordSetLive.Form, RecordSetLive.RecordPicker, ScrobbleRulesLive.Form, ScrobbledTracksLive.Form, OnlineStoreTemplateLive.Form, ScrobbleRulePicker
  • #4 Any send/2 calls using non-{MODULE, _} patterns found and verified
  • #5 Findings report written as a Backlog.md document with file:line references, severity ratings, and fix recommendations

Implementation Notes

Audit Execution Notes

Method

  • Grepped all send(self(), ...) call sites in lib/music_library_web/components/ and lib/music_library_web/live/ (excluding test files)
  • Grepped all handle_info clauses in lib/music_library_web/live/
  • Cross-referenced every send(self()) call site against parent LiveView handle_info clauses
  • Verified component render locations to confirm the consumer LiveView is the correct parent
  • Verified all module aliases match (e.g., AddRecord = MusicLibraryWeb.Components.AddRecord)

Pre-flagged concern: Release component in CollectionLive.Show

RESULT: HARMLESS — The notify_release_loaded/2 function in release.ex checks socket.assigns[:on_release_loaded]. When nil (CollectionLive.Show doesn't set it), the function returns :ok without calling send/2. No dead message, no missing handler. The Release component is rendered at line 304 in CollectionLive.Show with show_print?={true} and timezone={@timezone} but no on_release_loaded attribute, which is intentional.

Key findings

  • 11/11 components fully verified with 0 missing handlers
  • 3 non-MODULE patterns found, all verified safe
  • Release component's dynamic tag pattern works but could benefit from type-safe refactoring (low priority)
  • RecordSetLive.Show correctly only handles :updated since it renders Form only in :edit mode

Full report at @audits/phase1-async-message-coverage

Final Summary

Result: PASS — No missing handlers or dead messages found

Coverage

  • 14 send(self(), ...) call sites across 11 components all matched to corresponding handle_info clauses
  • 0 missing handlers, 0 dead messages
  • 3 non-{__MODULE__, _} patterns all verified safe:
    1. Release component dynamic tag — safe, nil-guarded
    2. ScrobbleLive.Index self-send — has matching handler
    3. ShowToast hook — standard LiveView attach_hook pattern

Pre-flagged concern resolved

Release component in CollectionLive.Show: HARMLESS. The notify_release_loaded/2 checks socket.assigns[:on_release_loaded] and skips sending when nil. CollectionLive.Show intentionally doesn't set on_release_loaded.

Full report

Documented at audits/phase1-async-message-coverage with file:line references, severity ratings, and all 11 components verified.