mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-28 01:49:00 +09:00
36b331f3d7411ecf97c05bf15146e83161ab94de
44
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a1a92d197c |
docs: reflect multi-instance-type encode pool + finalization-CPU handoff (#913)
## Summary Brings all **live** repo docs in line with the v0.195.0 encode-worker mechanism (shipped in #911/#912) and adds a handoff for the next investigation. Docs-only, no version bump. ## What changed - **ARCHITECTURE.md** — rewrote the "Encoding Worker" section: c4d blue-green primary pair **+ ranked 6-family fallback pool** (c4d/c4/n4d/c2d/n2d/n2, 10 VMs), the shared `encoding_worker_preference.ordered_candidates` driving **both** runtime and deploy selection, fastest-first + 15-min `capacity_state` cooldown, `is_primary` override routing, and the self-sufficient CPU-torch dep-baked image. Updated the topology diagram + intro. - **TROUBLESHOOTING.md** — capacity runbook now lists all 6 families / 8 fallbacks + cooldown; the capacity-probe loop covers the 4 new VMs; deploy green-selection points at the ranked pool; the "No module named" section notes the dep-bake largely eliminated it (plus the create-time-stockout caveat). - **DEVELOPMENT.md** + **CLAUDE.md** — fixed "two VMs" framing; CLAUDE.md ssh example uses a real VM name (there is no VM literally named `encoding-worker`). - **GCP-COST-OPTIMIZATION.md** — corrected the stale "c4d running 24/7, ~\$700/mo" current-state (now an on-demand pool with idle-shutdown — the listed opportunities are largely shipped). - **LESSONS-LEARNED.md** — marked the Aug-2026 2-family diversification lesson as **superseded** by the v0.195.0 pool (history preserved, redirects to current). - **NEW** `docs/archive/2026-08-16-finalization-cpu-efficiency-handoff.md` — grounded handoff to investigate whether prod finalization is CPU-underutilized (`ffmpeg_threads:8` on 32-vCPU workers), with repro steps, constraints (heavy-lane serialization / RAM), and the benchmark baselines. Left untouched: `docs/archive/**` and `docs/superpowers/**` (historical snapshots), and dated changelog entries in `docs/README.md`. ## Testing Docs-only — verified internal anchor link (DEVELOPMENT → ARCHITECTURE section) resolves. No code/tests affected. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated architecture and development guidance for blue-green encoding workers, fallback capacity, active VM selection, and on-demand startup. * Refined troubleshooting instructions for capacity-aware deployment, VM promotion, health checks, restarts, and dependency recovery. * Updated cost-optimization guidance to document auto-shutdown, scale-to-zero behavior, and on-demand capacity. * Marked instance-type diversification as shipped and documented rollout outcomes. * Added a handoff for investigating CPU utilization during video finalization. * Clarified outdated guidance in the lessons learned documentation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
c94abbf7f4 |
docs: Cloudflare edge security (WAF + origin lock) — persistent-doc coverage (#889)
Documents the 2026-07-20 edge cutover (shipped in #886 + #888) in the persistent docs. ## Changes - **ARCHITECTURE.md**: Cloudflare edge added to the System Overview request path + new **§ Edge Security (Cloudflare)** (WAF, rate limit, origin lock, SSL "full" rationale). - **LESSONS-LEARNED.md**: the SSL "dragon" resolution (managed cert can't provision behind CF, but "full" mode makes it work + renewal-safe → never use "full (strict)") + Free-plan WAF/rate-limit constraints + origin-lock-without-breaking-internal-callers. - **README.md**: Recent Changes entry + Current State row. - **API.md**: origin-lock note (direct-to-`*.run.app` → 403 without `X-Edge-Auth`). Docs-only; no version bump. @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
7cf42c8983 |
feat(pricing): duration-based credit pricing + long-duration input handling (#799)
@coderabbitai ignore
## Summary
Implements **duration-based credit pricing** for karaoke jobs, replacing
the flat 1-credit/job model. Credits now scale with input audio length
(`ceil(min/10)`, hard-block >60 min), with cost confirmed before heavy
processing and reconciled against the actual measured audio. Closes out
the planned fix from the 2026-06-04 long-duration mashup incident.
- Design:
`docs/archive/2026-06-04-long-duration-input-handling-design.md`
- Plan: `docs/archive/2026-06-04-long-duration-input-handling-plan.md`
## Pricing model
`credits = max(1, ceil(minutes / 10))` — 1 credit ≤10 min, 2 ≤20 min … 6
≤60 min. Inputs over 60 min are blocked. Single source of truth in
`backend/services/pricing.py`, mirrored in `frontend/lib/pricing.ts`.
## How it works
- **`state_data.credits_charged`** is the authoritative running total.
`create_job` charges the base (URL = full N via `acknowledged_credits`;
search/upload = 1); top-ups deduct only the **delta**
(`count_as_job_creation=False`).
- **Reconciliation engine** (`duration_reconciliation.py`) runs at the
single convergence point before separation+transcription in all three
processing paths (download / post-edit / `start_job_processing`),
exactly once each. It measures the audio actually sent to AudioShake
(post-edit if trimmed):
- actual < estimate → auto-refund the difference
- actual > estimate → pause at new **`AWAITING_DURATION_CONFIRM`**
state, user re-confirms (inline Buy Credits)
- actual > 60 min → refund everything + cancel
- **`POST /api/jobs/{id}/confirm-duration`** (+ `POST
/api/jobs/estimate`) reuse the review-stage pause/resume.
- **Notifications**: in-browser + push, 15-min idle email, 24h reminder,
**48h auto-cancel + full refund** — via the existing idle-reminder /
stale-job machinery.
- **Admin / made-for-you jobs bypass charging entirely**
(`payment_bypassed` → reconcile short-circuits).
## Endpoints
| Method | Path | Purpose |
|---|---|---|
| `POST` | `/api/jobs/estimate` | URL duration probe →
`{duration_seconds, credits, blocked, source}` |
| `POST` | `/api/jobs/{id}/confirm-duration` | confirm cost / resume
(402 insufficient, 409 mismatch) |
| `POST` | `/api/jobs` | URL create gains optional `duration_seconds`,
`acknowledged_credits` |
| `POST` | `/api/audio-search/{id}/select` | gains optional
`acknowledged_credits` |
## Frontend
`DurationCostConfirm` modal (Radix Dialog) surfaced via a "Confirm Cost"
action on `awaiting_duration_confirm` jobs (`useDurationConfirm` hook),
per-result cost chips on audio search, `pricing` i18n namespace in all
33 locales.
## Testing
- Backend: **3358 passing** (incl. boundary tables, money-math
conservation, reconcile up/down/over-limit, confirm 402/409, idempotency
guards, stale-expiry refund, an end-to-end integration test). Frontend:
**960 passing**. i18n completeness clean.
- Reviewed locally: per-task spec + quality review, a holistic
cross-cutting review, `/test-review`, and two CodeRabbit fix cycles.
## Notable bugs caught & fixed during review
- **Multi-credit under-refund**: `_refund_credit_for_job` refunded a
flat 1 — now refunds `credits_charged` (user-cancel of a long job).
- **Admin-bypass trap**: admin jobs would pause at the confirm gate and
be charged real credits — now short-circuited.
- Over-limit double-refund (suppress `cancel_job`'s built-in 1-credit
refund); over-limit email used the wrong "48h" message;
double-confirm/double-select idempotency guards.
- Hit the summary-projection gotcha (added fields to both projection
lists + regression test).
## Known residuals / follow-ups (non-blocking)
- **URL pre-flight cost-confirm is inert** until flacfetch's
`/check-youtube` returns a `duration` key — currently falls back to a
1-credit hold + post-download reconcile (functionally correct). Separate
flacfetch change.
- Duration-confirm email **bodies** are English (URLs are
locale-prefixed; backend i18n covers en/es/de) — `# TODO(i18n)` left.
- Concurrent confirm/select **double-charge TOCTOU** is an accepted
low-probability residual (atomic claim would need a Firestore
transaction); the status-transition guard handles the realistic
double-click case.
## Deploy note
Reuses the existing Cloud Tasks idle-reminder queue and the hourly
stale-review Cloud Scheduler (status-list / action-type expansions only)
— no new infra expected, but worth confirming `pulumi up` is a no-op on
deploy.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
||
|
|
a45798bb4d |
fix: remove SendGrid leftovers; consolidate on Postmark (#779)
## Summary - Fixes the failing e2e-daily notification job ([run #25983930960](https://github.com/nomadkaraoke/karaoke-gen/actions/runs/25983930960/job/76378786060)) which still used \`smtp.sendgrid.net\` — SendGrid was cancelled ~3 weeks ago - Drops the \`sendgrid\` Python dep, removes \`SendGridEmailProvider\`, simplifies provider selection in \`email_service.py\` - Removes \`SENDGRID_API_KEY\` env bindings from Pulumi (gdrive-validator Cloud Function + video Cloud Run Job) and from ci.yml's Cloud Run \`--set-secrets\` - \`sendgrid-api-key\` Secret resource intentionally kept in \`infrastructure/modules/secrets.py\` with a "delete manually" marker so an unrelated \`pulumi up\` doesn't destroy the live secret + versions - Version bumped 0.174.10 → 0.174.11 ## Pulumi applied \`pulumi up --target\` already run locally with the two affected resources (video-encoding-job + gdrive-validator-function). PR #776's runner-manager state intentionally untouched. @coderabbitai ignore ## Test plan - [x] Full backend test suite (3178 tests) passes locally - [x] CodeRabbit local review: no findings - [x] Pulumi up applied locally (clean) - [ ] CI green on this PR - [ ] After merge: e2e-daily.yml notification job should pass on next scheduled run - [ ] Verify gdrive-validator function still emails on next post-job trigger 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
6445864534 |
feat: frontend crash reporting → Discord alerts + auto cache bust (#725)
@coderabbitai ignore ## Summary Gives us long-term peace of mind that frontend errors never reach users silently. Every client-side crash is captured, shown to the user with useful debug info, reported to the backend, alerted via the existing Discord error channel, and — critically — after a fix ships, affected users pick it up automatically. ## What this does - **Backend endpoint** `POST /api/client-errors` — normalises inbound reports and upserts into the same `error_patterns` Firestore collection the backend already uses. No new Discord wiring needed: `service="frontend"` patterns flow through the existing error-monitor Cloud Run Job → Discord pipeline. - **Three capture layers on the frontend**: - Global `window.onerror` + `unhandledrejection` listeners (mounted once per tab via `ClientErrorInit` in the locale layout) - Next.js App Router `error.tsx` (per-locale) + `global-error.tsx` (last-resort root) - React `CrashReportBoundary` wrapping `LyricsReviewWrapper` + `InstrumentalReviewWrapper` so a crash there renders in place rather than white-screening the route - **User-facing `CrashReport` card** — shows error name/message + collapsible stack + debug info + build SHA; auto-sends on mount (catches bugs in the wild without user action); has Copy / Send again / Try again / Back buttons. - **Version-aware cache busting** so the next bug I fix actually reaches affected users: - `public/version.json` emitted at build time via a new `prebuild` hook. - `isStale()` compares the compiled `NEXT_PUBLIC_COMMIT_SHA` against the live `/version.json`. - `ChunkLoadError` in the global handlers triggers a hard reload (unregisters SWs, clears caches, navigates with `?_v=<sha>` query-string) behind a 60 s circuit breaker to prevent reload loops. - `CrashReport` shows a prominent "A newer version is available — Update now" banner when stale; demotes "Try again" to secondary in that case. - Ambient 10-minute poll dispatches a `karaoke:stale-version` CustomEvent (no auto-reload ambient — only on crash). - **Admin `/admin/_crash-test` page** — three buttons that fire async throw / unhandled rejection / render-time throw, for post-deploy pipeline verification. - **Rate limiting** on the endpoint: 60/min per IP sliding window, plus pattern-hash dedup collapsing viral bugs to a single pattern. - **Privacy**: URL query strings + fragments stripped; user email only sent if authenticated; no cookies / localStorage / form-value capture. - **i18n**: `crashReport` namespace in `en.json` translated into all 32 locales. Reuses existing env var `NEXT_PUBLIC_COMMIT_SHA` — no new build config. ## Review & verification - 49 Jest suites / 800 tests pass (`make test`). - New unit tests: `crash-reporter.test.ts`, `CrashReport.test.tsx`, `CrashReportBoundary.test.tsx`, `version-check.test.ts`, `test_frontend_ingestion.py`, `test_client_errors.py` — all green. - Implemented task-by-task via subagent-driven workflow with spec + code quality review per task (see `docs/archive/2026-04-19-frontend-crash-reporting-plan.md`). - E2E Playwright test deferred — the admin crash-test page covers manual post-deploy verification. ## Test plan - [ ] Deploy to prod. - [ ] Visit `https://gen.nomadkaraoke.com/admin/_crash-test` as admin; click each of the three buttons. - [ ] Confirm a Discord alert arrives in the error channel (may take up to ~15 min per the monitor Cloud Run schedule). - [ ] Verify Firestore `error_patterns` contains 3 new docs with `service="frontend"`. - [ ] In a separate browser session already open to the app, simulate a stale-bundle scenario (edit `public/version.json` on the CDN, or use an older tab after a new deploy) — confirm `CrashReport` shows the "Update now" banner if an error is thrown. - [ ] Test the original Firefox Android bug (if it reproduces) and verify the crash now lands in Discord with a usable stack trace. ## Follow-ups - Source-map upload for readable production stacks (`Task 15` in the plan). - Consider forwarding the `source` payload field into `PatternData.sample_message` if finer-grained Discord triage (`window.onerror` vs `unhandledrejection` vs boundary) becomes valuable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
9a5c9d497a |
feat: production error monitor — log collection, LLM analysis, Discord alerts (#713)
## Summary - Add a production error monitoring service that runs as a Cloud Run Job every 15 minutes - Queries Cloud Logging across all NK services (Cloud Run, Jobs, Functions, GCE VMs), normalizes/deduplicates errors, uses Gemini Flash for incident grouping, sends Discord alerts, and auto-resolves silent patterns - Updates all `/prod-*` slash commands to use pre-computed Firestore patterns as primary data source ## Architecture Based on the proven Aquarius error bot system, adapted for Nomad Karaoke's multi-service architecture (20+ resources across 4 resource types). **New backend modules** (`backend/services/error_monitor/`): - `config.py` — constants, monitored services, env var overrides - `normalizer.py` — regex normalization + SHA-256 pattern hashing - `known_issues.py` — 8 ignore patterns for infrastructure noise - `firestore_adapter.py` — CRUD for `error_patterns`, `error_incidents`, `discord_alerts` - `discord.py` — webhook client with 5 alert formatters (new pattern, incident, spike, auto-resolved, daily digest) - `llm_analysis.py` — Gemini Flash incident grouping + near-duplicate detection - `monitor.py` — orchestrator entry point (`python -m backend.services.error_monitor.monitor`) **New infrastructure** (`infrastructure/modules/error_monitor.py`): - Cloud Run Job (`nomad-error-monitor`) sharing karaoke-backend image - Cloud Scheduler: every 15 min monitor + 08:00 UTC daily digest - Scheduler service account with `roles/run.invoker` - Backend SA gets `roles/logging.viewer` **New CLI scripts:** - `scripts/query-error-patterns.py` — query patterns from Firestore - `scripts/resolve-error-pattern.py` — mark patterns as fixed with PR reference ## Testing - 310 unit tests across 7 test modules (all passing) - Covers: config, normalizer, known issues, Firestore adapter, Discord formatting, LLM analysis, monitor orchestrator - P0/P1 caller-callee contract tests for monitor integration points - All tests use mocked external dependencies (no GCP calls) ## Review - [x] CodeRabbit CLI review completed locally (1 cycle, 3 issues fixed) - [x] Test review completed (P0/P1 gaps addressed) - [x] Documentation updated (README, ARCHITECTURE) - [x] Version bumped (0.168.2 → 0.169.0) ## Design Spec `docs/archive/2026-04-12-error-monitor-design.md` @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1cf6b62398 |
Route render_video to GCE encoding worker (#641)
@coderabbitai ignore ## Summary - Route `render_video_worker` (OutputGenerator/ffmpeg lyrics rendering) to the GCE encoding worker instead of running on Cloud Run - Fixes OOM crashes after Cloud Run memory was right-sized to 2Gi - Adds style asset disk cache on GCE worker to avoid repeated downloads of the same default theme - Preserves local fallback when GCE is disabled ## Changes ### GCE Worker (`backend/services/gce_encoding/main.py`) - New `/render-video` endpoint with `RenderVideoRequest` model - `run_render_video()` — downloads corrections/audio/styles from GCS, runs OutputGenerator, uploads outputs - `download_with_cache()` — SHA-256 keyed disk cache for style assets (fonts, backgrounds) - `metadata` field added to `JobStatus` model for countdown padding info ### EncodingService (`backend/services/encoding_service.py`) - `submit_render_video_job()` — POST to `/render-video` with retry logic - `render_video_on_gce()` — submit + wait convenience method ### render_video_worker (`backend/workers/render_video_worker.py`) - Conditional GCE routing when `encoding_service.is_enabled` - Cloud Run does zero downloads in GCE path — constructs GCS paths from Firestore metadata - Existing local path preserved unchanged as fallback ## Test plan - [ ] 18 new unit tests covering cache, endpoint, service methods, and routing logic (all pass) - [ ] Full test suite: 1164 passed, 0 failures - [ ] CodeRabbit review: 1 bug caught and fixed (missing metadata in cached response) - [ ] E2E happy path CI validates full pipeline after merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
92ae3fb28f |
feat: run audio separation directly on GPU in audio worker (#608)
## Summary - **Eliminates HTTP hop** between the audio worker Cloud Run Job and the audio-separator Cloud Run Service by running the `Separator` class directly with an L4 GPU attached - **Adds GPU Docker image** (`karaoke-backend-gpu`) with CUDA 12.6, PyTorch, and pre-baked ensemble preset models - **Moves audio worker to us-east4** with L4 GPU, 4 CPU, 16Gi memory — old separator service kept for rollback ## Changes ### Code - `audio_processor.py` — Ensemble presets wired into local Separator path (2-stage: `instrumental_clean` + `karaoke`) - `audio_worker.py` — Dual-mode support: `MODEL_DIR` env var → local GPU, `AUDIO_SEPARATOR_API_URL` → remote API - `create_audio_processor()` — New `model_file_dir` parameter to enable local GPU mode ### Infrastructure (Pulumi) - `gpu_artifact_registry.py` — New Artifact Registry in us-east4 for GPU images - `cloud_run.py` — Audio worker job: GPU (nvidia-l4), us-east4, 16Gi, `MODEL_DIR=/models` - `__main__.py` — Wire in GPU registry + Cloud Build IAM ### Docker - `Dockerfile.gpu-base` — CUDA 12.6 + Python 3.11 + audio-separator[gpu] + baked models - `cloudbuild-gpu-base.yaml` — Cloud Build config (E2_HIGHCPU_32, 100GB disk, 1h timeout) - `download_models.py` — Bakes `instrumental_clean` + `karaoke` preset models at build time ### Tests - 8 new unit tests covering factory config, mode selection, and preset wiring - Updated existing test patch targets for module-level Separator import ## Testing - [x] 22/22 unit tests pass (8 new + 14 existing) - [x] Code review completed (subagent-driven + final review) - [x] CodeRabbit CLI review completed locally - [ ] GPU image build (requires `gcloud builds submit`) - [ ] Production verification with `under_pressure_harmonies.flac` ## Rollback Plan Set `AUDIO_SEPARATOR_API_URL` back on the audio worker job → falls through to remote API path. Old separator service is still running (scale-to-zero). ## Design & Plan - Design spec: `docs/archive/2026-03-26-direct-gpu-audio-separation-design.md` - Implementation plan: `docs/archive/2026-03-26-direct-gpu-audio-separation-plan.md` @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
19efa269a8 |
feat: blue-green encoding worker deployment with deep health checks (#595)
## Summary - Replaces single encoding worker VM with a blue-green pair (a/b) for zero-downtime deployments - VMs auto-start on demand (JIT warmup when user opens lyrics review) and auto-shutdown after 15 min idle - CI deploys to secondary VM, runs a real encode test, then swaps the Firestore pointer atomically - Deep health check catches issues like PR #587's pip crash before they reach users - Cloud Function checks idle VMs every 5 minutes and stops them to minimize cost (~$10-15/mo idle vs $800/mo always-on) ## Architecture - **Firestore config doc** (`config/encoding-worker`) is single source of truth for primary/secondary routing - **Backend** reads primary IP from Firestore (30s TTL cache), starts VM on demand via Compute API - **CI workflow** handles blue-green swap: deploy → health check → real encode test → atomic Firestore swap → drain & stop old - **Cloud Function** auto-stops idle VMs based on active jobs, user activity, and deploy status - **Frontend** sends warmup signal on lyrics review page load + heartbeat on interactions ## Changes ### New Files - `backend/services/encoding_worker_manager.py` — VM lifecycle + Firestore config management - `backend/api/routes/encoding_worker.py` — Warmup and heartbeat API endpoints - `infrastructure/functions/encoding_worker_idle/` — Idle shutdown Cloud Function - `infrastructure/modules/encoding_worker_manager.py` — Pulumi module for Cloud Function + Scheduler - `scripts/seed-encoding-worker-config.py` — Firestore config seeding script - `infrastructure/encoding-worker/test-assets/test-preview.ass` — Test file for deploy health check ### Modified Files - `infrastructure/compute/encoding_worker_vm.py` — Single VM → blue-green pair - `infrastructure/__main__.py` — Wire up new VMs, Cloud Function, IAM - `backend/services/encoding_service.py` — Dynamic URL from Firestore, warmup-aware retry - `.github/workflows/ci.yml` — Blue-green deploy flow - `frontend/` — Warmup signal on lyrics review, heartbeat, warming-up UI state - `docs/` — Architecture, development, troubleshooting, lessons learned ## Test plan - [x] 47 new backend tests pass (EncodingWorkerManager, routes, dynamic URL resolution) - [x] 9 Cloud Function unit tests pass - [x] All 2808 existing backend tests pass (1 pre-existing failure unrelated) - [x] All 1116 existing unit tests pass (3 pre-existing failures unrelated) - [ ] Pulumi preview shows expected resource changes - [ ] Pulumi up applied locally before merge - [ ] Firestore config seeded with VM IPs - [ ] End-to-end verification after deployment ## Migration Steps (post-merge) 1. `pulumi up` creates 2 VMs, removes old VM 2. Seed Firestore: `python scripts/seed-encoding-worker-config.py <ip-a> <ip-b>` 3. Start VM A, verify health 4. First CI deploy exercises the blue-green flow ## Design Docs - Spec: `docs/superpowers/specs/2026-03-24-blue-green-encoding-worker-design.md` - Plan: `docs/superpowers/plans/2026-03-24-blue-green-encoding-worker.md` @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
38b966f30c |
Modal → GCP audio separation migration (#571)
@coderabbitai ignore ## Summary - Comprehensive migration plan: Modal → Cloud Run GPU (L4) for audio separation - Replaces old stub plan with full implementation details - **Architecture**: Cloud Run GPU service (scale-to-zero, ~$0.13/job) - **Model upgrade**: Ensemble presets as default (instrumental_clean + karaoke) for +35% quality - **Pipeline optimization**: Decouple separation from lyrics review critical path - Implementation will be added to this PR ## Plan highlights - Phase 1: Cloud Run GPU server (python-audio-separator repo) - Phase 2: GCP infrastructure via Pulumi (this repo) - Phase 3: Pipeline decoupling + preset-based model config - Phase 4: Cutover, monitor, decommission Modal See `docs/archive/2026-03-22-modal-to-gcp-migration-plan.md` for full details. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
a90017889a |
Update ARCHITECTURE.md with data pipeline Cloud Functions (#557)
## Summary - Document 3 new data pipeline Cloud Functions (divebar-mirror, kn-data-sync, divebar-lookup) - Add infrastructure details (service accounts, GCS buckets, BigQuery tables, secrets) @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
4e7439e80e |
feat: tiered disposable email detection via external APIs (#550)
## Summary - Add tiered disposable email checking: static blocklist → DeBounce API (free) → verifymail.io API (paid) — catches domains the static list misses - Auto-learn: flagged domains persist to Firestore `manual_domains`, so each domain only needs one API call ever - Clean domain cache: verified-clean domains skip API calls for 7 days - Well-known providers (gmail, yahoo, etc.) skip all checks instantly - Graceful degradation: if external APIs are down, static blocklist still works Investigation of 60 recent signups found 10 disposable accounts — the static list only caught 6, external APIs caught the remaining 4 (including niche `.io.vn` vanity domains and `nghienplus.store`). ## Test plan - [x] 52 unit tests pass (18 new tests for external API checking) - [x] All 707 frontend tests pass - [x] Integration tests verify magic link 422 rejection flow - [x] `make test` passes clean - [ ] After deploy: create GCP secret `verifymail-api-key`, then attempt signup with known-disposable domain not in static list (e.g., `test@lxbeta.com`) @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
a918c5a310 |
fix: serve encoded MP4 for With Vocals download (3.4x smaller) (#535)
## Summary - **Serve the encoded MP4** (~39MB) for "With Vocals" download instead of the raw MKV (~134MB) — 3.4x smaller, universally compatible - **Fix .mov mislabeling** — the MKV from GCS was being saved with a `.mov` extension in the temp dir, causing Dropbox to receive a wrongly-named file - **Thread `with_vocals_mp4`** through the full pipeline: `EncodingOutput` → `OrchestratorResult` → `_upload_results()` → Firestore `file_urls.finals.with_vocals_mp4` - **Backward compatible** — frontend prefers `finals.with_vocals_mp4` (MP4) but falls back to `videos.with_vocals` (MKV) for older jobs ## Test plan - [x] 3 new OutputLinks tests: MP4 preference, MKV fallback, MP4-only scenario (all pass) - [x] All 20 OutputLinks tests pass - [x] 2323 backend tests pass (1 pre-existing failure unrelated) - [x] CodeRabbit review: 3 findings fixed (GCE download mapping, legacy path, distribution dir extension) - [ ] Manual: verify new job produces `finals/with_vocals_mp4` in Firestore after encoding - [ ] Manual: verify "With Vocals" download from dashboard serves MP4 @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
deb870a980 |
feat: store processing metadata permanently for all workers (#527)
## Summary - Add `processing_metadata` field to Job model — immutable provenance data written by each worker during processing, separate from `state_data` (mutable workflow state) - **Critical fix**: Persist AudioShake `task_id` and `asset_id` which were previously lost after processing, requiring costly log/API recovery for data exports - Each worker writes its own section: transcription (AudioShake IDs), separation (models, timing), rendering, encoding, distribution, audio source (ffprobe), and worker timing - All metadata writes are non-fatal (try/except wrapped) — never fails jobs - Stores auth context (`auth_method`, `user_type`, `credits_at_creation`) and search query metadata at job creation - Uses Firestore dot-notation for atomic section updates without overwriting other workers' data ## Changes - **Model**: `processing_metadata` field on Job, `update_processing_metadata` helper on JobManager - **Workers**: lyrics, audio, screens, render_video, video — each writes timing + worker-specific metadata - **AudioShake**: `asset_id` now stored in `TranscriptionData.metadata`, flows through `corrections.json` - **API routes**: `extract_request_metadata()` accepts optional `auth_result` for auth context; audio search stores search query - **Firestore**: `processing_metadata` added to `SUMMARY_FIELD_PATHS` - **Tests**: 24 tests covering model, helpers, all worker functions, error handling, SUMMARY_FIELD_PATHS regression guard ## Test plan - [x] 24 new unit tests all passing - [x] All 2512 existing tests pass - [x] CodeRabbit review — fixed timing overwrite bug (deep dot-notation) - [ ] Deploy and verify metadata appears on new jobs via Firestore console @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
e4b2bf51da |
feat: move audio downloads to Cloud Run Jobs for reliability (#496)
@coderabbitai ignore ## Summary - Audio downloads via the guided flow (create-from-search, select audio source) previously used FastAPI BackgroundTasks, which Cloud Run would silently kill when scaling down "idle" instances. Jobs got permanently stuck at `downloading_audio` with no error. - Moves audio downloads to a dedicated Cloud Run Job (`audio-download-job`), matching the pattern already used for lyrics and audio separation workers. - Adds automatic stuck job detection and recovery via Cloud Scheduler. ## Changes **Core fix (Part 1):** - New `backend/workers/audio_download_worker.py` — standalone worker extracted from inline download logic - New `audio-download-job` Cloud Run Job with VPC access for flacfetch - New `trigger_audio_download_worker()` in WorkerService - Replace all 3 BackgroundTasks download call sites + admin retry endpoint with Cloud Run Job triggers - Check return value of trigger at all call sites (CodeRabbit finding) **Defense in depth (Part 2):** - `downloading_audio_stuck` health check in JobHealthService (>10 min detection) - `POST /api/internal/recover-stuck-jobs` endpoint - Cloud Scheduler job running every 5 minutes for auto-recovery **State machine fix (Part 3):** - Allow `FAILED → DOWNLOADING_AUDIO` transition for admin retry **Infrastructure:** - New Cloud Run Job: `audio-download-job` (1 CPU, 1Gi, 10min timeout, VPC connector) - New Cloud Scheduler: `recover-stuck-downloads` (every 5 min) ## Test plan - [x] 17 new unit tests for audio_download_worker and stuck detection - [x] All 120+ backend tests pass (including updated test_select_overrides.py) - [x] CodeRabbit review — 1 finding fixed (missing return value check) - [ ] After deploy: verify with a test job through guided flow - [ ] After deploy: run `pulumi up` for new infra resources ## Notes - Fixes stuck jobs 51b8231d and 89e497b1 from 2026-03-05 - The `_download_audio_and_trigger_workers()` function still exists in audio_search.py (used by the worker) but is no longer called from HTTP endpoints - Infrastructure changes require `pulumi up` before the Cloud Run Jobs will work in prod 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
ca9f3bd5ba |
feat: streamlined tenant portal with 4-field upload form (#481)
@coderabbitai ignore ## Summary - Replace the multi-step consumer wizard with a streamlined 4-field form (Artist, Title, Mixed Audio, Instrumental Audio) for B2B tenant portals - All tenant jobs automatically private with tenant-specific Dropbox/GDrive delivery, locked theme, and brand prefix - Backend: `_apply_tenant_overrides()` helper forces private, applies locked theme, overlays tenant distribution settings; private tenant jobs use their own paths instead of NonPublished override - Frontend: New `TenantJobFlow` component with drag-and-drop file uploads; conditional rendering based on tenant detection ## Test plan - [x] 10 backend unit tests (tenant override logic, distribution routing, partial config edge cases) - [x] 9 frontend unit tests (API contract, error handling, form validation) - [x] 3 E2E production tests (simplified form verification, track submission, consumer portal isolation) - [x] All existing tests pass (2307 backend + 520 frontend Jest + 181 Playwright regression) - [ ] Run production E2E test after deploy: `KARAOKE_ADMIN_TOKEN=xxx npx playwright test e2e/production/tenant-job-submission.spec.ts --config=playwright.production.config.ts` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
0184237242 |
feat: simplify YouTube quota — GCP Cloud Monitoring as single source of truth (#467)
## Summary - Replace dual Firestore self-tracking + GCP monitoring with **GCP Cloud Monitoring as the single source of truth** for YouTube API quota usage - Add lightweight Firestore **pending buffer** for the ~7-minute delay before GCP reflects new uploads - Simplify callers from 3x `record_operation()` to 1x `record_upload()` per upload - Add `youtube_quota_gcp_usage` and `youtube_quota_pending_units` to admin API response - Show "GCP: X + Pending: X" breakdown on admin dashboard below progress bar ## Test plan - [x] All backend tests pass (quota service, API, queue processor) - [x] All frontend tests pass (19 rate-limits page tests including new GCP+Pending breakdown) - [x] Full test suite passes (`make test` — 182 frontend + backend) - [ ] After deploy: verify `GET /api/admin/rate-limits/stats` returns `youtube_quota_gcp_usage` matching GCP Console - [ ] After deploy: verify dashboard progress bar shows real GCP number <!-- @coderabbitai ignore --> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
937f8f7ec1 |
feat: YouTube quota GCP monitoring + legacy beta cleanup (#460)
## Summary - Remove the deprecated beta enrollment system (endpoints, models, email templates, admin UI, rate limits) — ~20 files cleaned - Remove legacy count-based YouTube upload tracking from rate_limit_service and dead blocklist methods - Add GCP Cloud Monitoring integration to cross-reference YouTube API quota usage with Firestore tracking - Add drift detection (alerts when GCP reported vs Firestore tracked differs >10%) - Display GCP quota data in admin rate-limits dashboard ## Changes ### Backend (15 files) - **Removed:** 5 beta endpoints, `BetaTesterStatus` enum, beta User fields, beta email templates, `validate_email_for_beta()`, deprecated YouTube/beta rate limit methods, dead blocklist CRUD methods - **Added:** `get_gcp_quota_usage()` to `YouTubeQuotaService` with Cloud Monitoring API query, 5-min cache, and drift detection - **Updated:** Rate limits API response model with GCP quota fields (`gcp_quota_available`, `gcp_quota_units_consumed`, `quota_drift`, `quota_drift_alert`) ### Frontend (11 files) - **Deleted:** `frontend/app/admin/beta/page.tsx` (entire beta admin page) - **Removed:** Beta sidebar nav, layout breadcrumb, admin stats card, beta types/API methods, legacy YouTube stats cards - **Added:** GCP Cloud Monitoring section in rate-limits page showing reported usage, delay, and drift alerts ### Tests (4 files) - Removed 8 obsolete tests for deprecated methods - Created `test_gcp_quota_monitor.py` with 10 tests covering GCP quota querying, caching, fallbacks, and drift detection - Updated mock data and assertions across test files ### Docs (3 files) - Removed beta endpoint docs from API.md, added GCP quota fields - Updated ARCHITECTURE.md with Cloud Monitoring integration - Removed beta program section from PRODUCT-VISION.md ## Test plan - [x] All 2265 backend tests pass (1 pre-existing failure unrelated) - [x] All 516 frontend Jest tests pass - [x] New GCP quota monitor tests cover success, caching, fallbacks, drift alerts - [ ] Verify admin rate-limits page no longer shows beta/legacy cards - [ ] Verify GCP quota section shows "unavailable" gracefully when monitoring data not yet populated @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
90ce8951f5 |
feat: separate B2B tenant portal with edge config injection (#458)
## Summary - Separate whitelabel B2B tenant portals into their own Cloudflare Pages project (`karaoke-gen-tenant`) with edge-injected tenant config, fixing the magic link auth bug and eliminating flash of consumer content - Fix magic link emails to use tenant-specific URLs and branding (emails now link to `vocalstar.nomadkaraoke.com` instead of always `gen.nomadkaraoke.com`) - Add Cloudflare Pages Function that injects `window.__TENANT_CONFIG__` and CSS variables at the edge for instant branding - Add `NEXT_PUBLIC_TENANT_PORTAL=true` build flag for tree-shaking consumer content from tenant builds - Add admin tenant preview via `?preview_tenant=X` query parameter - Add tenant-scoped access tokens (tokens with `tenant_id` override hostname-based detection) - Dual build+deploy in CI (consumer → `karaoke-gen`, tenant → `karaoke-gen-tenant`) ## Test plan - [x] 17 backend tests pass (magic link params, tenant URLs, verify response, tenant-scoped tokens, require_auth override) - [x] 35 frontend tests pass (tenant store, edge-injected config, admin preview, feature flags) - [x] 181/182 E2E tests pass (1 pre-existing screenshot failure unrelated to changes) - [x] Both consumer and tenant portal builds succeed (`npm run build` with and without `NEXT_PUBLIC_TENANT_PORTAL=true`) - [ ] Manual: verify vocalstar.nomadkaraoke.com loads with tenant branding (already deployed) - [ ] Manual: verify magic link from tenant portal links to correct domain @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
98b6590658 |
feat: YouTube quota-aware upload system with deferred queue (#456)
## Summary - Replace hard-coded 10 uploads/day limit with YouTube API quota unit tracking (10,000 units/day, ~33 uploads) - Queue uploads when quota is exhausted instead of silently skipping them - Process queued uploads hourly via Cloud Scheduler, notify users via email when complete - Add admin dashboard for quota monitoring and queue management ## Changes ### Backend - New Services - `youtube_quota_service.py` — Tracks YouTube API quota units per day in Firestore (`youtube_quota` collection, date-keyed by Pacific Time) - `youtube_upload_queue_service.py` — Manages deferred upload queue in Firestore (`youtube_upload_queue` collection) with atomic claiming, retry logic, and failure handling - `youtube_queue_processor.py` — Worker that processes queued uploads when quota available (downloads from GCS, uploads to YouTube, sends notification) ### Backend - Modified - `video_worker_orchestrator.py` — Queue on quota exhaustion instead of skip; record quota units after each API call - `rate_limit_service.py` — Deprecated YouTube methods delegate to new quota service with legacy fallback - `job_notification_service.py` + `template_service.py` + `email_service.py` — Follow-up email when deferred upload completes - `rate_limits.py` — 3 new admin endpoints: GET queue, POST retry, POST process - `internal.py` — Internal endpoint for Cloud Scheduler to trigger queue processing - `config.py` — New settings: `youtube_quota_daily_limit`, `youtube_quota_upload_cost`, `youtube_quota_safety_margin` ### Frontend - `rate-limits/page.tsx` — YouTube Queue tab with quota progress bar, queued uploads table, retry/process buttons - `api.ts` — Types and API methods for queue management ### Infrastructure (Pulumi) - Cloud Tasks queue `youtube-upload-queue` - Cloud Scheduler job: hourly, Pacific Time, calls internal process endpoint ### Tests (90 passing) - `test_youtube_quota_service.py` — 16 tests - `test_youtube_upload_queue_service.py` — 15 tests - `test_youtube_queue_processor.py` — 14 tests (async) - `test_rate_limits_api.py` — 4 new endpoint tests - `test_rate_limit_service.py` — 5 updated/new delegation tests ### Docs - Updated ARCHITECTURE.md, API.md, README.md, LESSONS-LEARNED.md ## Motivation 4 jobs on 2026-03-03 had YouTube uploads silently skipped because the hard-coded rate limit of 10 uploads/day was reached. Users expected uploads but got none with no notification. The actual YouTube API quota (10,000 units/day) supports ~33 uploads — the rate limit was overly conservative. ## Testing - [x] 90 targeted backend tests pass (4.03s) - [x] Frontend Jest tests pass (503 tests) - [x] CodeRabbit CLI review completed, feedback addressed @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
2615261672 |
feat: add Singa whitelabel tenant and fix tenant infrastructure (#453)
## Summary - Add Singa as second whitelabel tenant (green/black branding, file-upload-only, locked theme) - Fix critical Zustand getter bug where computed properties became stale after set() calls - Fix React hydration error #300 (conditional return between hooks) - Add TenantLandingPage component for minimal tenant portal - Add Cloudflare Pages cache control headers - Add gs:// URL conversion fallback in tenant-logo ## Test plan - 27 tenant unit tests pass (5 new regression tests for Zustand bug) - 181 E2E tests pass - Verified singa/vocalstar/gen domains all working correctly <!-- @coderabbitai ignore --> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
e788187351 |
docs: catalog API, community detection, and autocomplete (#452)
## Summary - Documentation for the song lookup autocomplete and community version detection feature shipped in PR #451 ## Changes - **docs/README.md**: Added feature status rows (song lookup autocomplete, community version detection) and recent changes entry - **docs/API.md**: New "Catalog (Song Lookup)" section documenting all 3 endpoints (`/api/catalog/artists`, `/api/catalog/tracks`, `/api/catalog/community-check`) with request/response examples - **docs/ARCHITECTURE.md**: Added karaoke-decide and KaraokeNerds to external services table, added `catalog_proxy_service.py` and `karaokenerds_service.py` to service modules table - **docs/LESSONS-LEARNED.md**: Added "Autocomplete UX: Less Is More" pattern (single autocomplete that overwrites both fields > dual autocompletes) ## Test plan - Docs-only change, no code modifications @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
e11a5976e3 |
docs: update for feedback-for-credits and beta deprecation (#432)
## Summary - Update docs to reflect feedback-for-credits feature (PR #431) and beta program removal (PR #430) - Add `user_feedback` Firestore collection to architecture docs - Mark beta program section as deprecated in API reference - Add archive entry for the feedback-for-credits feature ## Changes | File | Update | |------|--------| | `docs/README.md` | Replace beta with feedback-for-credits in status table, add recent changes entries | | `docs/API.md` | Mark beta section deprecated, document `feedback_eligible` in `/me`, link from credit enforcement | | `docs/ARCHITECTURE.md` | Add `user_feedback` collection, mark `beta_feedback` as deprecated | | `docs/archive/2026-03-01-feedback-for-credits.md` | New archive entry | ## Test plan - [x] Docs-only change, no code modified - [x] Verified all internal doc links are valid @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
221f26b0d8 |
UX overhaul: guidance & simplification across all 4 review stages (#421)
## Summary Complete UX overhaul of the karaoke video generation review flow, spanning 4 phases: - **Phase 1 - Job Creation**: Guided audio source selection with 3-tier confidence system, responsive stepper, renamed "Find Audio" to "Choose Audio" - **Phase 2 - Audio Selection**: Production E2E tests for guided job creation flow - **Phase 3 - Lyrics Review**: Guidance panel with workflow steps, gap navigation scoped to visible lines, simplified review UI with edit tracking and low-friction feedback - **Phase 4 - Instrumental Review**: Responsive layout (waveform no longer disappears on short viewports), canvas-rendered time ruler, hover-to-highlight waveform regions, dedicated Alternate Instrumental upload section with duration explanation, dismissable guidance panel ### Key changes - Root layout switches from viewport-locked (`h-screen overflow-hidden`) to scrollable (`min-h-screen`) — fixes waveform disappearing on short viewports - Bottom section stacks vertically on mobile/tablet, side-by-side on desktop - Time ruler rendered directly on canvas with auto-scaling tick intervals - Hovering mute region or segment buttons highlights the corresponding waveform range - Upload button moved from toolbar to dedicated section with context and duration requirement - 21 unit tests added for instrumental review components - Guidance panels with dismissable tips across lyrics and instrumental review ## Test plan - [x] `npx next build` — no errors - [x] `npx jest --testPathPattern="instrumental-review/__tests__"` — 21/21 pass - [x] Visual testing at 4 viewports: desktop (1280x800), tablet (768x1024), mobile (375x667), short (1280x400) - [x] Hover highlight verified with Playwright MCP - [x] Time ruler scales correctly at 1x and 2x zoom @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
0cecc86b79 |
feat: eager audio transcoding for review UI (#395)
## Summary
- Add `AudioTranscodingService` that transcodes FLAC audio to OGG Opus
128kbps (~3 MB vs 35+ MB), cached in GCS at `review-audio/*.ogg`
- Eager transcoding in `screens_worker` before `AWAITING_REVIEW` so
files are cached before the user opens the review UI
- All 3 review audio paths (`_stream_audio`, `get_correction_data`,
`get_instrumental_analysis`) now serve transcoded OGG URLs with FLAC
fallback
- Admin endpoint `POST /admin/jobs/{job_id}/prepare-review-audio` for
backfilling existing jobs
## Test plan
- [x] 21 unit tests at 100% coverage on `AudioTranscodingService`
- [x] 229 existing review tests pass with 0 regressions
- [ ] Deploy and use admin endpoint to backfill job `4bed6f80`
- [ ] Open review UI — verify audio loads fast, Network tab shows ~3 MB
OGG
- [ ] Check GCS for cached files at `jobs/4bed6f80/review-audio/*.ogg`
@coderabbitai ignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
||
|
|
5901137724 |
feat: make state machine transitions robust with explicit failure handling (#370)
## Summary Jobs 06cfea29 and 984da08b got stuck at `pending` status because state transitions failed silently. This comprehensive fix makes the state machine more robust through several improvements: - **Explicit failure handling**: `transition_to_state()` now raises `InvalidStateTransitionError` by default instead of returning False silently - **Centralized processing pattern**: New `start_job_processing()` helper ensures atomic transition + worker trigger across all handlers - **Worker validation**: All workers now validate job status before processing via `validate_worker_can_run()` - **Runtime consistency checks**: New `job_health_service.py` detects stuck jobs and state inconsistencies - **Health endpoint**: `/health/job-consistency` endpoint for admin dashboard integration - **Admin button fixes**: Reset to pending now clears parallel processing flags; removed deprecated states ## Changes ### Core Services - `services/job_manager.py`: Added `InvalidStateTransitionError`, `start_job_processing()`, and updated `transition_to_state()` to raise by default - `services/job_health_service.py`: New service for consistency checks and worker validation - `exceptions.py`: Added `InvalidStateTransitionError` exception class ### API Routes - `routes/health.py`: Added `/health/job-consistency` endpoint - `routes/admin.py`: Updated STATE_DATA_CLEAR_KEYS and ALLOWED_RESET_STATES - `routes/audio_search.py`: Fixed to properly transition from DOWNLOADING_AUDIO to DOWNLOADING - `routes/users.py`: Added error handling for state transition failures - `routes/file_upload.py`: Uses centralized `start_job_processing()` ### Workers - All workers (audio, lyrics, screens, video, render_video): Added status validation via `validate_worker_can_run()` ### Frontend - `admin/jobs/page.tsx`: Replaced "Lyrics" + "Inst." buttons with combined "Review" button ### Tests - 26 tests for job_health_service - 11 integration tests for state machine flow - 4 tests for job-consistency endpoint - Updated existing tests for new exception behavior ### Documentation - `docs/LESSONS-LEARNED.md`: Added "Make State Transitions Loud, Not Silent" entry - `docs/ARCHITECTURE.md`: Added state machine robustness note - `docs/archive/2026-02-02-state-machine-robustness-plan.md`: Complete implementation plan ## Test plan - [x] All 1850+ unit tests pass - [x] CodeRabbit review issues addressed - [ ] Manual verification of admin reset buttons in staging - [ ] Verify stuck jobs are properly detected by `/health/job-consistency` 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- @coderabbitai ignore --> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
29be83cb56 |
Combined review flow: lyrics + instrumental selection in one session (#351)
## Summary Merges the two-step human review process (lyrics review → instrumental selection) into a single unified flow. Users now review lyrics AND select instrumental track in one session. **Benefits:** - Better UX (one interaction vs two) - Reduced drop-off between steps - Single email notification instead of two - Simpler workflow ## Changes ### Backend - `complete_review` endpoint now accepts optional `instrumental_selection` in request body - Backing vocals analysis moved from `render_video_worker` to `screens_worker` (runs before review) - Removed standalone instrumental selection endpoints (now part of combined review) - Added `CompleteReviewRequest` model with validation ### Frontend - New `InstrumentalSelectorEmbedded` component for combined review UI - `LyricsAnalyzer` updated to proceed to instrumental review - `ReviewChangesModal` shows "Proceed to Instrumental Review" button - Mock data updated in E2E tests ### Local CLI - `gen_cli.py` refactored to use `run_combined_review()` instead of separate `run_instrumental_review()` - `ReviewServer` extended with instrumental options and analysis - Deleted standalone `InstrumentalReviewServer` ### Documentation - Updated `docs/README.md` with recent changes entry - Updated `docs/ARCHITECTURE.md` with new pipeline diagram - Updated `docs/API.md` with endpoint changes - Added lesson to `docs/LESSONS-LEARNED.md` ## Test plan - [x] Backend unit tests: 1742 passed - [x] Frontend unit tests: 234 passed - [x] New integration tests: 5 tests for combined flow - [x] New backend tests: 7 tests for CompleteReviewRequest and state_data - [x] New frontend E2E tests: 6 tests for combined flow UI 🤖 Generated with [Claude Code](https://claude.com/claude-code) @coderabbitai ignore --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
cca594c2e0 |
fix: worker reliability improvements and Cloud Run Jobs migration (#346)
## Summary
- **Clear worker progress keys when re-reviewing or resetting jobs** -
Fixes idempotency issue where stale `*_progress` keys would cause
workers to skip execution
- **Migrate lyrics and audio workers to Cloud Run Jobs** - Fixes
instance termination issue where Cloud Run would shut down containers
mid-processing (e.g., job c94cc9d6)
- **GCE encoding file finder excludes old finals outputs** - Fixes
re-encoding picking up old finals/*.mkv instead of fresh source
## Changes
### Worker Progress Clearing
When resetting a job or re-reviewing a completed job, all worker
progress keys (`*_progress`) must be cleared from `state_data`. Workers
check `state_data.{worker}_progress.stage == 'complete'` for idempotency
- if stale keys exist from a previous run, workers will skip execution
even though the job needs reprocessing.
### Cloud Run Jobs Migration
Cloud Run Jobs run to completion without HTTP request lifecycle
concerns, avoiding the instance termination issue where Cloud Run would
shut down instances mid-processing when using BackgroundTasks.
- Added CLI entry points to `lyrics_worker.py` and `audio_worker.py`
- Created Pulumi job definitions (`lyrics-transcription-job`,
`audio-separation-job`)
- Updated `WorkerService` to trigger Cloud Run Jobs via
`run_v2.JobsClient`
- Fast workers (screens, render) remain on HTTP with WorkerRegistry
### GCE Encoding File Finder Fix
When re-encoding after job reset, the file finder was picking up old
finals/*.mkv files. Fixed by:
- Adding lowercase patterns to match 'with_vocals.mkv'
- Prioritizing videos/ subdirectory in search order
- Excluding finals/, outputs/, and encoded output filenames
## Test plan
- [x] Backend tests pass (46 tests)
- [x] New tests for Cloud Run Jobs triggering
- [x] Regression tests for file finder pattern matching
- [x] Production verified: lyrics job c94cc9d6 completed successfully
via Cloud Run Job (95.5s)
@coderabbitai ignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|
|
b68a46d174 |
feat(infra): Implement immutable deployment pattern for encoding worker (#333)
## Summary - Implements robust deployment pattern for GCE encoding worker to eliminate recurring version mismatch issues - Fixed wheel path (`karaoke_gen-current.whl`) eliminates version sorting bugs - Self-updating startup script downloaded from GCS on every service start - Version manifest with strict CI verification (deployment fails on mismatch) ## Problem The encoding worker had recurring version issues because: - `startup.sh` was baked into the Packer image (required rebuild + VM recreation) - Wheel selection used version sorting across 51 files - CI only warned on version mismatch, didn't fail - Multiple deployment vectors (CI, Pulumi, manual SSH) caused drift ## Solution 1. **Fixed wheel path**: CI uploads to `karaoke_gen-current.whl` (no sorting needed) 2. **Self-updating startup**: `bootstrap.sh` downloads `startup.sh` from GCS on every start 3. **Version manifest**: CI writes expected version, service verifies before starting 4. **Strict CI verification**: Deployment fails if version doesn't match (was just warning) ## Changes - **New**: `infrastructure/encoding-worker/` with `bootstrap.sh`, `startup.sh`, README - **Modified**: CI workflow for fixed paths and strict verification - **Modified**: Packer `provision.sh` for bootstrap pattern - **Updated**: `LESSONS-LEARNED.md` with immutable deployment pattern - **Updated**: `docs/README.md` and `docs/ARCHITECTURE.md` ## Test plan - [x] Shell scripts validated (`bash -n`) - [x] Backend tests pass (1703 passed) - [x] CodeRabbit review passed - [ ] After merge: Rebuild Packer image - [ ] After merge: Recreate VM to use new image - [ ] After merge: Verify first deployment uses new pattern ## Post-Merge Steps Required 1. Rebuild Packer image: `packer build infrastructure/packer/encoding-worker.pkr.hcl` 2. Recreate VM: Delete encoding-worker, run `pulumi up` 🤖 Generated with [Claude Code](https://claude.com/claude-code) @coderabbitai ignore --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
2947dd05bc |
refactor: consolidate YouTube downloads into YouTubeDownloadService (#322)
## Summary - Consolidates all YouTube download paths into a single `YouTubeDownloadService` - Ensures YouTube downloads always route through flacfetch remote when configured (avoids bot detection on Cloud Run) - Both entry points (audio search selection AND direct URL submission) now use the same service - Clear error messaging when remote is unavailable ## Problem YouTube downloads were failing in cloud because: 1. Direct YouTube downloads from Cloud Run get blocked by bot detection 2. There were 3 different code paths for YouTube downloads with inconsistent handling 3. Some paths weren't passing `gcs_path` to flacfetch, causing file access issues ## Changes ### New Files - `backend/services/youtube_download_service.py` - Consolidated service for all YouTube downloads - `backend/tests/test_youtube_download_service.py` - 20 unit tests - `backend/tests/integration/test_youtube_flow.py` - 8 integration tests ### Modified Files - `backend/api/routes/audio_search.py` - Route YouTube to YouTubeDownloadService - `backend/api/routes/file_upload.py` - Download YouTube before triggering workers - `backend/workers/audio_worker.py` - Mark legacy fallback as deprecated - `backend/services/audio_search_service.py` - Fix source_id extraction - `docs/ARCHITECTURE.md` - Add audio source download flow diagram ## Test Plan - [x] 20 unit tests for YouTubeDownloadService - [x] 8 integration tests for YouTube flow routing - [x] Updated existing tests to mock new service - [x] All 1630+ backend tests pass @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
83c54803ef |
feat: disable auto-correction during lyrics transcription (#321)
## Summary - Disabled all auto-correction during lyrics transcription (both agentic AI via Gemini and heuristic rule-based handlers) - Raw transcription now goes directly to human review without automatic fixes - This change was made because auto-correction was creating more work for reviewers by introducing errors that needed manual correction ## Changes - Added `SKIP_CORRECTION` env var (default: `true`) in `backend/config.py` - Updated `LyricsProcessor` to check skip_correction and set `run_correction=False` - Added `_create_uncorrected_result()` method to controller for review UI compatibility - Updated docs to reflect disabled status ## How to Re-enable Set `SKIP_CORRECTION=false` environment variable to re-enable auto-correction if quality improves in the future. ## Test plan - [x] All 1605 tests pass - [x] Test review: Changes are configuration-driven, existing code paths remain tested - [x] CodeRabbit review: Passed clean @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
c3eb794d7d |
fix: prevent Cloud Run from killing workers during parallel processing (#315)
## Summary - Fix bug where Cloud Run could shut down prematurely when one parallel worker completed while another was still running - Add WorkerRegistry to track active workers per job - Add shutdown handler that waits for workers to complete before allowing container termination ## Background Job `9ed3b0a1` failed because Cloud Run shut down at 05:31:06 immediately after the audio worker completed, while the lyrics correction worker was still processing. Workers run in BackgroundTasks, and when one completes, Cloud Run sees no active requests and can terminate the container. ## Changes - **New `backend/workers/registry.py`**: WorkerRegistry class that tracks active workers - **Updated `backend/workers/audio_worker.py`**: Register/unregister with registry - **Updated `backend/workers/lyrics_worker.py`**: Register/unregister with registry - **Updated `backend/main.py`**: Shutdown handler waits for workers (10 min timeout) - **New tests**: 11 unit tests for WorkerRegistry - **Docs**: Updated ARCHITECTURE.md, LESSONS-LEARNED.md, README.md ## Test plan - [x] Unit tests pass (11 new tests for WorkerRegistry) - [x] All 220 worker-related tests pass - [x] All 7 main.py tests pass - [ ] E2E happy path test after deployment @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
|
|
42c304dcdf |
feat(multitenancy): Implement white-label B2B portal infrastructure (#241)
## Summary
Adds multi-tenant white-label portal infrastructure for B2B customers.
Vocal Star is the first tenant at `vocalstar.nomadkaraoke.com`.
## Changes
### Backend
- **Tenant Models** (`backend/models/tenant.py`): Pydantic models for
TenantConfig with branding, features, defaults, and auth settings
- **Tenant Service** (`backend/services/tenant_service.py`): GCS-backed
config loading with 5-min cache, signed URL generation for logos
- **Tenant API** (`backend/api/routes/tenant.py`): `GET
/api/tenant/config` and `GET /api/tenant/config/{tenant_id}` endpoints
- **Tenant Middleware** (`backend/middleware/tenant.py`): Extracts
tenant from X-Tenant-ID header, query param (dev only), or Host
subdomain
- **Auth Updates**: Email domain validation for tenant-restricted auth,
sender email override
- **Feature Enforcement**: Audio search endpoint checks
`features.audio_search`, returns 403 if disabled
- **Job Scoping**: Added `tenant_id` field to JobCreate
### Frontend
- **Tenant Store** (`frontend/lib/tenant.ts`): Zustand store with tenant
state, `useTenant()` hook, CSS variable application
- **TenantProvider** (`frontend/components/tenant-provider.tsx`):
Hydration-safe initialization via useEffect
- **TenantLogo** (`frontend/components/tenant-logo.tsx`): Dynamic logo
with fallback to Nomad Karaoke
- **Feature-Flagged UI**: Tabs conditionally rendered based on tenant
features, active tab sync
- **Locked Themes**: `defaults.locked_theme` hides theme selector and
enforces specific theme
- **Output Links**: Filtered based on distribution features
### Security
- Query param tenant detection disabled in production (prevents
spoofing)
- Strict subdomain patterns: only `{tenant}.nomadkaraoke.com` or
`{tenant}.gen.nomadkaraoke.com`
- PII masking in logs (`an***@vo***.com`)
- `is_active` check prevents inactive tenants from being used
### Documentation
- ARCHITECTURE.md: New Multitenancy section
- API.md: Tenant Config endpoints
- LESSONS-LEARNED.md: 3 new lessons on multitenancy patterns
- Archive: Comprehensive implementation document
### Setup
- `scripts/setup-vocalstar-tenant.py`: Uploads theme assets, creates
tenant/theme configs in GCS
## Vocal Star Configuration
- **Subdomain**: `vocalstar.nomadkaraoke.com`
- **Features**: File upload only (no audio search, no YouTube URL)
- **Distribution**: Download only (no YouTube/Dropbox/GDrive)
- **Theme**: Locked to "vocalstar" (yellow/blue)
- **Auth**: Restricted to `@vocal-star.com` and `@vocalstarmusic.com`
emails
## Testing
- [x] Frontend TypeScript build passes
- [x] CodeRabbit CLI review completed (3 cycles, all issues fixed)
- [x] Manual testing with `?tenant=vocalstar` query param
## Next Steps (post-merge)
1. Configure DNS: CNAME for `vocalstar.nomadkaraoke.com`
2. Update Cloudflare Pages for subdomain
3. Run setup script to upload Vocal Star assets to GCS
4. Test at `https://vocalstar.nomadkaraoke.com`
@coderabbitai ignore
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|
|
2e71dc3158 |
feat(infra): Upgrade encoding worker to c4d-highcpu-32 (4.92x faster) (#244)
## Summary Upgrades the GCE encoding worker from c4-standard-8 (Intel Xeon) to c4d-highcpu-32 (AMD EPYC 9B45 Turin), achieving **4.92x faster encoding performance** based on rigorous benchmarking. ## Changes - **Infrastructure**: Updated `MachineTypes.ENCODING_WORKER` to `c4d-highcpu-32` in `config.py` - **Documentation**: Comprehensive benchmark results in `docs/archive/2026-01-08-performance-investigation.md` - **Lessons Learned**: Added "GCE Instance Type Selection for FFmpeg Encoding" section - **Benchmark Scripts**: Added reusable scripts for future infrastructure testing: - `scripts/benchmark_encoding.py` - Local Python benchmark using actual code paths - `scripts/benchmark_encoding_gce.sh` - Shell benchmark for GCE VMs - `scripts/benchmark_candidates.sh` - Multi-VM orchestration for comparative testing ## Benchmark Results | Instance | CPU | Total Time | vs Baseline | |----------|-----|------------|-------------| | c4-standard-8 (baseline) | Intel Xeon | 666s | 1.00x | | c4-highcpu-16 | Intel Xeon | 309s | 2.16x | | c4a-highcpu-16 | Google Axion ARM | 248s | 2.69x | | c4d-highcpu-16 | AMD EPYC 9B45 | 220s | 3.03x | | **c4d-highcpu-32** | **AMD EPYC 9B45** | **135s** | **4.92x** | Key finding: AMD EPYC Turin significantly outperforms Intel Granite Rapids for CPU-bound FFmpeg/libass workloads. ## Testing - [x] Benchmarked on actual GCE instances with production data - [x] Verified c4d-highcpu-32 uses hyperdisk-balanced (already configured) - [ ] Infrastructure deploys via CI after merge ## Deployment Impact ⚠️ Changing machine type will cause Pulumi to **replace** the VM (~1-2 min downtime). Jobs queued during restart will retry automatically. @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
560c3e4904 |
feat: Add email notification system with admin controls (#220)
## Summary
- Add automated email notification system for job completion and action
reminders
- Admin UI buttons to copy completion message or send email directly
- Comprehensive test suite (81 new tests)
- **Email subjects include release ID and song info** for easy
identification
## Changes
### Backend
- **Email Service** (`email_service.py`): Extended with SendGrid CC
support, `send_job_completion()` and `send_action_reminder()` methods
- **Job Notification Service** (`job_notification_service.py`): New
service orchestrating completion emails and action reminder scheduling
- **Template Service** (`template_service.py`): GCS-backed HTML email
templates with fallback defaults
- **Worker Service** (`worker_service.py`): Cloud Tasks integration for
delayed idle reminders (5-min delay)
- **Job Manager** (`job_manager.py`): State transition triggers for
automated notifications
- **Admin Routes** (`admin.py`): New endpoints `GET
/api/admin/jobs/{id}/completion-message` and `POST
/api/admin/jobs/{id}/send-completion-email`
- **Internal Routes** (`internal.py`): Idle reminder check endpoint for
Cloud Tasks
### Email Subject Format
Email subjects now include brand code and song info for easy
identification:
- With brand code: `NOMAD-1178: Seether - Tonight (Your karaoke video is
ready!)`
- Without brand code: `Seether - Tonight (Your karaoke video is ready!)`
- Without song info: `Your karaoke video is ready!`
### Frontend
- **OutputLinks Component**: Admin-only "Copy Message" and "Send Email"
buttons with dialog UI
- **E2E Helpers** (`email-testing.ts`): `waitForCompletionEmail()` and
`isCompletionEmail()` methods for testmail.app integration
- **Happy Path Test**: Step 9.5 verifies completion email arrives after
job completion
### Documentation
- Updated API.md with new endpoints
- Updated ARCHITECTURE.md with notification system architecture
- Updated README.md Recent Changes
## Testing
- [x] 81 new unit tests covering:
- `test_email_service.py` (27 tests) - providers, CC support, job
completion/reminder methods
- `test_job_notification_service.py` (21 tests) - URL building, message
generation
- `test_job_manager_notifications.py` (15 tests) - state transition
triggers
- `test_admin_email_endpoints.py` (12 tests) - admin API endpoints
- `test_template_service.py` (6 tests) - GCS template loading, fallbacks
- [x] E2E test extended to verify completion email delivery
- [x] All backend tests pass (`make test`)
- [x] TypeScript compiles
## Feature Flags
- `ENABLE_AUTO_EMAILS` (default: `false`) - Controls automatic email
sending on job state changes
## Review
- [x] Local CodeRabbit review completed (3 cycles)
- [x] Review feedback addressed:
- Fixed potential None state_data in internal.py
- Masked user emails in logs (PII protection)
- Fixed React setTimeout memory leak
- Changed placeholder URL default to empty
- Added CC email deduplication
@coderabbitai ignore
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|
|
b345135be1 |
feat: Unify GCE encoding with LocalEncodingService (single code path) (#214)
## Summary - Unifies GCE encoding worker with LocalEncodingService (same code as local CLI) - Removes all fallback/simplified encoding logic - Produces proper filenames: `Artist - Title (Final Karaoke Lossless 4k).mp4` - Includes concatenated title + karaoke + end screens - CI uploads wheel to GCS for hot code updates without restart ## Problem Cloud/remote karaoke generation was using simplified, duplicated encoding logic that: - Used generic filenames like `output_4k_lossless.mp4` - Did NOT concatenate title + karaoke + end screens - Was missing MKV format for YouTube uploads ## Solution GCE worker now: 1. Downloads latest karaoke-gen wheel from GCS at job start 2. Imports and uses `LocalEncodingService` (same as local CLI) 3. Produces identical output to local karaoke-gen ## Test plan - [ ] Run a cloud generation job after merging - [ ] Verify output files have proper names - [ ] Verify videos include title/end screens - [ ] Verify Dropbox/GDrive uploads work correctly @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
be04d3efaf |
feat: Offload preview video encoding to GCE for faster generation (#200)
## Summary - Move preview video encoding from Cloud Run to GCE encoding worker - Reduce preview generation time from 60+ seconds to ~15-20 seconds - Improve UX during lyrics review by dramatically speeding up preview generation ## Changes - **GCE Worker** (`infrastructure/__main__.py`): Add `/encode-preview` endpoint with `EncodePreviewRequest` model, FFmpeg command for 480x270 preview encoding, and FFmpeg filter path escaping - **EncodingService** (`backend/services/encoding_service.py`): Add `is_preview_enabled` property, `submit_preview_encoding_job()`, and `encode_preview_video()` methods - **Config** (`backend/config.py`): Add `USE_GCE_PREVIEW_ENCODING` setting (default: false) - **Review Route** (`backend/api/routes/review.py`): Modify `generate_preview_video()` to use GCE with fallback to local encoding - **LyricsTranscriber** (`operations.py`, `generator.py`): Add `ass_only` parameter to generate ASS subtitles without video encoding - **Documentation**: Update ARCHITECTURE.md and LESSONS-LEARNED.md ## Technical Approach The optimization splits preview generation into two phases: 1. **ASS Generation (Cloud Run)** - Fast text processing (~2s) 2. **Video Encoding (GCE)** - Offloaded to C4-standard-8 VM (~15-20s) If GCE encoding fails or is disabled, falls back to local Cloud Run encoding. ## Testing - [x] Unit tests pass (1004 tests) - [x] Emulator tests pass (68 tests) - [x] CodeRabbit CLI review completed locally ## Deployment 1. Deploy infrastructure changes (`pulumi up` or restart GCE worker) 2. Deploy backend to Cloud Run 3. Enable via `USE_GCE_PREVIEW_ENCODING=true` in Cloud Run env @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
ae85ec0a09 |
feat: Move worker logs to Firestore subcollection to avoid 1MB limit (#195)
## Summary
Move `worker_logs` from embedded array in job documents to a Firestore
subcollection (`jobs/{job_id}/logs`) to avoid the 1MB document size
limit. This fixes job failures when logs exceed the limit during
long-running operations like video encoding.
**Problem:** Job `501258e1` failed when logs reached 1.26MB (2,547 log
entries), representing 98.6% of the maximum document size.
## Changes
### New Files
- `backend/models/worker_log.py` - WorkerLogEntry dataclass with factory
methods, serialization (to_dict, to_legacy_dict, from_dict)
- `backend/tests/test_worker_log_subcollection.py` - 24 unit tests
- `backend/tests/emulator/test_worker_logs_subcollection.py` - 11
integration tests using Firestore emulator
### Modified Files
- `backend/services/firestore_service.py` - Added subcollection methods
(append, get, count, delete)
- `backend/services/job_manager.py` - Use subcollection with fallback to
legacy embedded arrays
- `backend/api/routes/jobs.py` - Updated logs endpoint to use new
methods
- `backend/config.py` - Added `USE_LOG_SUBCOLLECTION` feature flag
(default: true)
- `infrastructure/__main__.py` - Added TTL policy (30 days) and
composite index for logs subcollection
- `pyproject.toml` - Version bump 0.89.6 → 0.90.0
### Documentation
- `docs/README.md` - Added to Recent Changes
- `docs/ARCHITECTURE.md` - Added logs subcollection to Firestore
Collections table
- `docs/LESSONS-LEARNED.md` - Added "Firestore Document 1MB Limit with
Embedded Arrays" section
## Testing
- [x] 24 unit tests pass
(`backend/tests/test_worker_log_subcollection.py`)
- [x] 11 emulator integration tests pass
(`backend/tests/emulator/test_worker_logs_subcollection.py`)
- [x] All 68 existing emulator tests pass
## Review
- [x] CodeRabbit CLI review completed locally
- [x] Review feedback addressed (timestamp formatting fix)
## Rollback Plan
Set `USE_LOG_SUBCOLLECTION=false` environment variable and redeploy. New
logs will go back to embedded array; subcollection logs will remain but
won't be read.
@coderabbitai ignore
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
|
||
|
|
1b0521cb83 |
docs: Add video worker orchestrator documentation (#183)
## Summary - Add entry to README.md Recent Changes section for orchestrator refactor - Add Video Worker Orchestrator section to ARCHITECTURE.md with diagram - Add "Alternative Code Paths Must Implement All Features" lesson to LESSONS-LEARNED.md - Create archive entry documenting the refactor ## Changes - `docs/README.md` - Added recent change entry - `docs/ARCHITECTURE.md` - Added orchestrator section with stage diagram - `docs/LESSONS-LEARNED.md` - Added lesson about code path divergence - `docs/archive/2026-01-04-video-worker-orchestrator-refactor.md` - Full documentation ## Context Documentation for PR #182 which unified the video worker pipeline. @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
cbf3b815dd |
docs: Add gen_users migration documentation (#174)
## Summary Adds documentation for the gen_users migration completed in PR #173. - **README.md**: Add entry in Recent Changes about user database separation - **ARCHITECTURE.md**: Add Firestore Collections section documenting `gen_users` and other collections - **LESSONS-LEARNED.md**: Add lesson about separate collections for multi-app projects ## Test plan - [x] Documentation-only change, no testing required @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
593aac9e09 |
fix: Use recursive glob for GCE encoding worker file discovery (#166)
## Summary
- Fix GCE encoding worker failing with "No video files found" error
- Files downloaded from GCS preserve directory structure (e.g.,
`videos/with_vocals.mkv`, `stems/instrumental_clean.flac`)
- Original code used non-recursive glob patterns that only searched root
directory
## Changes
- Use recursive glob patterns (`**/*.mkv`) to find files in
subdirectories
- Add filter to exclude outputs directory to avoid re-encoding previous
outputs
- Add case-insensitive patterns for instrumental files (GCS uses
lowercase)
## Test plan
- [x] Fix deployed to production via Pulumi (VM recreated with updated
startup script)
- [x] Encoding worker health check verified:
`{"status":"ok","active_jobs":0,"queue_length":0}`
- [ ] Manual test: Submit a job through the frontend to verify GCE
encoding works end-to-end
## Notes
This fix was hotfixed to production via Pulumi to unblock users. The GCE
encoding worker VM was replaced with the corrected startup script. This
PR captures the fix in git.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
@coderabbitai ignore
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|
|
c9d2ecfdcb |
docs: update documentation for agentic AI correction feature
- Add Agentic AI correction status to README - Add Vertex AI to external services in ARCHITECTURE.md - Add Vertex AI authentication lesson to LESSONS-LEARNED.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
a3f0c08f99 |
fix: Address markdown linting issues from CodeRabbit review
- Wrap bare URLs in angle brackets in CLAUDE.md (MD034) - Add language specifiers to fenced code blocks (MD040): - `text` for directory structures and ASCII diagrams - `http` for HTTP request examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
986a5e499f |
docs: Restructure documentation for LLM agent clarity
## Summary Complete documentation reorganization to make it more effective for AI agents working on this codebase. ## Changes Made - Consolidated 88 docs into 5 active files + archive - New structure: README.md, ARCHITECTURE.md, DEVELOPMENT.md, API.md, LESSONS-LEARNED.md - Added Claude Code slash commands: /docs-review (pre-merge), /docs-maintain (periodic) - Updated CLAUDE.md with documentation maintenance rules - Moved all historical docs to docs/archive/ with YYYY-MM-DD prefixes ## New Documentation Structure ``` docs/ ├── README.md # Current status + navigation ├── ARCHITECTURE.md # System design ├── DEVELOPMENT.md # Dev setup, testing, deployment ├── API.md # Backend API reference ├── LESSONS-LEARNED.md # Key insights for future agents └── archive/ # 93 historical docs with date prefixes ``` ## Testing - All 57 backend tests pass - No code changes, docs-only reorganization 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |