Skip to content

004-05: E2E Against HoS Testnet + Docs - #40

Merged
jaswinder6991 merged 1 commit into
mainfrom
004-05-e2e-docs
Jul 14, 2026
Merged

jaswinder6991 merged 1 commit into
mainfrom
004-05-e2e-docs

Conversation

@jaswinder6991

Copy link
Copy Markdown
Contributor

Closes #32. Part of Epic 004 (#27). Depends on #36 + #37 (merged). Last ticket of the epic alongside #38 (UI) and #39 (Stripe Billing).

What

Full-chain E2E suite (api/tests/integration/e2e-stake2pay.test.ts) registering the real stake2pay plugin through the shared harness and driving the generic /subscriptions/* routes end to end, in two paths:

  • Mocked-RPC (13 tests, run everywhere, zero network): a local node:http server speaks the NEAR JSON-RPC query/call_function protocol and serves canned chain fixtures with mutable state. This drives the transitions the live contract can't produce on demand — the full status ladder active → cancel_at_period_end → pending_unstake → ended through the real API stack — plus discovery exclusion of payment-only plugins, plan filtering (OneOff/Archived dropped), lock-intent shape (storage_deposit prefix for unregistered payers, duration_ns: null), 1-yocto cancel intent, NOT_FOUND/BAD_REQUEST paths, and session-wallet payerRef defaulting.
  • Live read-only (4 tests, describe.skipIf(!process.env.HOS_TESTNET)): plugin defaults against hos-e2e-0601144939.testnet — so the ephemeral testnet contract can never break CI, per the ticket.

Docs: docs/004-01 … 004-06 mirroring issues #28–#33 (repo convention), including the manual testnet wallet-signing checklist in 004-05 (no funded key in CI). README gets the stake2pay provider row with its variables-only config table; .env.example notes stake2pay needs no secrets + the HOS_TESTNET flag.

One deliberate fix outside the ticket's file list

setup.ts previously pointed all E2E contexts at pglite:.bos/api/:memory: — which is not in-memory (pglite treats it as an on-disk path), so parallel vitest forks raced on one directory and the full suite flaked ~2/3 of runs before this branch. Since this ticket's AC requires the full run green, setup.ts now gives each context an isolated throwaway pglite dir (removed on teardown), no caller changes. This is the proper fix for the footgun flagged in #37.

Verified

  • cd api && bun run test: 49 passed, 4 skipped — three consecutive green runs (the suite was flaky before the setup.ts fix)
  • HOS_TESTNET=1 bun run test: 53 passed, 0 skipped (live testnet)
  • bun run typecheck green, biome clean on changed files

🤖 Generated with Claude Code

https://claude.ai/code/session_01FdKukDnRTrshKqkQ8JXwVj

- api/tests/integration/e2e-stake2pay.test.ts: registers the real
  stake2pay plugin through the shared harness and drives the generic
  /subscriptions/* routes end to end
  - mocked-RPC path (no network): local node:http server speaking the
    NEAR JSON-RPC query/call_function protocol serves canned chain
    fixtures and drives active -> cancel_at_period_end ->
    pending_unstake -> ended, plus lock/cancel wallet intents,
    NOT_FOUND and BAD_REQUEST paths
  - live read-only path against hos-e2e-0601144939.testnet, gated
    behind HOS_TESTNET so the ephemeral contract cannot break CI
- setup.ts: replace the shared pglite:.bos/api/:memory: path (an
  on-disk directory parallel vitest forks raced on) with an isolated
  throwaway pglite dir per context, removed on teardown
- docs/004-01..004-06 ticket specs mirroring GitHub issues #28-#33,
  including the manual testnet wallet-signing checklist in 004-05
- README: stake2pay provider row + no-secrets variables table
- .env.example: stake2pay needs no secrets; HOS_TESTNET flag note

Closes #32

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FdKukDnRTrshKqkQ8JXwVj
@jaswinder6991
jaswinder6991 merged commit cc2dbef into main Jul 14, 2026
1 check passed
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.

004-05: E2E Against HoS Testnet + Docs

1 participant