Commit Graph
19 Commits
Author SHA1 Message Date
Andrew Beveridge f699850d30 feat: rewrite local review server with FastAPI and full-featured standalone UI
- Replace http.server with FastAPI for better async/CORS support
- Add complete standalone HTML/CSS/JS frontend with all features:
  - Dark theme matching React frontend
  - Interactive waveform display with Canvas rendering
  - Audio playback with source selection
  - Region selection via click/drag or quick-add from segments
  - Custom instrumental creation
  - Final selection submission with success feedback
- API endpoints now match cloud backend for true feature parity
- Update CLI parity tests for new FastAPI-based server structure
- Add test-instrumental-review.py script for local testing

This enables the same user experience for instrumental review
whether running locally (karaoke-gen) or remotely (karaoke-gen-remote).

Version bump: 0.71.38 → 0.71.39
2025-12-11 18:08:04 -05:00
Andrew Beveridge c632e68b5b Updated workflow to push on all branches 2025-12-10 21:54:06 -05:00
Andrew Beveridge 112919b55f Fix emulator test script to use poetry run pytest 2025-12-10 13:48:42 -05:00
Andrew Beveridge 4fe9a98698 Added karaoke-gen-remote CLI to submit remote jobs 2025-12-08 03:53:32 -05:00
Andrew Beveridge 60de3f9108 Add auto-download of output files on job completion
When a karaoke job completes, the submit-job.sh script now automatically
downloads all output files using gsutil:
- Final videos (mp4, mkv in various qualities)
- Lyrics files (ass, lrc, corrected.txt)
- Audio stems (instrumental, vocals, backing)

Files are saved to output/{artist}-{title}-{job_id}/ directory.
2025-12-08 03:19:20 -05:00
Andrew Beveridge 58ccc4324e Optimize CI/CD: faster builds with base image and Cloud Build
- Add .gcloudignore to reduce upload from 43K files to 317 files (99% less)
- Create Dockerfile.base with pre-built dependencies (~15 min, only when deps change)
- Update Dockerfile to use base image (app builds now ~1-2 min)
- Upgrade Cloud Build to N1_HIGHCPU_32 for faster compilation
- Move Docker build from GitHub Actions to Cloud Build (faster GCP network)
- Fix signed URL generation for Cloud Run (use IAM signBlob API)
- Update submit-job.sh to poll for review completion instead of waiting for Enter
- Sync Cloud Run deploy settings (16Gi RAM, 8 CPU, gen2, proper secrets)
2025-12-08 03:00:22 -05:00
Andrew Beveridge 8cc00ddffb Fix review UI URL to pass baseApiUrl parameter
The lyrics transcriber frontend expects:
- baseApiUrl: URL-encoded path to /api/review/{job_id}
- audioHash: optional audio hash for the review

This matches the parameter names expected by the frontend's App.tsx
2025-12-08 01:26:29 -05:00
Andrew Beveridge 191d73bb63 Add --resume flag to submit-job.sh for reconnecting to jobs
Usage: ./scripts/submit-job.sh --resume <job_id>

This allows reconnecting to an existing job to continue monitoring
and handle human interaction points (review, instrumental selection).
2025-12-08 01:23:37 -05:00
Andrew Beveridge 9b77362fd0 Fix submit-job.sh to capture only job_id
Messages were going to stdout which caused them to be captured
along with the job_id. Now messages go to stderr so only the
job_id is captured by command substitution.
2025-12-08 01:21:34 -05:00
Andrew Beveridge 011712e437 Add interactive job submission helper script
Creates scripts/submit-job.sh that:
- Accepts filepath, artist, and title as CLI arguments
- Uploads file and submits job to backend
- Polls for status with live terminal updates
- Opens lyrics review UI in browser when review is needed
- Prompts for instrumental selection in terminal
- Shows download URLs when job completes

Usage: ./scripts/submit-job.sh ./song.mp3 "Artist" "Title"
2025-12-08 01:16:21 -05:00
Andrew Beveridge 600701bcfa Add comprehensive backend unit tests (55% coverage)
- Add 231 unit tests covering models, services, routes, and workers
- Fix UnboundLocalError in lyrics_worker.upload_lyrics_results
- Add .coveragerc to exclude complex video workers from coverage
- Update run-tests.sh with realistic 54% coverage target
- Tests for: API routes, request models, job manager, auth, storage
- Worker tests focus on helper functions and error handling

Coverage breakdown:
- Models: 93-100%
- Routes: 52-98%
- Services: 33-76%
- Workers (audio/lyrics): 45-59%
- Config/Main: 58-79%

Note: screens_worker and video_worker excluded from coverage as they
require complex external APIs (karaoke_gen library) - tested via
integration tests instead.
2025-12-07 20:15:02 -05:00
Andrew Beveridge ad0cb72353 Unify testing: run all tests from repo root with 'pytest'
Changes:
- Add backend dependencies to root pyproject.toml
- Configure pytest to discover tests from tests/, backend/tests/
- Skip emulator/integration tests when services not available
- Add run-backend-local.sh for local development
- Add comprehensive TESTING-GUIDE.md documentation

Now you can:
- pytest           # Run all 379 tests from repo root
- ./scripts/run-backend-local.sh  # Run backend locally

Emulator tests auto-skip unless emulators are running.
Integration tests require RUN_INTEGRATION_TESTS=true.
2025-12-07 19:07:50 -05:00
Andrew Beveridge c06626169d Update CD to use Workload Identity Federation (more secure)
- Project has policy preventing service account key creation
- Switched to Workload Identity Federation (no keys needed!)
- Created setup script for Workload Identity
- Added manual setup instructions
- Updated GitHub Actions workflow

Benefits:
✅ No service account keys to manage
✅ Automatic credential rotation
✅ Better security posture
✅ No key expiration issues

Setup: See docs/03-deployment/CD-SETUP-INSTRUCTIONS.md
2025-12-02 00:32:10 -05:00
Andrew Beveridge a61b74b355 Add Continuous Deployment (CD) pipeline with GitHub Actions
✅ Features:
- Auto-deploy to Cloud Run after all tests pass
- Only deploys on push to replace-modal-with-google-cloud branch (not PRs)
- Builds Docker image with commit SHA tags for easy rollback
- Verifies deployment health automatically
- ~7 min total time from push to live

📚 Documentation:
- Comprehensive CD setup guide (docs/03-deployment/CD-SETUP.md)
- Automated setup script (scripts/setup-cd.sh)
- Updated GitHub Actions README with CD info
- Deployment status tracking document

🔐 Security:
- Uses GCP service account with minimal necessary permissions
- Requires GitHub secrets: GCP_SA_KEY, ADMIN_TOKENS
- Setup script creates service account and generates key
- Documentation includes security best practices

📋 Next Steps:
1. Run ./scripts/setup-cd.sh to create service account
2. Add GCP_SA_KEY and ADMIN_TOKENS to GitHub secrets
3. Push to branch → automatic deployment!

This completes the CI/CD pipeline:
- CI: 73 automated tests (unit + integration)
- CD: Automatic deployment on test success
2025-12-02 00:30:11 -05:00
Andrew Beveridge 6caeece63f Add robust health checks and debug logging for emulator tests
- Replace simple sleep with retry loops (30s for Firestore, 10s for GCS)
- Exit early if emulators don't start, show logs
- Add environment variable debug output before tests
- Add emulator status check and logs on test failure
- This should help diagnose CI failures

Local test: ✅ Firestore ready after 2s, all 11 tests pass
2025-12-01 23:55:15 -05:00
Andrew Beveridge a285f34096 Force IPv4 for emulator connections to fix CI
- Change localhost to 127.0.0.1 in emulator scripts and conftest
- Linux CI was trying to connect via IPv6 (::1) which failed
- Fixes: Connection refused (111) in emulator tests
- All 11 emulator tests pass locally (1.49s)
2025-12-01 23:46:42 -05:00
Andrew Beveridge 7cbde5acca Add comprehensive emulator-based integration testing
- Implement 11 emulator integration tests (Firestore + GCS)
- Add emulator management scripts (start/stop/run-tests)
- Fix module-level mock isolation issues
- Add TEST_SERVER_URL support for worker service routing
- Create comprehensive testing documentation
- All 73 tests passing (62 unit + 11 emulator integration)

Benefits:
- 2s test runtime vs 10+ min for cloud tests
- Zero cloud costs for testing
- Tests use real Firestore/GCS emulators
- Caught bugs unit tests missed (e.g. input_media_gcs_path)

Test Results:
✅ Unit Tests: 62 passed (0.4s)
✅ Emulator Tests: 11 passed (2.0s)
2025-12-01 20:32:47 -05:00
Andrew Beveridge 9faa62bdb0 Added unit tests with thorough coverage 2025-12-01 19:02:42 -05:00
Andrew Beveridge bc7c1304df Got new version of backend with (in theory) full karaoke-gen CLI functionality deployed on Cloud Run 2025-12-01 02:19:38 -05:00