Skip to content

fix(apotheke): guard want.rs and play_history single-row writes - #561

Merged
forkwright merged 1 commit into
mainfrom
fix/apotheke-write-guards
Jul 6, 2026
Merged

fix(apotheke): guard want.rs and play_history single-row writes#561
forkwright merged 1 commit into
mainfrom
fix/apotheke-write-guards

Conversation

@forkwright

Copy link
Copy Markdown
Owner

Two write-guard-consistency gaps the 29a97cc sweep missed (deep-audit).

Reconciled with #560: archon::remove_want (lost-approval want retraction) now maps NotFound → Ok, preserving its documented idempotency invariant now that delete_want is strict; normal callers still get NotFound.

Gate green (1875 tests); *_nonexistent_returns_not_found tests added.

Closes #538
Closes #552

…st zero-row match

Six single-row UPDATE/DELETE mutators in want.rs (update_want_status,
delete_want, update_release, delete_release, update_have_status,
delete_have) and three in play_history/mod.rs (end_session,
mark_scrobble_eligible, mark_scrobbled) discarded the query result and
returned Ok(()) even when zero rows matched, silently reporting success
for a write against a missing id/session. Route each through the shared
require_affected() helper (established in 29a97cc) so a zero-row match
returns DbError::NotFound instead.

archon MonitorService::remove_want (the lost-approval want retraction)
relies on delete_want being idempotent for an already-gone want, per the
trait's documented invariant. Now that delete_want returns NotFound on a
zero-row match, the retraction path maps NotFound to Ok(()) so retracting
a non-existent want stays a no-op success; a normal caller still receives
the stricter NotFound.

Closes #538
Closes #552

Gate-Passed: kanon 0.1.5 +stages:fmt,check,clippy,nextest,lint sha:fa80c7dd3407dd71c11d8adc5590cb904af96b84
@forkwright
forkwright merged commit 3277278 into main Jul 6, 2026
12 checks passed
@forkwright
forkwright deleted the fix/apotheke-write-guards branch July 6, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

write-guard: play_history session updates ignore zero-row matches write-guard: want.rs mutators ignore zero-row matches

1 participant