Compare commits

...
Author SHA1 Message Date
Andrew BeveridgeandClaude Opus 4.5 30384c19c6 fix: Complete mailslurp to testmail.app migration
Update remaining references from MailSlurp to testmail.app:
- .github/workflows/ci.yml - use TESTMAIL_API_KEY/TESTMAIL_NAMESPACE
- docs/E2E-HAPPY-PATH-TEST-SPEC.md - update documentation
- frontend/e2e/production/happy-path-real-user.spec.ts - update comments

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 12:41:24 -05:00
Andrew BeveridgeandClaude Opus 4.5 5fb5be4f96 fix(ci): Update E2E workflow to use testmail.app secrets
The workflow was still referencing MAILSLURP_API_KEY but the migration
to testmail.app uses TESTMAIL_API_KEY and TESTMAIL_NAMESPACE.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 12:38:28 -05:00
Andrew BeveridgeandClaude Opus 4.5 d421ee6275 docs: Add GCE encoding worker documentation and lessons learned
- Update ARCHITECTURE.md with GCE encoding worker in system diagram
- Add GCE encoding feature to README.md recent changes
- Add lesson learned about GCS directory structure preservation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 12:21:57 -05:00
Andrew BeveridgeandClaude Opus 4.5 debb9069d7 fix: Use recursive glob for GCE encoding worker file discovery
The GCS download preserves directory structure (videos/with_vocals.mkv,
stems/instrumental_clean.flac), but the encoding worker was using
non-recursive glob patterns (*.mkv) that only searched the root directory.

Changes:
- Use recursive glob patterns (**/*.mkv) to find files in subdirectories
- Add filter to exclude outputs directory to avoid re-encoding
- Add case-insensitive patterns for instrumental files (GCS uses lowercase)

This fixes the "No video files found" error when using GCE encoding.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 12:19:04 -05:00
9 changed files with 66 additions and 24 deletions

No files matched your search

+2 -1
View File
@@ -225,7 +225,8 @@ jobs:
- name: Run Happy Path Production Test
working-directory: frontend
env:
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
TESTMAIL_API_KEY: ${{ secrets.TESTMAIL_API_KEY }}
TESTMAIL_NAMESPACE: ${{ secrets.TESTMAIL_NAMESPACE }}
E2E_TEST_TOKEN: ${{ secrets.E2E_TEST_TOKEN }}
E2E_ADMIN_TOKEN: ${{ secrets.E2E_ADMIN_TOKEN }}
run: |
+2 -1
View File
@@ -70,7 +70,8 @@ jobs:
- name: Run E2E Happy Path Test
working-directory: frontend
env:
MAILSLURP_API_KEY: ${{ secrets.MAILSLURP_API_KEY }}
TESTMAIL_API_KEY: ${{ secrets.TESTMAIL_API_KEY }}
TESTMAIL_NAMESPACE: ${{ secrets.TESTMAIL_NAMESPACE }}
E2E_TEST_TOKEN: ${{ inputs.use_test_token == 'true' && secrets.E2E_TEST_TOKEN || '' }}
E2E_ADMIN_TOKEN: ${{ secrets.E2E_ADMIN_TOKEN }}
DEBUG_MODE: ${{ inputs.debug_mode || 'false' }}
+9 -6
View File
@@ -23,12 +23,15 @@
│ • Video Worker - Final assembly and encoding │
└───────────────────────────┬─────────────────────────────────────┘
│
┌─────────────┼─────────────┐
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────────┐
│ Firestore│ │ GCS │ │Secret Manager│
│ (jobs) │ │ (files) │ │ (API keys) │
└──────────┘ └──────────┘ └──────────────┘
┌─────────────┼─────────────┬───────────────┐
▼ ▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────────┐ ┌──────────────┐
│ Firestore│ │ GCS │ │Secret Manager│ │GCE Encoding │
│ (jobs) │ │ (files) │ │ (API keys) │ │ Worker (*) │
└──────────┘ └──────────┘ └──────────────┘ └──────────────┘
(*) GCE Encoding Worker: C4-standard-8 VM with Intel Granite Rapids for
high-performance FFmpeg encoding. Optional - falls back to Cloud Run.
```
## Processing Pipeline
+7 -5
View File
@@ -14,14 +14,14 @@
## Test Requirements
### 1. New User Registration (MailSlurp)
### 1. New User Registration (testmail.app)
- [ ] Navigate to landing page (`gen.nomadkaraoke.com`)
- [ ] Click "Sign In" or "Get Started" button
- [ ] Create a NEW MailSlurp inbox (fresh email address for each test run)
- [ ] Create a NEW testmail.app inbox (fresh email address for each test run)
- [ ] Enter the test email in the beta enrollment form
- [ ] Submit the form
- [ ] Wait for welcome/magic-link email in MailSlurp inbox
- [ ] Wait for welcome/magic-link email in testmail.app inbox
- [ ] Extract the magic link from the email
- [ ] Click/navigate to the magic link to authenticate
- [ ] Verify user is logged in and has credits
@@ -118,7 +118,8 @@
### Environment Variables
```bash
MAILSLURP_API_KEY=xxx # Required - for email testing
TESTMAIL_API_KEY=xxx # Required - for email testing
TESTMAIL_NAMESPACE=xxx # Required - testmail.app namespace
# No pre-auth tokens - test handles full signup
```
@@ -160,7 +161,8 @@ Log detailed progress at each step with timestamps for debugging.
### Secrets Required
- `MAILSLURP_API_KEY` - For email testing
- `TESTMAIL_API_KEY` - For email testing
- `TESTMAIL_NAMESPACE` - testmail.app namespace
### Workflow Steps
+25
View File
@@ -770,6 +770,31 @@ result = job.state_data['search_results'][selection_index]
**Lesson**: Design for stateless request handling. Any state that must survive between requests must be persisted externally.
### GCS Downloads Preserve Directory Structure
**Problem**: When downloading files from GCS, the directory structure is preserved. Code that uses non-recursive glob patterns won't find files in subdirectories.
**Example**: GCE encoding worker downloaded from `gs://bucket/jobs/{job_id}/` but files were stored as:
- `videos/with_vocals.mkv`
- `stems/instrumental_clean.flac`
The original code used `work_dir.glob("*.mkv")` which only searched the root directory, causing "No video files found" errors.
**Solution**: Use recursive glob patterns and filter results:
```python
# BAD - only searches root directory
input_files = list(work_dir.glob("*.mkv"))
# GOOD - searches all subdirectories
input_files = list(work_dir.glob("**/*.mkv"))
# Filter out outputs directory to avoid re-encoding
input_files = [f for f in input_files if "outputs" not in str(f)]
```
**Related gotcha**: Case sensitivity matters. GCS stores filenames as-is, so if files are uploaded as `instrumental_clean.flac` (lowercase), searching for `*Instrumental*.flac` (capital I) won't find them. Use case-insensitive patterns or search for both cases.
**Lesson**: When writing code that processes files downloaded from GCS, always use recursive glob patterns and verify the expected directory structure matches what's actually stored.
### Library Caches Need GCS Sync in Cloud Run
**Problem**: Libraries like LyricsTranscriber cache API responses to local directories (e.g., `~/lyrics-transcriber-cache`). In Cloud Run, each container is ephemeral - the cache is lost on every restart or scale-up, causing redundant API calls.
+2
View File
@@ -34,6 +34,8 @@
## Recent Changes
- **GCE Encoding Worker** (2026-01-03): Added optional high-performance encoding on dedicated GCE VM (C4-standard-8 with Intel Granite Rapids 3.9 GHz). Uses `USE_GCE_ENCODING=true` env var. Falls back to Cloud Run if unavailable. See [ARCHITECTURE.md](ARCHITECTURE.md).
- **Runner Disk Space Auto-Cleanup** (2026-01-03): Fixed CI failures caused by self-hosted runners filling up with Docker images. Changed cleanup from daily/7-day-old to hourly/threshold-based (70%). Added pre-job disk checks to all self-hosted CI jobs. See [LESSONS-LEARNED.md](LESSONS-LEARNED.md#docker-disk-space-management-on-self-hosted-runners)
- **E2E Happy Path Test** (2026-01-02): Added comprehensive E2E test that validates the complete karaoke generation journey using ONLY browser UI interactions (no API shortcuts). Test covers all 12 steps from landing page through cleanup. Runs daily via GitHub Actions and takes ~38 minutes. See [E2E-HAPPY-PATH-TEST-SPEC.md](E2E-HAPPY-PATH-TEST-SPEC.md)
@@ -11,7 +11,7 @@ import { createEmailHelper, isEmailTestingAvailable } from '../helpers/email-tes
*
* Test Flow:
* 1. Landing Page - Navigate and verify
* 2. New User Signup - Create MailSlurp inbox, submit beta form, verify email
* 2. New User Signup - Create testmail.app inbox, submit beta form, verify email
* 3. Magic Link Auth - Click magic link to authenticate
* 4. Create Job - Search for test song via UI
* 5. Audio Selection - Select audio source via UI dialog
@@ -24,7 +24,7 @@ import { createEmailHelper, isEmailTestingAvailable } from '../helpers/email-tes
* 12. Cleanup - Delete distributed content and job
*
* Environment Variables:
* - MAILSLURP_API_KEY: Required for email testing (can be skipped with E2E_TEST_TOKEN)
* - TESTMAIL_API_KEY + TESTMAIL_NAMESPACE: Required for email testing (can be skipped with E2E_TEST_TOKEN)
* - E2E_TEST_TOKEN: Pre-configured user token to skip signup flow (for iterations)
* - E2E_ADMIN_TOKEN: Required for cleanup endpoint (optional - cleanup skipped if not set)
*/
@@ -138,12 +138,12 @@ test.describe('E2E Happy Path - Real User with Full UI Interactions', () => {
}) => {
test.setTimeout(TIMEOUTS.fullTest);
// Check if we have a pre-configured token (for iterations without using MailSlurp)
// Check if we have a pre-configured token (for iterations without using testmail.app)
const usePreConfiguredToken = hasPreConfiguredToken();
// Skip if neither pre-configured token nor MailSlurp is available
// Skip if neither pre-configured token nor testmail.app is available
if (!usePreConfiguredToken && !isEmailTestingAvailable()) {
test.skip(true, 'Neither E2E_TEST_TOKEN nor MAILSLURP_API_KEY set - cannot run test');
test.skip(true, 'Neither E2E_TEST_TOKEN nor TESTMAIL_API_KEY/TESTMAIL_NAMESPACE set - cannot run test');
return;
}
@@ -217,7 +217,7 @@ test.describe('E2E Happy Path - Real User with Full UI Interactions', () => {
console.log('STEP 3 COMPLETE: User authenticated with pre-configured token');
} else {
// ----- FULL PATH: Beta signup with MailSlurp -----
// ----- FULL PATH: Beta signup with testmail.app -----
console.log('\n========================================');
console.log('STEP 2: New User Beta Enrollment');
console.log('========================================');
+12 -4
View File
@@ -1237,8 +1237,10 @@ def run_encoding(job_id: str, work_dir: Path, config: dict):
jobs[job_id]["progress"] = 10
try:
# Find input files
input_files = list(work_dir.glob("*.mkv")) + list(work_dir.glob("*.mp4")) + list(work_dir.glob("*.mov"))
# Find input files (search recursively since GCS downloads preserve directory structure)
input_files = list(work_dir.glob("**/*.mkv")) + list(work_dir.glob("**/*.mp4")) + list(work_dir.glob("**/*.mov"))
# Exclude files in the outputs directory to avoid re-encoding previous outputs
input_files = [f for f in input_files if "outputs" not in str(f)]
if not input_files:
raise ValueError(f"No video files found in {work_dir}")
@@ -1246,8 +1248,14 @@ def run_encoding(job_id: str, work_dir: Path, config: dict):
input_video = input_files[0]
logger.info(f"Using input video: {input_video}")
# Find instrumental audio
instrumental_files = list(work_dir.glob("*Instrumental*.flac")) + list(work_dir.glob("*Instrumental*.wav"))
# Find instrumental audio (search recursively, case-insensitive patterns)
# GCS stores as: instrumental_clean.flac, instrumental_with_backing.flac
instrumental_files = (
list(work_dir.glob("**/*instrumental*.flac")) +
list(work_dir.glob("**/*instrumental*.wav")) +
list(work_dir.glob("**/*Instrumental*.flac")) +
list(work_dir.glob("**/*Instrumental*.wav"))
)
instrumental = instrumental_files[0] if instrumental_files else None
output_dir = work_dir / "outputs"
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "karaoke-gen"
version = "0.87.0"
version = "0.87.1"
description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens."
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
license = "MIT"