Vaaya spending refusal: controlled dispatcher test ================================================= Executed: 2026-09-17T00:16:27.987Z Source commit: 71dd3628af0e67554b39afb943359204bae85980 Existing unit tests execute the actual dispatcher with synthetic registry, account, database and provider fixtures. No real account, purchase or ledger is accessed. This is test evidence, not a production HTTP response, purchase, receipt or payment. Result: 5 selected tests passed; 0 failed; 15 other tests skipped by the selection filter. PASS vaaya/result returns the job view with no ledger movement and no transaction row PASS vaaya/result still answers while the job is running (balance is irrelevant to a poll) PASS dispatchService — REST rail rejects with credits_required when balance < price (prepaid — no overdraft) PASS dispatchService — REST rail enforces max_cost_cents ceiling before upstream call PASS dispatchService — REST rail does not debit when upstream returns 4xx What the selected existing tests assert: - A synthetic account with exhausted available credit receives status 402 and error credits_required. - The provider fetch spy is not called and the mocked ledger has no debit for that refusal. - A quote above the supplied per-call ceiling is refused before the provider is called. - A provider error does not debit the mocked ledger. - Reading an existing job result has zero polling-call charge and writes no new transaction row. - An existing running job can still be checked with an empty balance. The separate spending-check-demo.mjs uses simpler fixtures: balance 0, active credit 0, quote 1 cent; then the same quote with synthetic balance 1 cent. Its output is a pure decision, not an HTTP response. Reproduce the dispatcher tests from a checkout of the source commit with dependencies installed: Working directory: apps/web node node_modules/vitest/vitest.mjs run lib/services/__tests__/dispatch.test.ts lib/services/__tests__/dispatch.result.test.ts -t 'rejects with credits_required|enforces max_cost_cents|does not debit when upstream|returns the job view|balance is irrelevant' --reporter=json --outputFile=dispatch-test-report.json