GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(go): resolve server scheme lookups through wildcard registrations by Revinand · Pull Request #3862 · x402-foundation/x402

Conversation

@Revinand

@Revinand Revinand commented Oct 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Description

The Go resource server now resolves every scheme lookup through findByNetworkAndScheme, so a scheme registered for a pattern such as eip155:* serves concrete networks such as eip155:8453. GetRegisteredScheme (and with it HasRegisteredScheme, route validation and GetPaymentFlow), BuildPaymentRequirements, BuildPaymentRequirementsFromConfig, the scheme hook lookup and the settlement and payment-required enricher lookups indexed s.schemes[network] directly and matched only an exact network key. Other lookups in server.go and the Go client already used the helper, which tries the exact key first and then pattern matching, like the TypeScript and Python servers.

Exact registrations resolve as before, since the exact key is tried first. Scheme hooks come from the registration that serves the request: the server resolves it in the scheme registry and reads only that registration's hooks, so an exact registration without hooks does not pick up the hooks of a matching wildcard registration.

Most of this change was written with an AI coding assistant (Claude Code). I reviewed the diff and the tests and ran the checks listed below.

Closes #3861

Tests

  • TestServerWildcardSchemeRegistration (go/server_test.go): an eip155:* registration covers eip155:8453 in HasRegisteredScheme, BuildPaymentRequirementsFromConfig and VerifyPayment, and the scheme's BeforeVerify hook runs.
  • TestValidateRouteConfiguration_WildcardScheme (go/http/server_test.go): Initialize passes route validation and an unpaid request gets a 402.
  • TestServerExactSchemeWithoutHooksOverridesWildcardHooks (go/server_test.go): with a hooked eip155:* registration and an eip155:8453 registration without hooks, in both registration orders and after re-registering a hooked eip155:8453 scheme without hooks, GetRegisteredScheme returns the eip155:8453 registration and no BeforeVerify hook runs.

The first two fail without the change. go test -race ./..., go vet ./... and golangci-lint v2.7.2 pass in /go.

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits
  • I added a changelog fragment for user-facing changes (docs-only changes can skip)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added go sdk Changes to core v2 packages labels Oct 21, 2026
sunruize93-cmyk
sunruize93-cmyk suggested changes Oct 21, 2026
View reviewed changes

@sunruize93-cmyk sunruize93-cmyk left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Reviewed 0b0159dc0cd42ae4bc5f93f81c601e26f9f3f7a2 against confirmed main/merge-base faa1c694c66a3732aaabbce93bdae140e521a67d.

Standards

No documented-standard findings.

Spec

The original #3861 single-wildcard case is fixed in my CPU checks. Both newly committed regressions pass here and fail when run against main’s implementation.

Requesting changes for one new P2 in the inline comment: when a concrete registration has no lifecycle hooks, hook lookup can select a hooked wildcard registration even though scheme lookup, requirement construction and settlement enrichers select the concrete implementation. An aborting wildcard hook incorrectly blocks verification or settlement before the in-process facilitator is called.

Independent checks on macOS arm64 / Go 1.24.5:

  • Core and HTTP committed suites with -race -count=1: 233 top-level tests pass, 1 existing test skips; baseline 231 pass, 1 skips. The two new tests are included, not additional to that total.
  • 120 directed selection controls across three fresh runs: head 105 pass / 15 fail; baseline 82 pass / 38 fail. The 15 head failures describe the single hook-isolation regression across three registration arrangements, not 15 bugs.
  • Six minimal abort variants (verify/settle, both registration orders and exact re-registration): all fail here and all pass at main in three runs. Unrelated network/scheme controls pass.
  • Builds, vet and changed-file gofmt/whitespace checks pass for the reviewed packages.

Scope: local fixture schemes and facilitator doubles, not valid signatures, live payment/settlement/RPC, production, full Go SDK/monorepo or Linux/Go 1.26.6 verification. Full golangci-lint/goimports were not run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread go/server.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Revinand
fix(go): resolve server scheme lookups through wildcard registrations
25eba09
@Revinand
Revinand force-pushed the fix/go-server-wildcard-scheme-lookup branch from 0b0159d to 25eba09 Compare October 22, 2026 10:33
@Revinand
Revinand requested a review from sunruize93-cmyk October 22, 2026 10:59
sunruize93-cmyk
sunruize93-cmyk reviewed Oct 22, 2026
View reviewed changes

@sunruize93-cmyk sunruize93-cmyk left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Rechecked 25eba09956152c5238b0441364eac3f0796f445f against the confirmed main/merge-base faa1c694c66a3732aaabbce93bdae140e521a67d and the prior reviewed head 0b0159dc0cd42ae4bc5f93f81c601e26f9f3f7a2.

Standards

No documented-standard findings.

Spec

The hook-isolation issue from my previous review no longer reproduces in the covered cases. Resolving the registration in s.schemes before reading its hook slot keeps an exact registration without lifecycle hooks from inheriting wildcard hooks. Both registration orders and replacement of a hooked exact implementation with an unhooked one pass. Hook dispatch and settlement payload/response enrichers select the same exact implementation in these controls; the single-wildcard behavior from #3861 remains working.

Independent CPU checks on macOS arm64 / Go 1.24.5:

  • Core and HTTP committed suites with -race -count=1: 234 top-level tests pass, 1 existing skip. The new regression and its three cases are included, not added again to this total.
  • The same 120 selection controls in three fresh runs: 120/120 pass here; the previous head still gives 105 pass / 15 fail. Six minimal verify/settle abort variants pass 6/6 here and fail 6/6 on the previous head. Two unrelated-registration controls also pass.
  • The author’s new exact-without-hooks regression fails in all three arrangements when run against the previous implementation. The two original wildcard regressions still fail against main’s implementation.
  • Exact/wildcard precedence, partial/no-hook isolation, re-registration, failure/cancellation dispatch, requirement construction, settlement enrichment ownership and caller-payload preservation pass in the directed controls. Builds, vet and changed-file gofmt/whitespace checks pass.

No new blocking finding in this scope. These checks use local fixture schemes and facilitator doubles, not live signatures, payment/settlement/RPC, Linux parity, full SDK/monorepo or an overlapping-wildcard specificity guarantee. Full golangci-lint/goimports were not run.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Revinand

Revinand commented Nov 8, 2026

Copy link
Copy Markdown
Author

@sunruize93-cmyk Hi. Do you need anything else from my side for this PR approval and merging?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sunruize93-cmyk
sunruize93-cmyk approved these changes Nov 8, 2026
View reviewed changes

@sunruize93-cmyk sunruize93-cmyk left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Approving 25eba09956152c5238b0441364eac3f0796f445f following my follow-up review. The prior hook-isolation finding is addressed: an exact registration without hooks no longer inherits wildcard hooks. I have no further blocking findings in the reviewed scope.

Prior exact-head validation on 2026-10-22 (macOS arm64 / Go 1.24.5): core/HTTP race suites passed 234 top-level tests with one existing skip; 120 selection controls and six minimal abort controls passed in three runs. Builds, vet and changed-file formatting checks passed. These used local fixture schemes and facilitator doubles, without live payments/RPC or full-SDK/Linux validation. No tests were rerun for this approval.

CI attempt 2 remains red on merge snapshot 73ed6ec06085361bbd5fd845a190de0d238fa5d3: Go compilation fails at eip3009.go:109/112, and two Next default-response assertions fail. Read-only comparison confirmed that the failing Go file and the entire TypeScript subtree match base c2a8924eb5dfe53806352d73c46a87d2a9e34038, outside this PR's five-file Go diff. Those CI failures still need maintainer attention before merging.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Revinand

Revinand commented Nov 8, 2026

Copy link
Copy Markdown
Author

@CarsonRoscoe Hi. Could you review and approve it, please?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@carsonbot402

carsonbot402 commented Nov 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Hey @Revinand, thanks for the PR! The checklist is all set as of fad0430.

  • up to date with main
  • commits signed
  • CI passes
  • changelog fragment

I keep this comment up to date as you push (last checked fad0430).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Revinand
Merge branch 'main' into fix/go-server-wildcard-scheme-lookup
fad0430
@Revinand

Revinand commented Nov 9, 2026

Copy link
Copy Markdown
Author

@CarsonRoscoe I have fixed CI errors. Could you approve pending workflows please?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@sunruize93-cmyk sunruize93-cmyk sunruize93-cmyk approved these changes
Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

go sdk Changes to core v2 packages

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: Go resource server does not resolve wildcard network registrations such as eip155:*

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Revinand @carsonbot402 @sunruize93-cmyk
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.