fix(claim): do not report accept when decision persist fails - #33
fix(claim): do not report accept when decision persist fails#33SebTardif wants to merge 1 commit into
Conversation
Accept waited for the clawtributors role PUT, then recorded the decision with a log-only catch. A database failure still DMed the claimant, announced the grant, and replied Claim accepted while the stored claim stayed pending. Await recordClaimDecision on the success path. On persist failure, reply with an error and skip the DM, announcement, and accepted reply. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed September 1, 2026, 8:03 AM ET / 12:03 UTC. ClawSweeper reviewWhat this changesThe PR makes the Discord claim-review Accept button return a recovery message and skip success notifications when saving the accepted decision fails. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 3 items remain Keep open: current main still logs a failed claim-decision write and proceeds with success notifications, while this focused patch stops those false-success effects. The implementation is sound on review, but the supplied proof remains mock-only. Priority: P2 Review scores
Verification
How this fits togetherHermit’s claim flow turns a Discord member’s request into a staff review message, then grants a role and records the staff decision. The Accept button updates Discord, persists the claim state, and only then notifies the claimant and review channel. flowchart TD
A[Claim request] --> B[Review message]
B --> C[Moderator selects Accept]
C --> D[Discord role grant]
D --> E[Claim decision store]
E -->|saved| F[Claimant and staff notifications]
E -->|failed| G[Moderator recovery reply]
Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the post-persistence success gate and add redacted evidence from a real claim-review path or approved production-path harness using the actual decision writer. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main catches the decision-write rejection and then executes the success effects; the PR’s focused test exercises both rejection and success branches with controlled dependencies. Is this the best way to solve the issue? Yes. Awaiting persistence and returning before success-only effects is the narrowest maintainable repair for this false-success path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 38f929b69cba. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
What Problem This Solves
Fixes an issue where a reviewer pressing Accept on a clawtributor claim would be told the claim was accepted even when saving the decision to the database failed. Discord could add the clawtributors role, then the bot still DMed the claimant, posted the announcement, and replied "Claim accepted" while the stored claim stayed pending.
That false success is worse than a failed Accept: staff think the review is finished, the claimant is told they are a clawtributor, and a later
/claimstill looks pending.Why This Change Was Made
Accept now waits for
recordClaimDecisionto finish. If the write fails, the review button replies with an error and does not DM, announce, or mark the review message accepted. The previous success copy is sent only after the decision is saved. Reject is unchanged.User Impact
Reviewers get an accurate private reply when Accept cannot save the decision. A database failure no longer looks like a completed clawtributor grant. Claimants are not told they were accepted while the claim record is still pending.
Evidence
Live
bunrun of/tmp/proof-hermit-F004.tsagainst upstreamsrc/server/claimServer.tsand this branch. The script calls the production Accept button (claimReviewComponents[0].run) after Discord's role PUT returns 204. One run makesrecordClaimDecisionthrowdatabase unavailable. The other run lets the write finish.Before this patch a failed decision write still printed Claim accepted, sent the DM, announced the grant, and patched the review message. After the patch a failed write prints Could not record claim and skips those success side effects. A successful write still prints Claim accepted.
Related: the swallow landed in #10 (
2b970350, 2026-05-12). Same false-success class as #26 (automod-bypass role changes) and #27 (inactivity-warn addMember).Real behavior proof
Behavior or issue addressed: Review-channel Accept reported Claim accepted, DMed the claimant, and announced the clawtributors grant even when saving the accepted decision failed, so the stored claim stayed pending.
Real environment tested: macOS 26.6.1 Darwin 25.6.0 arm64, Node v26.7.0, bun 1.3.14, patched checkout
/tmp/oc-pr-hermit-F004onfix/f004-claim-persist-error(base72b5de1).Exact steps or command run after this patch:
Evidence after fix: terminal output from the patched Accept handler:
Observed result after fix: A failed decision write now replies Could not record claim and does not DM, announce, or patch the review message. A successful write still replies Claim accepted and still DMs, announces, and patches.
What was not tested: A live Discord review-channel click against production D1. Discord role PUT was stubbed to 204 so the persist path is the only failure.
Summary
Accept no longer treats a swallowed
recordClaimDecisionerror as a completed grant. Persist is awaited on the success path. Persist failure replies with an error.