93 lines
4.0 KiB
Markdown
93 lines
4.0 KiB
Markdown
---
|
|
id: ML-169.4
|
|
title: "Phase 1: Async message audit (LiveComponent → Parent handle_info coverage)"
|
|
status: Done
|
|
assignee: []
|
|
created_date: "2026-05-08 08:59"
|
|
updated_date: "2026-05-19 08:50"
|
|
labels:
|
|
- audit
|
|
- ready
|
|
dependencies: []
|
|
references:
|
|
- audits/phase1-async-message-coverage
|
|
parent_task_id: ML-169
|
|
priority: medium
|
|
ordinal: 3000
|
|
---
|
|
|
|
## Description
|
|
|
|
<!-- SECTION:DESCRIPTION:BEGIN -->
|
|
|
|
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?
|
|
|
|
<!-- SECTION:DESCRIPTION:END -->
|
|
|
|
## Acceptance Criteria
|
|
|
|
<!-- AC:BEGIN -->
|
|
|
|
- [x] #1 Every send(self(), ...) call site in lib/music_library_web/components/ matched against handle_info in its consumer LiveViews
|
|
- [x] #2 Release component's {:release*loaded, *} message traced end-to-end in CollectionLive.Show context — either confirmed harmless or flagged as bug
|
|
- [x] #3 All 11 message-producing components verified: RecordForm, AddRecord, Chat, Release, ArtistLive.Form, RecordSetLive.Form, RecordSetLive.RecordPicker, ScrobbleRulesLive.Form, ScrobbledTracksLive.Form, OnlineStoreTemplateLive.Form, ScrobbleRulePicker
|
|
- [x] #4 Any send/2 calls using non-{**MODULE**, \_} patterns found and verified
|
|
- [x] #5 Findings report written as a Backlog.md document with file:line references, severity ratings, and fix recommendations
|
|
<!-- AC:END -->
|
|
|
|
## Implementation Notes
|
|
|
|
<!-- SECTION:NOTES:BEGIN -->
|
|
|
|
## 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
|
|
|
|
<!-- SECTION:NOTES:END -->
|
|
|
|
## Final Summary
|
|
|
|
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
|
|
|
|
## 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.
|
|
|
|
<!-- SECTION:FINAL_SUMMARY:END -->
|