mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
## Summary The retired KaraokeHunt mobile app still has installs submitting ~5-10 song requests/month. Each request POSTs to the dead `create.karaokehunt.com`, fires a client-side Pushbullet push to Andrew, and shows the user a hardcoded *"you should receive an email in 5-10 minutes with a link to your new karaoke video"* — a promise broken for years. This PR makes it true and converts those users into Gen users (Andrew's spec, BACKLOG Frog #2 extension). ## How - **Cloudflare Worker** (`infrastructure/cloudflare/karaokehunt-interceptor/`, deployed via `deploy.sh` — the karaokehunt.com zone is not IaC-managed): answers the app instantly, `waitUntil`-forwards the payload to the new backend intake with a shared secret. - **`POST /api/karaokehunt/request`**: unauthenticated intake, gated by `X-KH-Forwarder-Secret` (Secret Manager `karaokehunt-forwarder-secret`, already created; wired in ci.yml `--set-secrets`), 10/min/IP rate limit, lenient payload parsing, Firestore `karaokehunt_requests` audit trail. - **Conversion** (`backend/workers/karaokehunt_conversion.py`, mirrors `community_daily_pick`): - new email → account + 1 credit (`karaokehunt_app_conversion`) → job created **as them** (consumes it); first sign-in still grants the welcome credit (deliberate — next song covered) - existing user with credits → job on their credit (email offers to restore it on reply) - no credits, or over `KARAOKEHUNT_DAILY_JOB_CAP` (default 3/day, bounds unattended spend) → free community requests board (dedup → upvote) - conservative `pick_auto_selection` (not `select_best`): unconfident matches park in `AWAITING_AUDIO_SELECTION` and the email asks them to pick — garbage app inputs must never auto-publish to YouTube - 14-day per-email+song dedup; failures retryable via admin `POST /api/karaokehunt/internal/reprocess/{doc_id}` - **Email** `send_karaokehunt_conversion`: 3 variants (job started / pick the recording / on the board), 7-day one-click sign-in link, KaraokeNerds community-version bonus link when one exists. EN + all 32 locales via translate.py. ## Safety Deploys **dark**: endpoint 503s until the secret env lands, and receives no traffic until the Worker + DNS flip (done post-merge via `deploy.sh`). Kill switch = delete the Worker route; backend-side = remove the secret mapping or `KARAOKEHUNT_DAILY_JOB_CAP=0`. ## Testing - 36 new tests (`test_karaokehunt_intake.py`, `test_karaokehunt_conversion.py`): secret/rate-limit/JSON gates, all conversion routings, credit-grant guards, park-on-unconfident-search, email variants + HTML escaping, reprocess auth. - Full `make test` green (backend + frontend). - Post-deploy: live end-to-end POST through `create.karaokehunt.com` mimicking the app payload, verifying account/job/email/Firestore. Plan doc: `docs/archive/2026-09-22-karaokehunt-app-interceptor-plan.md` 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Requests submitted through the retired KaraokeHunt app are now received and converted into Nomad Karaoke jobs, accounts, or community-board requests. - Users receive localized email updates with job status, credit usage, audio-selection prompts, and tracking links. - Requests can be retried by administrators when processing fails. - Duplicate protection, request limits, and daily processing caps help prevent repeated or excessive submissions. - **Documentation** - Added API and deployment documentation for the request-forwarding workflow. - **Chores** - Released version 0.235.0. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>