Skip to content

fix(x402scan): detect testnet-only origins and surface per-endpoint 422 detail - #769

Merged
bussyjd merged 1 commit into
integration/v0.14.0-rc0from
fix/x402scan-network-diagnostics
Jul 16, 2026
Merged

fix(x402scan): detect testnet-only origins and surface per-endpoint 422 detail#769
bussyjd merged 1 commit into
integration/v0.14.0-rc0from
fix/x402scan-network-diagnostics

Conversation

@bussyjd

@bussyjd bussyjd commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Canary402 field report — issues 0/10 (x402scan rejects testnet resources with a misleading generic message)

x402scan indexes mainnet resources only; registering an origin whose offers price on Base Sepolia failed with x402scan's generic "no valid paid resources", which obol relayed as "no endpoint answered with a live x402 402 challenge" — factually wrong (the endpoints answered 402 fine) and pointing the operator away from the real cause. Per-endpoint failure detail returned by the registry on the 422 path was also silently dropped.

Fix

  • internal/x402/chains.go: Testnet flag on the existing chain registry + IsTestnetCAIP2 helper (single source of truth, no second hardcoded list).
  • Preflight (same non-fatal pattern as preflightOpenAPI) decodes x-payment-info.accepts[].network across paid paths; when every network is a testnet it warns before submitting, and the ErrNoValidResources failure message becomes an accurate "offers price on (testnet) — x402scan indexes mainnet resources only; switch payment network to a mainnet and re-register" (generic text kept as fallback for genuinely-no-402 cases).
  • internal/x402scan/client.go: the 422 error path now carries failedDetails (per-endpoint url/error/status), symmetric with the 200 partial-failure path.

Tests: golden-fixture 422-with-failedDetails, testnet-detection preflight test, chains table test. go test ./cmd/obol/... ./internal/x402/... ./internal/x402scan/... green.

Part of the Canary402 field-report sweep (6 PRs). Commit unsigned — batch re-sign before merge if required.

https://claude.ai/code/session_014YjPMViNrZ7zBVgUQzwEKk

…22 detail

x402scan indexes mainnet resources only, but obol never inspected an
offer's network before submitting, so a Base Sepolia origin that DID
answer 402 got the generic "no endpoint answered with a live x402 402
challenge" — wrong and misleading. Add a local preflight that reads
x-payment-info.accepts[].network from the origin's own /openapi.json
and warns/explains when every advertised network is a known testnet.

Also fix an asymmetry in internal/x402scan/client.go: the 422
(no_valid_resources) rejection path decoded only a flat error message,
silently dropping the same per-endpoint failedDetails the 200-partial-
failure path already surfaces. registryError now carries FailedDetails
too, so per-endpoint probe failures show up on both paths.

Addresses a Canary402 field report.

Claude-Session: https://claude.ai/code/session_014YjPMViNrZ7zBVgUQzwEKk
@bussyjd
bussyjd merged commit 517de47 into integration/v0.14.0-rc0 Jul 16, 2026
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