chore(deps): bump @aibtc/tx-schemas to 1.0.0 - #633
Merged
Conversation
Upgrade from ^0.3.0 to ^1.0.0. The 1.0.0 breaking change (two-phase broadcast status + reconcile grace window, aibtcdev/tx-schemas#26) adds five new TerminalReason variants and five new RpcErrorCode variants; the core enums used by this repo (TrackedPaymentStateSchema, TerminalFailureStateSchema, paymentStateDefaultDeliveryByState) are unchanged and required no code edits. Co-Authored-By: Claude <noreply@anthropic.com>
Expand RPC_ERROR_CODE_MAP and TERMINAL_REASON_ERROR_CODE_MAP in
relay-rpc.ts to cover the five new variants introduced in tx-schemas
1.0.0:
TerminalReason: sponsor_exhausted → INSUFFICIENT_FUNDS,
sponsor_nonce_conflict → RELAY_ERROR,
origin_chaining_limit → NONCE_CONFLICT,
broadcast_rate_limited → BROADCAST_FAILED,
sender_hand_expired → PAYMENT_NOT_FOUND
RpcErrorCode: SPONSOR_EXHAUSTED → INSUFFICIENT_FUNDS,
ORIGIN_CHAINING_LIMIT → NONCE_CONFLICT,
BROADCAST_RATE_LIMITED → BROADCAST_FAILED,
SENDER_HAND_EXPIRED → PAYMENT_NOT_FOUND,
NONCE_OCCUPIED → NONCE_CONFLICT
Add 18 schema-compat tests verifying enum parse round-trips and
map resolution for each new variant (506 total, up from 488).
Co-Authored-By: Claude <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
landing-page | dd1d9ce | Commit Preview URL Branch Preview URL |
Apr 22 2026, 12:39 AM |
There was a problem hiding this comment.
Pull request overview
This PR upgrades the repo’s relay contract dependency (@aibtc/tx-schemas) to v1.x and updates the inbox relay adapter to explicitly handle newly added TerminalReason and RpcErrorCode enum variants, with accompanying compatibility tests.
Changes:
- Bump
@aibtc/tx-schemasfrom^0.3.0to^1.0.0. - Expand relay error/terminal-reason mappings to cover the 10 new enum variants introduced in tx-schemas v1.0.0.
- Add schema-compat tests to ensure new enum variants parse and map to expected
InboxPaymentErrorCodevalues.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| package.json | Bumps @aibtc/tx-schemas dependency to ^1.0.0. |
| package-lock.json | Locks @aibtc/tx-schemas to 1.0.0 with updated integrity/resolution. |
| lib/inbox/relay-rpc.ts | Adds explicit mappings for new TerminalReason / RpcErrorCode variants. |
| lib/inbox/tests/relay-rpc.test.ts | Adds schema-compat parsing and mapping tests for the new variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Refactor new-TerminalReason mapping tests to be table-driven and cover all 5 new variants, not just 3. Previously sponsor_nonce_conflict and broadcast_rate_limited were added to TERMINAL_REASON_ERROR_CODE_MAP without matching regression tests. - Add `afterEach(() => vi.useRealTimers())` to the mapping describe so an assertion throwing mid-test can't leak fake timers into later tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
whoabuddy
added a commit
that referenced
this pull request
Apr 22, 2026
Full `rm -rf node_modules package-lock.json && npm install` on top of current main (which already includes tx-schemas 1.0.0 from #633). Brings all transitive deps back into sync with the carets in package.json. No package.json changes. Excludes all major-version bumps (next 15→16, eslint 9→10, typescript 5→6, @types/node 20→25, eslint-config-next 15→16) — each deserves a dedicated PR. Verified: lint, 508/508 tests, build, and deploy:dry-run all clean on Node 20 (matches .nvmrc + CI). Co-Authored-By: Claude Opus 4.7 (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
@aibtc/tx-schemasfrom^0.3.0to^1.0.0as a standalone isolated PR (Phase 2 of questinbox-crash-and-reputation-fanout).TerminalReasonand 5 newRpcErrorCodevariants introduced in 1.0.0.The 1.0.0 breaking change
tx-schemasv1.0.0 introduces two-phase broadcast status + reconcile grace window (#26):SponsorLedgerEntry.statusis now required (pending_broadcast | broadcast_sent | broadcast_failed).LedgerEntrygains lifecycle helpersbeginPendingBroadcast/resolveBroadcastwith a schema-enforced transition matrix.reconcile()gainsjustBroadcastGraceSeconds(default 30s) to surface entries asinFlightPendingIndexinstead ofdroppedduring the grace window.For this repo's consumers, the concrete change is that
TerminalReasonSchemaandRpcErrorCodeSchemagain new variants:TerminalReasonsponsor_exhaustedINSUFFICIENT_FUNDSsponsor_nonce_conflictRELAY_ERRORorigin_chaining_limitNONCE_CONFLICTbroadcast_rate_limitedBROADCAST_FAILEDsender_hand_expiredPAYMENT_NOT_FOUNDRpcErrorCodeSPONSOR_EXHAUSTEDINSUFFICIENT_FUNDSORIGIN_CHAINING_LIMITNONCE_CONFLICTBROADCAST_RATE_LIMITEDBROADCAST_FAILEDSENDER_HAND_EXPIREDPAYMENT_NOT_FOUNDNONCE_OCCUPIEDNONCE_CONFLICTConsumer files touched
lib/inbox/relay-rpc.ts—RPC_ERROR_CODE_MAPandTERMINAL_REASON_ERROR_CODE_MAPexpanded with explicit entries for all 10 new variants. Existing fallback?? "RELAY_ERROR"is unchanged.Consumer files confirmed unchanged
lib/inbox/payment-contract.ts—TrackedPaymentStateSchemavalues are identical in 0.3.0 and 1.0.0.lib/inbox/reconcile-staged-payment.ts—TerminalFailureStateSchema,paymentStateDefaultDeliveryByState, andPaymentStatusHttpResponseSchema.statusare identical in 0.3.0 and 1.0.0.lib/inbox/x402-verify.ts—TerminalReasonused as a type annotation only; no exhaustiveness check to expand.app/api/inbox/[address]/route.ts—HttpPaymentPayloadSchemashape is identical in 0.3.0 and 1.0.0.Phase 1 vendor-type cast
The
as unknown as PaymentPayloadV2cast added in Phase 1 (app/api/inbox/[address]/route.ts) is unchanged — theHttpPaymentPayloadSchematype shape did not change in 1.0.0, so no tightening is warranted.Test plan
npm run lint— clean (pre-existing<img>warnings only, unrelated to this PR)npm run test— 506 tests pass (488 baseline + 18 new schema-compat tests), no.skipnpm run build— succeedsnpm run deploy:dry-run— publishes cleanly🤖 Generated with Claude Code