2.4 KiB
2.4 KiB
id, title, status, assignee, created_date, updated_date, labels, dependencies, references, modified_files, parent_task_id, priority, ordinal
| id | title | status | assignee | created_date | updated_date | labels | dependencies | references | modified_files | parent_task_id | priority | ordinal | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ML-169.3 | Phase 2: PubSub subscription lifecycle audit | Done | 2026-05-08 08:59 | 2026-05-19 08:50 |
|
|
|
ML-169 | medium | 5000 |
Description
Audit all PubSub subscribe/unsubscribe pairs for correctness. Verify no stale subscriptions or double-subscription risks.
Pre-flagged concern: ListeningStats.subscribe() is called in mount by StatsLive.Index and ScrobbledTracksLive.Index but never unsubscribed. Phoenix.PubSub monitors PID for auto-cleanup, but double-subscription on LiveView reconnect is possible and needs verification.
Acceptance Criteria
- #1 Records.subscribe/1 and Records.unsubscribe/1 call sites audited — confirmed only called via manage_subscription/2 in Show LiveViews
- #2 manage_subscription/2 verified correct across all navigation paths (direct URL, browser back/forward, push_navigate, push_patch)
- #3 ListeningStats.subscribe() double-subscription risk on reconnect evaluated — either confirmed safe by PID monitoring or flagged with fix
- #4 Termination cleanup verified: Phoenix.PubSub auto-cleans on PID death confirmed; any manual unsubscribe gaps documented
- #5 Records.notify_update/1 broadcast sites audited against intended behavior (coordinates with Phase 3 worker audit)
- #6 Findings report written as a Backlog.md document with file:line references, severity ratings, and fix recommendations
Implementation Notes
Audit complete. Report written at docs/audits/phase2-pubsub-lifecycle/doc-25.
Key findings:
- 27 call sites across subscribe, unsubscribe, broadcast, and consumer handle_info verified
- All 8 subscribe sites have cleanup coverage (explicit unsubscribe or PID-death auto-clean)
- Pre-flagged ListeningStats.subscribe() double-subscription risk is a false positive: Phoenix.PubSub MapSet deduplicates per PID, and LiveView reconnect reuses the same PID within grace period
- No code changes required