2.7 KiB
2.7 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.1 | Phase 3: Concurrent state change safety audit | Done | 2026-05-08 08:59 | 2026-05-19 08:50 |
|
|
|
ML-169 | medium | 4000 |
Description
Audit whether background Oban worker record mutations are safely reflected in LiveView state without data corruption or stale UI.
Key risks to investigate:
- Worker-broadcast consistency: do all record-modifying workers call Records.notify_update/1?
- Form edit + background update race: editing in RecordForm modal while worker updates record
- Double-update handling: two workers updating same record simultaneously
Acceptance Criteria
- #1 Every record-modifying Oban worker audited for notify_update/1 call after success (RefreshCover, PopulateGenres, GenerateRecordEmbedding, RecordRefreshMusicBrainzData, ImportFromMusicbrainzRelease, ImportFromMusicbrainzReleaseGroup, all RecordAll* batch workers)
- #2 Workers that do NOT modify records confirmed as correctly NOT broadcasting (PruneAssets, ApplyScrobbleRules, all ArtistRefresh*, etc.)
- #3 Form edit + background update race evaluated: trace what happens when RecordForm holds stale @record assign while worker broadcasts {:update, record} to parent Show page
- #4 Double-update race evaluated: confirm both handle_info calls apply safely (workers touch different fields, second wins)
- #5 ArtistLive.Show confirmed as intentionally not handling {:update, record} (artist updates use ArtistLive.Form → {:saved, artist_info} path)
- #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/phase3-concurrent-state-safety/doc-26.
Key findings:
- All 8 record-modifying workers correctly broadcast notify_update or broadcast_index_changed
- 18 non-record workers confirmed as correctly NOT broadcasting
- MEDIUM finding: form edit + background update race — handle_info({:update, record}) overwrites @record during :edit. Recommended fix: add live_action guard to both Show LiveViews.
- Double-update race is SAFE: Ecto changesets only UPDATE SET changed fields, SQLite serializes writes
- ArtistLive.Show confirmed intentionally not handling {:update, record}