Take x402 2.23.0, keep limits the only spend ceiling, cut 0.4.12 - #92
Merged
Conversation
@x402/core, @x402/evm and @x402/fetch move 2.21.0 to 2.23.0 as a set, plus
@solana/kit 7.1.1 and vitest 4.1.11.
2.23.0 turns client-side spend controls on by default and that needed handling
rather than a straight bump. A fresh x402Client carries spendControls = {} rather
than false, applySpendControls only early-returns on === false, and an omitted
maxAmountPerPayment falls back to DEFAULT_MAX_AMOUNT_PER_PAYMENT ("$1"). It also
restricts assets to a default allowlist.
pay already owns that decision through `limits` (per-call, daily, per-merchant),
enforced in the onBeforePaymentCreation hook. Two ceilings means the lower one
wins, and this one loses quietly: it filters the payment requirements out instead
of raising pay's structured limit verdict, so an over-$1 payment would surface as
"no acceptable payment requirements" rather than a message naming the cap the
user actually set. So the client disables x402's controls and `limits` stays the
single authority. Behavior is unchanged from 0.4.11.
The new test pins both halves. Its first case is a positive control asserting the
upstream default is still enforcing, which is what keeps the second case
meaningful: if upstream ever ships controls off by default, that case fails and
the disable is redundant rather than load-bearing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
@x402/core,@x402/evmand@x402/fetchmove 2.21.0 to 2.23.0 as a set, plus@solana/kit7.1.1 andvitest/@vitest/coverage-v84.1.11.2.23.0 needed handling rather than a straight bump. It turns client-side spend
controls on by default:
x402ClientcarriesspendControls = {}, notfalseapplySpendControlsonly early-returns on=== falsemaxAmountPerPaymentfalls back toDEFAULT_MAX_AMOUNT_PER_PAYMENT, which is"$1"Confirmed at runtime, not read off the source:
pay already owns that decision through
limits(per-call, daily, per-merchant),enforced in the
onBeforePaymentCreationhook a few lines below the change. Twoceilings means the lower one wins, and this one loses quietly: it filters the
payment requirements out instead of raising pay's structured limit verdict, so an
over-$1 payment would surface to the user as "no acceptable payment requirements"
rather than a message naming the cap they actually set.
So the client disables x402's controls and
limitsstays the single authority.Behavior is unchanged from 0.4.11, which is why this is a patch release.
Worked with: Varun.
Type of change
Public API
None. No CLI flag, command, output shape or exit code changes. The only source
edit is one
setSpendControls(false)call plus its comment.The x402 set was scoped before taking it, since it sits on a wire contract:
@x402/coreexported surface 2.21.0 to 2.23.0: zero removals, 8 additions@x402/evm(the signing path): zero removals, 9 additions@x402/fetchtype surface: byte-identicalmaxAmountRequired,x402Version,decimals)increase only
extrakeys["name", "version"]and nopaymentFlowTest plan
New file
tests/x402-spend-controls.test.ts, three cases:default, which is what keeps case 3 meaningful. If upstream ever ships them
off by default, this fails and the disable becomes redundant rather than
load-bearing.
setSpendControls(false)actually turns them offProved the guard fires: deleted the
setSpendControls(false)line, watchedcase 3 go red, then restored from a copy taken beforehand and re-ran green.
Full gate set on this branch:
bun run typecheckcleanbun run lintclean (eslint, max-warnings 0)bun run knipcleanbun run test: 57 files passed, 1 skipped; 573 tests passed, 2 skippedbun run build: ESM build success,dist/index.js251.54 KBosv-scanneroverbun.lock: no issues found across 723 packagesChecklist
(no public surface change; the CLI is identical to 0.4.11)
Deliberately not done
@agent-score/sdkfloor stays^2.7.5rather than moving to the freshlypublished
^2.7.6. Nothing here needs it and the existing range accepts it.mppx0.8.18 andviem2.55.19 are NOT taken. They are the coupled settle setwith a standing live all-rails settle obligation, which cannot be discharged
from this branch, so they move as their own deliberate change.
incur0.5.1 is not taken: it is gated on re-cuttingpatches/incur@<version>.patchand running the serveCli protocol against the compiled binary.
v*and an npm version ispermanent, so the tag is a deliberate step after this merges.