x402 icon indicating copy to clipboard operation
x402 copied to clipboard

Create logger.py for centralized logging utility

Open jessedydx opened this issue 2 months ago • 2 comments

Title feat(specs): clarify and implement idempotent retry semantics for /verify and /settle endpoints

Overview This PR addresses Issue #452 by explicating and codifying the idempotent retry behavior for the /verify and /settle endpoints within both the protocol specifications and reference implementation. Additionally, it adds clear documentation notes and backend logic to ensure repeated requests with the same payload do not produce duplicate transactions or side effects.

Changes *Updated protocol documentation (specs/rest.md, etc.) to define idempotent retry rules for /verify and /settle: For repeated requests with the same Payment Payload and Payment Requirements, the endpoint produces an identical response and does not register new effects.

*In the TypeScript example server: Enhanced /verify and /settle handlers to check for duplicate requests and respond with previous results, preventing reprocessing. Example usage of an “idempotency key” shown via a simple in-memory/store cache for repeat protection.

*Added unit tests: verified that repeated requests return the same result and do not repeat side effects. Extended documentation with a best practices section on idempotent retries for client/service implementers.

Testing All new and existing tests have passed in local Node.js environment.

Retried requests (due to client disconnect or timeout) result in a single processed action with the same response.

Risk Changes are backwards-compatible and do not affect existing functionality, but make the flow more robust. Tests show no unexpected side effects.

Additional Information References discussion: #452 Major logic changes are in isolated commits for easy review.

jessedydx avatar Oct 25 '25 22:10 jessedydx

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

cb-heimdall avatar Oct 25 '25 22:10 cb-heimdall

@jessedydx is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Oct 25 '25 22:10 vercel[bot]