feat: AI fallback hardening + verified go-live gaps update #4085
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
Originally written by @ccantynz-alt on GitHub.
Imported from https://github.com/ccantynz-alt/AlecRae.com/pull/46
Summary
Follow-on launch-hardening that landed after PR #45 merged. Two commits:
translate/voice(draft + adjust) /voice-clonenow degrade gracefully whenANTHROPIC_API_KEYis absent or the Claude call fails, instead of throwing a 500. Enforces the Bible rule "all AI calls must have fallback behaviour." Matches the existing fallback pattern inai-writing.ts.apps/api/tests/dunning.test.tscovers the failed-payment recovery state machine (active → past_due → active/downgraded).scripts/preflight.tsandload-tests/.GO_LIVE_GAPS.mdupdate — marks G1–G5/G8–G10 done, adds bundle/perf gaps P1–P5 from the static audit.Verification (local)
bun run lint— 0 errors (31 pre-existing console warnings)bun run typecheck— 37/37 packagesbun run test— 61/61 (3× clean, no flakiness)Audit corrections
refreshMicrosoftTokenalready exists and is correctly wired insync/engine.ts(refreshes on expiry, persists rotated tokens). No change needed.Not in scope (tracked in GO_LIVE_GAPS.md)
https://claude.ai/code/session_01CQjWseikSJdamHS8W6Kygz
Generated by Claude Code