No test drives a real 402 payment loop

Đã đóng
#423 6 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

@Ugasutun đang làm issue này rồi.

Từ ngày 17/10/2026.

  • #450 của @sparkysolutions10-pixel — đã đóng, không merge
  • #490 của @Ugasutun — đã đóng, không merge

Đánh giá

Issue này chưa được đánh giá.

Mô tả

area:testing difficulty:advanced help wanted points:200 Stellar Wave
Background

The 402 test asserts that a rejected payment maps to ERR_PAYMENT_REJECTED.
Nothing tests the path where a 402 is answered successfully: the payment is
constructed, signed, submitted and the resource returned.

That path is the reason this tool exists, it is the one that moves money, and it
is the one that would break silently on an x402 or Stellar SDK upgrade — which
is not hypothetical, since this repo currently pins @stellar/stellar-sdk at a
major four behind current.

What to build
  • An end-to-end test of the successful 402 loop against a stubbed resource that
    demands payment and verifies it — a fake facilitator, not mainnet.
  • Assert on what was signed: amount, destination, network passphrase. A test that
    only checks the response body would pass while paying the wrong account.
  • Cover the failure branches too: wrong network, expired signature, amount above
    maxPrice.
  • Testnet keys only, generated by the test, never committed and never a real
    account.
Acceptance criteria
  • A successful 402 loop is tested end to end against a stub
  • Assertions cover amount, destination and network, not just the response
  • Payment above maxPrice is refused, asserted
  • No real key or mainnet account is used
  • The test is deterministic and needs no network access

Drips Wave · Complexity: Advanced · 200 points


Repo: Divinity-Labs/Lens. The MCP server is src/mcp/server.ts
(BazaarMcpServer) with error codes in src/mcp/codes.ts. It is started by
npm run mcp:server → examples/mcp-server/run.ts, and there is an agent
example at examples/mcp-server/agent.ts. Tests are tests/mcp.test.ts.

Run the tests: npm test. The tests are vitest, not jest. A single file
is npx vitest run tests/mcp.test.ts.

Load test (prices) is already failing on main. Not your PR.

This surface signs with a real mainnet key. examples/mcp-server/run.ts
requires MCP_AGENT_SECRET_KEY_MAINNET and builds a signer for
stellar:pubnet. Anything you change here can move real money, so prefer
failing closed, and never log, echo or test with a real secret key.

Never elide an address, a contract id or a key in code, comments or
fixtures. A previous batch shortened a contract id and five contributors
invented plausible-looking ids to fill the gap. Write it in full or not at all.

An agent is the least able caller to notice a wrong answer. It will reason
over whatever it is handed, confidently. Prefer a structured error over a
best-effort result.


Required: Before submitting, join the contributor Telegram so your work can be tracked and counted toward the Stellar Wave: https://t.me/+fxHXq8f1SwlkZDBk

Ngôn ngữ chính
TypeScript
Star
4
Fork
71
Merge trung bình
3 ngày 22 giờ
Pull request đã merge (30 ngày)
142

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Divinity-Labs/Lens

Tất cả issue của Divinity-Labs/Lens

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.