Repository navigation
feat: dist XDR console scan, MCP payer metrics, key rotation runbook, CLI stability test - #780
Closed
ElizabethChi wants to merge 1 commit into
Conversation
|
@ElizabethChi is attempting to deploy a commit to the david's projects Team on Vercel. A member of the Team first needs to authorize it. |
ElizabethChi
deleted the
feat/dist-xdr-logging-test-mcp-metrics-key-rotation-cli-stability
branch
October 22, 2026 08:44
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
Batches four hard issues: a dist bundle console scan, an opt-in Prometheus metrics endpoint for the MCP x402 payer, a signer key rotation runbook, and a stable CLI output contract test.
closes #670
closes #676
closes #681
closes #683
Changes
#670: dist console scan
Adds
scripts/check-dist-console.mjs, scanning all built.js/.cjsoutput from every tsup entry point forconsole.log/debug/warncalls, so a stray debug call anywhere transitively bundled intosrc/payments-client.tsorsrc/x402-signer.tscannot leak a signed transaction's XDR to a consumer's browser console.console.erroris intentionally excluded since a thrown error is normal, reviewed behavior. An empty-by-defaultALLOWLISTpermits an already-reviewed call, keyed by exact file and line. Wired into CI afternpm run buildasnpm run check:dist-console. Unit tests inscripts/check-dist-console.test.tscover the happy path, flagged methods, the allowlist's exact-match semantics, and multi-call findings.While unblocking the build to verify this, also fixed unrelated pre-existing bugs that were breaking
npm run buildoutright: a missing docblock opener insrc/x402-signer.ts, dead code after an early return in both signer functions that was skipping the capability-scoping check from #224 entirely, and a nonexistentTransaction.fromXDRcall insrc/tx-rpc.ts(real method isTransactionBuilder.fromXDR). None of these were otherwise part of #670's scope; a maintainer should still thread a propernetworkPassphraseoption through the rpc submitter rather than relying on theNetworks.TESTNETstopgap left in place.#676: Prometheus metrics endpoint
Adds
packages/mcp-x402-payer/src/metrics.ts: four counters (confirmed spend by asset, success count by asset, failure count by error name, session-ceiling rejections by asset) in Prometheus text format. Opt-in via a newVELLAR_X402_METRICS_PORTconfig option, undefined by default, since a process holding a hot wallet key should never open a port without explicit configuration. The HTTP server binds to127.0.0.1only; the endpoint has no auth of its own, so exposing it beyond localhost requires an operator-managed reverse proxy.server.ts's existing payment handlers now record outcomes through this hook;metricsis optional onServerDepsand a no-op when absent. Documented inpackages/mcp-x402-payer/README.md.#681: signer key rotation runbook
Adds
website/content/docs/operators/rotate-mcp-payer-key.mdcovering both supported configurations: a layer 1 hot wallet (no on-chain revocation exists, the only mitigation is moving funds and never reusing the key) and a layer 2 smart-account session key (minted and revoked on-chain viawallet.agents.mint/revoke). Documents the mint-new-then-revoke-old sequence, the overlap window, and that the in-memory spend ledger already resets on restart by design. Addscontrib/examples/rotate-mcp-payer-key/as an acceptance test proving the documented steps execute in order.#683: CLI output stability test
Extracts the inline rendering logic from
search/quote/inspectinto named, exported pure functions, matchingpay.ts's existing pattern. Adds inline snapshot tests covering the full text contract for each, including missing-field fallbacks and conditional lines. Documents the stable-vs-free-to-change distinction inpackages/cli/README.md. Adds acli-output-stabilityCI job running the CLI suite across Node 20 (oldest supported, perpackages/cli/package.jsonengines) and Node 22.Test plan
npm run buildsucceeds;npm run check:dist-consolereports no unreviewed console calls.scripts/check-dist-console.test.ts,src/x402-signer.test.ts,src/tx-rpc.test.ts),packages/mcp-x402-payer(15 files, 243 tests), andpackages/cli(4 files, 52 tests).contrib/examples/rotate-mcp-payer-key: 2 of 3 tests pass locally; the standalone-process test fails locally for the sameimport.meta.url/argvpath mismatch that also fails on the pre-existing siblingagent-key-lifecycleexample on this machine, confirmed by running that sibling's identical test and getting the identical failure. CI runs on ubuntu-latest where this does not occur.npm run typecheckfails on a pre-existing, unrelated syntax error insrc/session.test.ts, confirmed unaffected by this PR.Not included
None. All four issues are implemented, tested, and verified above.