M0: repeatable live-server money-loop smoke (pnpm smoke) in CI - #98
Open
Xiaoher-C wants to merge 4 commits into
Open
M0: repeatable live-server money-loop smoke (pnpm smoke) in CI#98Xiaoher-C wants to merge 4 commits into
Xiaoher-C wants to merge 4 commits into
Conversation
Permanent port of the 2026-06-07 throwaway smoke methodology
(docs/verification/e2e-smoke-2026-06-07.md) into scripts/e2e-smoke.ts:
- boots createRegistryServer({registryDb, creditDb}) in-process on port 0
with fresh temp SQLite DBs (mkdtemp + AGENTBNB_DIR), never ~/.agentbnb
- drives the full renter funnel (a)-(i) over real HTTP with the repo's
own Ed25519 crypto (generateKeyPair/signRequest/signEscrowReceipt)
- GAP#1 regression: voucher-funded escrow refunds restore the VOUCHER
(balance NOT credited), plus the expired-voucher balance fallback
- GAP#2 regression: public /o/:share_token payload AND persisted
outcome_json carry no thread title/description free text; authed
outcome keeps detail as a positive control
- ledger conservation invariant: balances + in-flight escrow + voucher
remaining == bootstrap + issued vouchers + provider bonuses
- unauthenticated fuzz: all 7 session mutation routes reject no-auth,
garbage-signature, and signed-stranger calls with 401/403
- one PASS/FAIL line per step, watchdog at 90s, exit 0 only when green,
teardown closes the server and removes the temp dir
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Works on a clean checkout: pnpm install builds better-sqlite3 and the preceding skill-inspector build step satisfies the server import graph. No .tmp-smoke dependency. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tic tamper - Self-guard every POST /api/sessions behind guardSessionCreate(): budget 8 of the 10/min per-IP RATE_LIMIT_CREATE the route-hardening branch adds to session-routes.ts, failing fast with a clear message instead of flaking into 429s. Header comment documents the interplay; production limit untouched. - Watchdog no longer process.exit(1)s past the .finally() (which leaked TEMP_ROOT and open server/DB handles): it now sets watchdogFired + logs, and Promise.race hands control to the shared finally, which always runs registered teardowns + rmSync and exits (watchdogFired || anyFailed ? 1 : 0). - funnel-g-tampered-receipt-400 flaked ~25% of runs: the last base64url char of a 64-byte Ed25519 signature carries only 2 significant bits, so the 'A'<->'B' flip often decoded to identical bytes and the tampered receipt verified (observed 201). Flip the first char (6 significant bits) instead. - Document why each credit_transactions.reason is in/out of sumMinted in the ledger-conservation invariant, and note the 403-before-409 contract on the settled-session unauth fuzz.
scripts/*.ts sat outside tsconfig.json's include, so e2e-smoke.ts was never typechecked in CI. Add tsconfig.scripts.json (extends the root config, noEmit, rootDir .) and run 'npx tsc -p tsconfig.scripts.json' right after the existing Typecheck step.
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
M0 substrate hardening (workstream WS-A). Permanent successor to the 2026-06-07 throwaway smoke (
docs/verification/e2e-smoke-2026-06-07.md) — 17 steps / 96 assertions in ~0.3s against a real in-process server on fresh temp DBs:pnpm smokejob + scripts/ typecheck (tsconfig.scripts.json)Notes
Test plan
pnpm smoke— 17 steps green, 3 consecutive runs, exit-code paths verifiedtsc -p tsconfig.scripts.jsoncleanMerge order: #97 → this → relay-dispatch.