Offline customer acceptance (no Lovable credits, provider HTTP, email or payments)

Install the repository dependencies and this directory's existing dependencies:
  npm ci --prefix scripts/offline-queue-tests
From the repository root:
  npm run test:customer
  npm run test:offline

The customer test calls the real checkout/server functions, signed Stripe event
receiver, transactional SQL, scoped job claim, worker stages, real composition
validation, PDF renderer and artifact checksum checks. It also exercises the
real delivery outbox, rendered email, signed Resend event receiver and private
PDF route against one throwaway PGlite database.

Replacements: framework request/cookie context, private object storage, birthplace
lookup, calculation provider and AI generation. Stripe and Resend HTTP receive
synthetic responses from a strict fetch stub. Unknown requests throw. The database
adapter translates the Supabase-shaped client calls into SQL; it does not recreate
business rules. Migrations 0020/21/22/25/34 concern hosted infrastructure and are
excluded; scheduler infrastructure is covered by dispatch.test.mjs separately.

The TEST journey completes all five processing stages and proves that automatic
mail remains blocked. A SEPARATE local LIVE fixture exercises delivery eligibility:
it confirms synthetic payment with the real SQL and verification policy, because
production Checkout is deliberately not implemented or enabled yet. Flags are
changed only inside the throwaway database. No stored TEST payment is relabelled.

These checks prove application wiring with simulated provider responses. They do
not prove astronomical accuracy, AI editorial quality, actual delivery/inbox
placement, provider quotas, cloud concurrency, latency or 200 sales/day. The four
native/live-provider integration files are excluded from test:offline intentionally.
A real, bounded provider pilot and live Checkout remain launch requirements.

Checkout restart regression coverage
Restart is allowed only for a never-bound order or an authoritative expired,
unpaid TEST Checkout. Settled payments with delayed webhooks, complete-but-unpaid
asynchronous payments, open sessions, mismatched responses and provider outages
keep the order and owner cookie. Controlled interleavings execute real bind and
payment-confirmation SQL between the server read and the final locked restart;
the compared session snapshot prevents stale abandonment. These interleavings
are deterministic race tests, not a real Stripe concurrency or volume test.
The legacy one-argument restart RPC refuses bound sessions, so an older build
cannot bypass the expiry check. The existing synthetic SQL self-test remains
compatible. The browser keeps its bootstrap id unless restart is confirmed.
Provider semantics: https://docs.stripe.com/api/checkout/sessions/object
