Skip to content

fix(dashboard): retry pixel credits and stop silently swallowing payout failures - #198

Merged
0xQuerencia merged 3 commits into
mainfrom
fix/fail-loudly-on-pixel-credit-errors
Nov 9, 2026
Merged

0xQuerencia merged 3 commits into
mainfrom
fix/fail-loudly-on-pixel-credit-errors

Conversation

@0xQuerencia

Copy link
Copy Markdown
Collaborator

Issue

creditProjectPixels() logged database RPC errors but returned success. Approval and post-approval correction callers could continue and report a payout as completed when the credit never applied.

Change

  • The existing credit_project_pixels database RPC is idempotent: it applies the delta from the already-credited project amount, so bounded retries are safe.
  • Retry on returned SQL errors or thrown transient transport errors (up to three attempts with 100ms/200ms backoff).
  • If credit still fails, log the project ID and throw, so the caller does not proceed as though the payout settled.
  • Add unit tests for success, intermittent SQL error, thrown transport error, and permanent failure.

IMPORTANT LIMITATION

Approval state is updated before credits are issued. This PR improves failure detection but is NOT a full atomic approval-and-payout fix. If every credit attempt fails, the project can still remain approved without a payout. Full remediation requires a transactional approval/credit or a persistent reconciler with recorded payout snapshots; don't claim this patch closes that entire class.

No production balance adjustments or database writes were performed manually. CI pending.

Copilot AI balanced review requested due to automatic review settings November 9, 2026 19:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@0xQuerencia
0xQuerencia merged commit edc893e into main Nov 9, 2026
8 checks passed
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.

2 participants