JamesReviewsMusic
JRM-14Wrap multi-step review writes in transactions
Description
There isn't a single transaction in the backend. Creating a review is 10+ sequential writes (album insert, genre creation and linking, related-genre strength bumps, album-artist links, per-track inserts and artist links, bookmark removal, artist score refresh, leaderboard updates). If anything fails partway, orphaned tracks, missing links and stale scores stay in the DB permanently. Editing and deleting reviews and the full score recalc have the same problem.
- Model methods accept an optional executor so they can run inside a transaction
- Wrap in db.transaction: createAlbumReview, updateAlbumReview, deleteAlbum, refreshArtists + leaderboard writes, recalculateAllArtistScores
- Existing integration tests should pass unchanged; add one that forces a mid-flight failure and asserts nothing was written
Sub-tickets
0No sub-tickets yet.
Links
No links.
Comments
0No comments yet.