Skip to content

chore(deps): bump @aibtc/tx-schemas to 1.0.0 - #633

Merged
whoabuddy merged 3 commits into
mainfrom
chore/deps-tx-schemas-1.0.0
Apr 22, 2026
Merged

chore(deps): bump @aibtc/tx-schemas to 1.0.0#633
whoabuddy merged 3 commits into
mainfrom
chore/deps-tx-schemas-1.0.0

Conversation

@whoabuddy

Copy link
Copy Markdown
Contributor

Summary

  • Bumps @aibtc/tx-schemas from ^0.3.0 to ^1.0.0 as a standalone isolated PR (Phase 2 of quest inbox-crash-and-reputation-fanout).
  • Adds explicit mappings for the 5 new TerminalReason and 5 new RpcErrorCode variants introduced in 1.0.0.
  • Adds 18 schema-compat tests that round-trip the new enum variants and verify the new error-code mappings (506 total tests, up from 488).

The 1.0.0 breaking change

tx-schemas v1.0.0 introduces two-phase broadcast status + reconcile grace window (#26):

  • SponsorLedgerEntry.status is now required (pending_broadcast | broadcast_sent | broadcast_failed).
  • LedgerEntry gains lifecycle helpers beginPendingBroadcast / resolveBroadcast with a schema-enforced transition matrix.
  • reconcile() gains justBroadcastGraceSeconds (default 30s) to surface entries as inFlightPendingIndex instead of dropped during the grace window.

For this repo's consumers, the concrete change is that TerminalReasonSchema and RpcErrorCodeSchema gain new variants:

New TerminalReason Category Mapped to
sponsor_exhausted relay INSUFFICIENT_FUNDS
sponsor_nonce_conflict relay RELAY_ERROR
origin_chaining_limit sender NONCE_CONFLICT
broadcast_rate_limited settlement BROADCAST_FAILED
sender_hand_expired sender PAYMENT_NOT_FOUND
New RpcErrorCode Mapped to
SPONSOR_EXHAUSTED INSUFFICIENT_FUNDS
ORIGIN_CHAINING_LIMIT NONCE_CONFLICT
BROADCAST_RATE_LIMITED BROADCAST_FAILED
SENDER_HAND_EXPIRED PAYMENT_NOT_FOUND
NONCE_OCCUPIED NONCE_CONFLICT

Consumer files touched

  • lib/inbox/relay-rpc.tsRPC_ERROR_CODE_MAP and TERMINAL_REASON_ERROR_CODE_MAP expanded with explicit entries for all 10 new variants. Existing fallback ?? "RELAY_ERROR" is unchanged.

Consumer files confirmed unchanged

  • lib/inbox/payment-contract.tsTrackedPaymentStateSchema values are identical in 0.3.0 and 1.0.0.
  • lib/inbox/reconcile-staged-payment.tsTerminalFailureStateSchema, paymentStateDefaultDeliveryByState, and PaymentStatusHttpResponseSchema.status are identical in 0.3.0 and 1.0.0.
  • lib/inbox/x402-verify.tsTerminalReason used as a type annotation only; no exhaustiveness check to expand.
  • app/api/inbox/[address]/route.tsHttpPaymentPayloadSchema shape is identical in 0.3.0 and 1.0.0.

Phase 1 vendor-type cast

The as unknown as PaymentPayloadV2 cast added in Phase 1 (app/api/inbox/[address]/route.ts) is unchanged — the HttpPaymentPayloadSchema type 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 .skip
  • npm run build — succeeds
  • npm run deploy:dry-run — publishes cleanly

🤖 Generated with Claude Code

whoabuddy and others added 2 commits April 21, 2026 17:14
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>
Copilot AI review requested due to automatic review settings April 22, 2026 00:15
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 22, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-schemas from ^0.3.0 to ^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 InboxPaymentErrorCode values.

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.

Comment thread lib/inbox/__tests__/relay-rpc.test.ts
Comment thread lib/inbox/__tests__/relay-rpc.test.ts Outdated
- 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
whoabuddy merged commit 291a5d9 into main Apr 22, 2026
8 checks passed
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>
@whoabuddy
whoabuddy deleted the chore/deps-tx-schemas-1.0.0 branch April 29, 2026 23:10
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.

2 participants