ML-168.4: perform async messages audit
This commit is contained in:
+62
-10
@@ -1,18 +1,16 @@
|
||||
---
|
||||
id: ML-169.4
|
||||
title: "Phase 1: Async message audit (LiveComponent → Parent handle_info coverage)"
|
||||
status: To Do
|
||||
status: Done
|
||||
assignee: []
|
||||
created_date: "2026-05-08 08:59"
|
||||
updated_date: "2026-05-11 06:46"
|
||||
updated_date: "2026-05-19 06:35"
|
||||
labels:
|
||||
- audit
|
||||
- ready
|
||||
dependencies: []
|
||||
references:
|
||||
- lib/music_library_web/components/release.ex
|
||||
- lib/music_library_web/live/collection_live/show.ex
|
||||
- lib/music_library_web/live/scrobble_live/release_show.ex
|
||||
- audits/phase1-async-message-coverage
|
||||
parent_task_id: ML-169
|
||||
priority: medium
|
||||
---
|
||||
@@ -31,9 +29,63 @@ Pre-flagged concern: the Release component renders in CollectionLive.Show with `
|
||||
|
||||
<!-- AC:BEGIN -->
|
||||
|
||||
- [ ] #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
|
||||
- [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 -->
|
||||
|
||||
Reference in New Issue
Block a user