mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-28 01:49:00 +09:00
## Summary Fixes the two remaining open threads from the 2026-09-15 E2E/overnight-error triage — both diagnosed as **benign false alarms**, now hardened so they stop paging. ### 1. Stripe Stage-1 "Credit Purchase" E2E flake (daily #173) **Root cause:** the test failed when the browser redirect back from Stripe timed out (`stripe-checkout.ts` `waitForURL` 60s), even though the charge completed and credits were granted server-side. Prod logs confirmed the Stripe `checkout.session.completed` webhook fired on the "failed" runs too, and the next scheduled daily passed identically — a browser-redirect flake, **not** a credit-delivery outage. **Fix:** make the **server-side credit grant** the authoritative pass/fail gate. - `completeStripeCheckout()` now returns `{ redirected }` instead of throwing on the redirect wait. - The spec polls the read-only admin detail endpoint (`GET /api/users/admin/users/{email}/detail`) for a credit increase above a pre-purchase baseline — that's the real gate. The browser redirect + success-page assertions become best-effort UX checks. ### 2. Postmark 422 "Failed to send magic link" ERROR alerts **Root cause:** junk/placeholder addresses (e.g. `whatever@example.com`) typed into the sign-in form that Postmark has suppressed (hard bounce / spam / manual) → `ErrorCode 406 (InactiveRecipient)` → logged at ERROR → paged. Not the E2E suite (uses testmail.app) and not outreach. **Fix:** detect `ErrorCode 406`, log it at **INFO** (not ERROR), and surface a `suppressed` flag (`SendResult.suppressed` → `provider.last_suppressed` → `EmailService.last_send_suppressed`) so the magic-link + resend handlers log suppressed recipients at INFO instead of paging. ## Testing - 4 new `test_email_service.py` unit tests: suppressed flagging + no ERROR log, non-406 422 still errors, reset-on-success, end-to-end `last_send_suppressed` wiring. - All 47 `test_email_service` + 31 resend/tenant tests pass. Frontend `tsc` clean on both changed files. - The E2E robustness change is exercised by the next E2E Daily (Payment + Happy Path) run post-deploy. ## Notes - Local CodeRabbit CLI review was blocked by a workspace-SSO/org mismatch (CLI is authed to a different org), so this PR is left open for the GitHub CodeRabbit bot to review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>