[Testkit] Bootstrap route + refund ledger coverage (T23–T24) #54

Open
opened 2026-03-21 00:43:08 +00:00 by replit · 0 comments
Owner

What & Why

POST /api/bootstrap is the highest-value paid feature (10 000 sats default fee) yet has zero testkit coverage. The refund payout path happy-path is also untested. This adds T23 and T24.

Done looks like

  • T23POST /api/bootstrap → 201 with paymentHash, stubMode: true; stub-pay the invoice; poll until state === "provisioning" or state === "ready"; verify response has bootstrapJobId, state, message
  • T24 — After T6 job completes (state=complete), read costLedger from GET /api/jobs/:id; verify actualInputTokens, actualOutputTokens, actualCostUsd, actualAmountSats, refundAmountSats, refundState are all present and internally consistent (actualAmountSats <= workAmountSats, refundAmountSats >= 0)
  • Both tests pass on GET /api/testkit execution and appear in summary block
  • No regressions on T1–T22

Tasks

  1. Implement T23 — In artifacts/api-server/src/routes/testkit.ts, append T23 before the Summary block. Create bootstrap job via POST /api/bootstrap, stub-pay the invoice, poll GET /api/bootstrap/:id until non-awaiting_payment state.
  2. Implement T24 — After T6 (job complete), re-fetch GET /api/jobs/:id, assert all cost ledger fields are present and self-consistent.

Relevant files

  • artifacts/api-server/src/routes/testkit.ts
  • artifacts/api-server/src/routes/bootstrap.ts
  • artifacts/api-server/src/routes/jobs.ts
## What & Why `POST /api/bootstrap` is the highest-value paid feature (10 000 sats default fee) yet has zero testkit coverage. The refund payout path happy-path is also untested. This adds T23 and T24. ## Done looks like - **T23** — `POST /api/bootstrap` → 201 with `paymentHash`, `stubMode: true`; stub-pay the invoice; poll until `state === "provisioning"` or `state === "ready"`; verify response has `bootstrapJobId`, `state`, `message` - **T24** — After T6 job completes (state=complete), read `costLedger` from `GET /api/jobs/:id`; verify `actualInputTokens`, `actualOutputTokens`, `actualCostUsd`, `actualAmountSats`, `refundAmountSats`, `refundState` are all present and internally consistent (`actualAmountSats <= workAmountSats`, `refundAmountSats >= 0`) - Both tests pass on `GET /api/testkit` execution and appear in summary block - No regressions on T1–T22 ## Tasks 1. **Implement T23** — In `artifacts/api-server/src/routes/testkit.ts`, append T23 before the Summary block. Create bootstrap job via `POST /api/bootstrap`, stub-pay the invoice, poll `GET /api/bootstrap/:id` until non-`awaiting_payment` state. 2. **Implement T24** — After T6 (job complete), re-fetch `GET /api/jobs/:id`, assert all cost ledger fields are present and self-consistent. ## Relevant files - `artifacts/api-server/src/routes/testkit.ts` - `artifacts/api-server/src/routes/bootstrap.ts` - `artifacts/api-server/src/routes/jobs.ts`
replit added the backend label 2026-03-21 00:43:08 +00:00
gemini was assigned by Rockachopa 2026-03-22 23:37:14 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: replit/timmy-tower#54