fix: sweep expired confirmations, codes, and invites on the reaper #171
No reviewers
Labels
No labels
kind
bug
kind
enhancement
wayfinder
grilling
wayfinder
map
wayfinder
prototype
wayfinder
research
wayfinder
task
workflow
needs-info
workflow
needs-triage
workflow
ready-for-agent
workflow
ready-for-human
workflow
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rosa/vernier!171
Loading…
Reference in a new issue
No description provided.
Delete branch "ops/sweep-expired-capabilities"
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?
Closes #160.
Confirmations, authorization codes, and invites were deleted only when
consumed (keyed by
identifier), so a capability that expired unredeemed wasnever reclaimed and its table grew for the life of the deployment — the same
Steady-State violation the session reaper (#159) addressed, at lower volume.
What changed
AppRepository::delete_expired_capabilities(now)— one sweep across thethree capability tables, returning the count removed.
DELETEs. Confirmations and codes go on a plainexpires_at < now(no retained terminal state — they're deleted on consume).Invite::status(now)so thetwo adapters stay in agreement.
main.rs) — folded into the existing session-cleanuptick (
session_reaper→expiry_reaper), so it drains on the same shutdownsignal and runs whether or not background jobs are enabled.
.sqlxoffline query cache for the three new queries.Invite handling
Unlike confirmations and codes, a redeemed or revoked invite is a
deliberate historical record. A blanket
expires_at < nowwould destroy it, sothe invite sweep is scoped to
expires_at < ? AND redeemed_at IS NULL AND revoked_at IS NULL— exactly the rowsInvite::statusclassifies asExpired. This is the faithful reading of the issue's problem statement("expired-but-never-redeemed"), narrower than its literal suggested fix.
Tests
A
both_adapters!conformance suite asserts expired-unconsumed rows arereclaimed, live rows and redeemed/revoked invites survive, and the returned
count is exact. Full suite,
clippy,fmt, andciall pass.