Submit a review atomically: update the card and append the log #28
Labels
No labels
area
auth
area
data
area
domain
area
infra
area
stats
area
study
area
tooling
area
ui
duplicate
future
kind
bug
kind
chore
kind
decision
kind
docs
kind
feature
kind
spike
kind
test
prio
blocker
risk
high
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nickkeers/first-thousand-words#28
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Objective: One action that grades a card, reschedules it, and writes the audit row — or
changes nothing at all.
Files:
lib/first_thousand_words/study/review_service.ex(or an Ash action with achange)lib/first_thousand_words/study.exSteps:
submit_review(deck, card, rating, opts)runs insideAsh.DataLayer.transaction/Repo.transaction.Scheduler.review/3, persist the new state,insert the
Review.client_review_idand unique-index it.Verify: a forced failure after the card update rolls back the card row (test asserts
unchanged state after a raised error).
Why high risk: double-submitting a review silently corrupts the schedule, and the damage is
invisible until the user notices words they know are being shown every day. Note that
config/config.exsalready opts intotransaction_rollback_on_error?: true— verify theinteraction with your implementation rather than assuming it.