Skip to content

feat(x402-buyer): expose confirm-spend persistence failures#351

Draft
bussyjd wants to merge 1 commit intofeat/x402-pre-merge-followupfrom
feature/x402-confirm-spend-observability
Draft

feat(x402-buyer): expose confirm-spend persistence failures#351
bussyjd wants to merge 1 commit intofeat/x402-pre-merge-followupfrom
feature/x402-confirm-spend-observability

Conversation

@bussyjd
Copy link
Copy Markdown
Collaborator

@bussyjd bussyjd commented Apr 17, 2026

Summary

Adds an explicit buyer-side metric for successful requests whose consumed-auth state could not be persisted.

Why

Production-readiness testing found a live mismatch between:

  • payment_attempts_total
  • payment_success_total
  • auth_spent

A likely explanation is that ConfirmSpend() can fail after a successful upstream response, causing the live gauges to drift after reload. This PR makes that path directly observable.

What changed

  • added obol_x402_buyer_confirm_spend_failure_total
  • increment the metric when ConfirmSpend() fails after an upstream success
  • keep the request successful; this PR is observability-first, not a behavioral change
  • added a regression test using an unwritable state path to force the persistence failure path

Validation

  • go test ./internal/x402/buyer

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.

1 participant