mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
fix: recycle brand codes on delete-outputs and job deletion (#437)
## Summary
- E2E happy path test now uses **private mode** (NOMADNP prefix) so test
jobs never consume public NOMAD brand codes or upload to GDrive/YouTube
- `delete-outputs` admin endpoint now **recycles brand codes** after
successful Dropbox + GDrive cleanup
- `DELETE /api/jobs/{id}` endpoint now **recycles brand codes** before
deleting the job record
- Frontend delete-outputs dialog accurately shows brand code recycling
status (recycled/skipped/failed)
## Context
Test jobs ("piri - dog") consumed NOMAD-1275 and NOMAD-1276 brand codes.
When manually deleted via `delete-outputs`, the brand codes were not
recycled back to the counter. This caused the GDrive validator to detect
sequence gaps at 1275/1276 when NOMAD-1277 was later uploaded.
## Test plan
- [x] 7 new unit tests for brand code recycling in both endpoints
- [x] All 490 existing tests pass (483 frontend + backend)
- [x] Frontend builds successfully (TypeScript types updated)
- [ ] Manual: run E2E test, verify job uses NOMADNP prefix
- [ ] Manual: delete-outputs on a test job, verify brand code recycled
in response
<!-- @coderabbitai ignore -->
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
89c37a37f3
commit
0ba5193601
12 files changed
+288
-24
No files matched your search
@@ -1551,8 +1551,9 @@ async def delete_job_outputs(
|
||||
|
||||
This endpoint deletes:
|
||||
1. YouTube video (if uploaded)
|
||||
2. Dropbox folder (if uploaded) - frees brand code for reuse
|
||||
2. Dropbox folder (if uploaded)
|
||||
3. Google Drive files (if uploaded)
|
||||
4. Recycles brand code for reuse (if Dropbox + GDrive cleanup succeeded)
|
||||
|
||||
The job record is preserved with outputs_deleted_at timestamp set.
|
||||
State data related to distribution is cleared.
|
||||
@@ -1688,6 +1689,23 @@ async def delete_job_outputs(
|
||||
logger.error(f"Error deleting GCS finals folder for job {job_id}: {e}", exc_info=True)
|
||||
results["gcs_finals"] = {"status": "error", "error": str(e)}
|
||||
|
||||
# Recycle brand code if Dropbox and GDrive cleanup both succeeded
|
||||
dropbox_success = results["dropbox"]["status"] in ("success", "skipped")
|
||||
gdrive_success = results["gdrive"]["status"] in ("success", "skipped")
|
||||
if brand_code and dropbox_success and gdrive_success:
|
||||
try:
|
||||
from backend.services.brand_code_service import BrandCodeService, get_brand_code_service
|
||||
prefix, number = BrandCodeService.parse_brand_code(brand_code)
|
||||
get_brand_code_service().recycle_brand_code(prefix, number)
|
||||
results["brand_code"] = {"status": "recycled", "code": brand_code}
|
||||
logger.info(f"Recycled brand code {brand_code} during delete-outputs for job {job_id}")
|
||||
except (ValueError, Exception) as e:
|
||||
logger.warning(f"Failed to recycle brand code {brand_code}: {e}")
|
||||
results["brand_code"] = {"status": "failed", "error": str(e)}
|
||||
elif brand_code:
|
||||
logger.warning(f"Brand code {brand_code} NOT recycled: cleanup incomplete (dropbox={results['dropbox']['status']}, gdrive={results['gdrive']['status']})")
|
||||
results["brand_code"] = {"status": "skipped", "reason": "Dropbox/GDrive cleanup incomplete"}
|
||||
|
||||
# Update job record
|
||||
deletion_timestamp = datetime.now(timezone.utc)
|
||||
user_service = get_user_service()
|
||||
@@ -1735,12 +1753,14 @@ async def delete_job_outputs(
|
||||
overall_status = "success"
|
||||
message = "Outputs deleted successfully"
|
||||
|
||||
brand_code_status = results.get('brand_code', {}).get('status', 'n/a')
|
||||
logger.info(
|
||||
f"Admin {admin_email} deleted outputs for job {job_id}. "
|
||||
f"YouTube: {results['youtube']['status']}, "
|
||||
f"Dropbox: {results['dropbox']['status']}, "
|
||||
f"GDrive: {results['gdrive']['status']}, "
|
||||
f"GCS Finals: {results['gcs_finals']['status']}. "
|
||||
f"GCS Finals: {results['gcs_finals']['status']}, "
|
||||
f"Brand Code: {brand_code_status}. "
|
||||
f"Cleared state_data keys: {cleared_keys}"
|
||||
)
|
||||
|
||||
|
||||
@@ -361,6 +361,24 @@ async def delete_job(
|
||||
if not _check_job_ownership(job, auth_result):
|
||||
raise HTTPException(status_code=403, detail="You don't have permission to delete this job")
|
||||
|
||||
# Recycle any unreturned brand code before deleting the job record
|
||||
state_data = job.state_data or {}
|
||||
brand_code = state_data.get('brand_code')
|
||||
if brand_code:
|
||||
if not job.outputs_deleted_at:
|
||||
logger.warning(
|
||||
f"Deleting job {job_id} with brand_code {brand_code} whose outputs "
|
||||
f"were not cleaned up first. Brand code will be recycled but "
|
||||
f"distributed files (GDrive/Dropbox/YouTube) may be orphaned."
|
||||
)
|
||||
try:
|
||||
from backend.services.brand_code_service import BrandCodeService, get_brand_code_service
|
||||
prefix, number = BrandCodeService.parse_brand_code(brand_code)
|
||||
get_brand_code_service().recycle_brand_code(prefix, number)
|
||||
logger.info(f"Recycled brand code {brand_code} before deleting job {job_id}")
|
||||
except (ValueError, Exception) as e:
|
||||
logger.warning(f"Failed to recycle brand code {brand_code}: {e}")
|
||||
|
||||
job_manager.delete_job(job_id, delete_files=delete_files)
|
||||
|
||||
return {"status": "success", "message": f"Job {job_id} deleted"}
|
||||
|
||||
@@ -470,3 +470,107 @@ class TestDeleteOutputsGCSFinals:
|
||||
assert response.status_code == 200
|
||||
# Verify path format is jobs/{job_id}/finals/
|
||||
mock_storage.delete_folder.assert_called_once_with("jobs/abc-123-xyz/finals/")
|
||||
|
||||
|
||||
class TestDeleteOutputsBrandCodeRecycling:
|
||||
"""Tests for brand code recycling during output deletion."""
|
||||
|
||||
def test_brand_code_recycled_on_success(self, client, mock_complete_job):
|
||||
"""Test that brand code is recycled when Dropbox and GDrive cleanup succeed."""
|
||||
with patch('backend.api.routes.admin.JobManager') as mock_jm_class, \
|
||||
patch('backend.api.routes.admin.get_user_service') as mock_user_service, \
|
||||
patch('backend.services.brand_code_service.BrandCodeService.parse_brand_code') as mock_parse, \
|
||||
patch('backend.services.brand_code_service.get_brand_code_service') as mock_get_svc:
|
||||
mock_jm = Mock()
|
||||
mock_jm.get_job.return_value = mock_complete_job
|
||||
mock_jm_class.return_value = mock_jm
|
||||
|
||||
mock_db = Mock()
|
||||
mock_job_ref = Mock()
|
||||
mock_db.collection.return_value.document.return_value = mock_job_ref
|
||||
mock_user_service.return_value.db = mock_db
|
||||
|
||||
mock_parse.return_value = ("NOMAD", 1234)
|
||||
mock_svc = Mock()
|
||||
mock_get_svc.return_value = mock_svc
|
||||
|
||||
response = client.post("/api/admin/jobs/test-job-123/delete-outputs")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
# Brand code should be recycled (all services skip = success condition)
|
||||
assert "brand_code" in data["deleted_services"]
|
||||
assert data["deleted_services"]["brand_code"]["status"] == "recycled"
|
||||
assert data["deleted_services"]["brand_code"]["code"] == "NOMAD-1234"
|
||||
mock_svc.recycle_brand_code.assert_called_once_with("NOMAD", 1234)
|
||||
|
||||
def test_brand_code_not_recycled_without_brand_code(self, client, mock_job_no_outputs):
|
||||
"""Test that no recycling happens when job has no brand code."""
|
||||
with patch('backend.api.routes.admin.JobManager') as mock_jm_class, \
|
||||
patch('backend.api.routes.admin.get_user_service') as mock_user_service:
|
||||
mock_jm = Mock()
|
||||
mock_jm.get_job.return_value = mock_job_no_outputs
|
||||
mock_jm_class.return_value = mock_jm
|
||||
|
||||
mock_db = Mock()
|
||||
mock_job_ref = Mock()
|
||||
mock_db.collection.return_value.document.return_value = mock_job_ref
|
||||
mock_user_service.return_value.db = mock_db
|
||||
|
||||
response = client.post("/api/admin/jobs/test-job-456/delete-outputs")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
# No brand_code key in response since there's nothing to recycle
|
||||
assert "brand_code" not in data["deleted_services"]
|
||||
|
||||
def test_brand_code_skipped_when_dropbox_fails(self, client, mock_complete_job):
|
||||
"""Test that brand code is NOT recycled when Dropbox cleanup fails."""
|
||||
with patch('backend.api.routes.admin.JobManager') as mock_jm_class, \
|
||||
patch('backend.api.routes.admin.get_user_service') as mock_user_service, \
|
||||
patch('backend.services.dropbox_service.get_dropbox_service') as mock_dropbox_svc:
|
||||
mock_jm = Mock()
|
||||
mock_jm.get_job.return_value = mock_complete_job
|
||||
mock_jm_class.return_value = mock_jm
|
||||
|
||||
mock_db = Mock()
|
||||
mock_job_ref = Mock()
|
||||
mock_db.collection.return_value.document.return_value = mock_job_ref
|
||||
mock_user_service.return_value.db = mock_db
|
||||
|
||||
# Make Dropbox fail
|
||||
mock_dropbox = Mock()
|
||||
mock_dropbox.is_configured = True
|
||||
mock_dropbox.delete_folder.side_effect = Exception("Dropbox error")
|
||||
mock_dropbox_svc.return_value = mock_dropbox
|
||||
|
||||
response = client.post("/api/admin/jobs/test-job-123/delete-outputs")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["deleted_services"]["brand_code"]["status"] == "skipped"
|
||||
assert "incomplete" in data["deleted_services"]["brand_code"]["reason"].lower()
|
||||
|
||||
def test_brand_code_recycle_error_handled_gracefully(self, client, mock_complete_job):
|
||||
"""Test that brand code recycling errors don't crash the endpoint."""
|
||||
with patch('backend.api.routes.admin.JobManager') as mock_jm_class, \
|
||||
patch('backend.api.routes.admin.get_user_service') as mock_user_service, \
|
||||
patch('backend.services.brand_code_service.BrandCodeService.parse_brand_code') as mock_parse:
|
||||
mock_jm = Mock()
|
||||
mock_jm.get_job.return_value = mock_complete_job
|
||||
mock_jm_class.return_value = mock_jm
|
||||
|
||||
mock_db = Mock()
|
||||
mock_job_ref = Mock()
|
||||
mock_db.collection.return_value.document.return_value = mock_job_ref
|
||||
mock_user_service.return_value.db = mock_db
|
||||
|
||||
# Make parse_brand_code raise an error
|
||||
mock_parse.side_effect = ValueError("Invalid brand code format")
|
||||
|
||||
response = client.post("/api/admin/jobs/test-job-123/delete-outputs")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["deleted_services"]["brand_code"]["status"] == "failed"
|
||||
assert "Invalid brand code format" in data["deleted_services"]["brand_code"]["error"]
|
||||
@@ -214,6 +214,91 @@ class TestDeleteJob:
|
||||
assert response.status_code in [200, 404]
|
||||
|
||||
|
||||
class TestDeleteJobBrandCodeRecycling:
|
||||
"""Tests for brand code recycling in DELETE /api/jobs/{job_id}."""
|
||||
|
||||
def test_brand_code_recycled_before_deletion(self, mock_worker_service, mock_theme_service, auth_headers):
|
||||
"""Test that brand code is recycled before the job is deleted."""
|
||||
mock_job_manager = MagicMock()
|
||||
job_with_brand = Job(
|
||||
job_id="test-bc-123",
|
||||
status=JobStatus.COMPLETE,
|
||||
created_at=datetime.now(UTC),
|
||||
updated_at=datetime.now(UTC),
|
||||
artist="Test",
|
||||
title="Test",
|
||||
state_data={"brand_code": "NOMAD-0042"},
|
||||
outputs_deleted_at=datetime.now(UTC),
|
||||
)
|
||||
mock_job_manager.get_job.return_value = job_with_brand
|
||||
mock_job_manager.delete_job.return_value = True
|
||||
mock_creds = MagicMock()
|
||||
mock_creds.universe_domain = 'googleapis.com'
|
||||
|
||||
with patch('backend.api.routes.jobs.job_manager', mock_job_manager), \
|
||||
patch('backend.api.routes.jobs.worker_service', mock_worker_service), \
|
||||
patch('backend.api.routes.jobs.get_theme_service', return_value=mock_theme_service), \
|
||||
patch('backend.services.job_manager.JobManager', lambda *a, **k: mock_job_manager), \
|
||||
patch('backend.services.firestore_service.firestore'), \
|
||||
patch('backend.services.storage_service.storage'), \
|
||||
patch('google.auth.default', return_value=(mock_creds, 'test-project')), \
|
||||
patch('backend.services.brand_code_service.BrandCodeService.parse_brand_code', return_value=("NOMAD", 42)) as mock_parse, \
|
||||
patch('backend.services.brand_code_service.get_brand_code_service') as mock_get_svc:
|
||||
mock_svc = MagicMock()
|
||||
mock_get_svc.return_value = mock_svc
|
||||
|
||||
from backend.main import app
|
||||
client = TestClient(app)
|
||||
response = client.delete("/api/jobs/test-bc-123", headers=auth_headers)
|
||||
|
||||
assert response.status_code == 200
|
||||
mock_parse.assert_called_once_with("NOMAD-0042")
|
||||
mock_svc.recycle_brand_code.assert_called_once_with("NOMAD", 42)
|
||||
mock_job_manager.delete_job.assert_called_once()
|
||||
|
||||
def test_recycling_failure_does_not_prevent_deletion(self, mock_worker_service, mock_theme_service, auth_headers):
|
||||
"""Test that job deletion proceeds even if brand code recycling fails."""
|
||||
mock_job_manager = MagicMock()
|
||||
job_with_brand = Job(
|
||||
job_id="test-bc-456",
|
||||
status=JobStatus.COMPLETE,
|
||||
created_at=datetime.now(UTC),
|
||||
updated_at=datetime.now(UTC),
|
||||
artist="Test",
|
||||
title="Test",
|
||||
state_data={"brand_code": "NOMAD-0099"},
|
||||
outputs_deleted_at=datetime.now(UTC),
|
||||
)
|
||||
mock_job_manager.get_job.return_value = job_with_brand
|
||||
mock_job_manager.delete_job.return_value = True
|
||||
mock_creds = MagicMock()
|
||||
mock_creds.universe_domain = 'googleapis.com'
|
||||
|
||||
with patch('backend.api.routes.jobs.job_manager', mock_job_manager), \
|
||||
patch('backend.api.routes.jobs.worker_service', mock_worker_service), \
|
||||
patch('backend.api.routes.jobs.get_theme_service', return_value=mock_theme_service), \
|
||||
patch('backend.services.job_manager.JobManager', lambda *a, **k: mock_job_manager), \
|
||||
patch('backend.services.firestore_service.firestore'), \
|
||||
patch('backend.services.storage_service.storage'), \
|
||||
patch('google.auth.default', return_value=(mock_creds, 'test-project')), \
|
||||
patch('backend.services.brand_code_service.BrandCodeService.parse_brand_code', side_effect=ValueError("Bad format")):
|
||||
from backend.main import app
|
||||
client = TestClient(app)
|
||||
response = client.delete("/api/jobs/test-bc-456", headers=auth_headers)
|
||||
|
||||
assert response.status_code == 200
|
||||
# Job should still be deleted despite recycling failure
|
||||
mock_job_manager.delete_job.assert_called_once()
|
||||
|
||||
def test_no_brand_code_skips_recycling(self, client, mock_job_manager, auth_headers):
|
||||
"""Test that deletion without brand code doesn't attempt recycling."""
|
||||
with patch('backend.services.brand_code_service.get_brand_code_service') as mock_get_svc:
|
||||
response = client.delete("/api/jobs/test123", headers=auth_headers)
|
||||
|
||||
assert response.status_code == 200
|
||||
mock_get_svc.assert_not_called()
|
||||
|
||||
|
||||
class TestCancelJob:
|
||||
"""Tests for POST /api/jobs/{job_id}/cancel."""
|
||||
|
||||
|
||||
+5
-4
@@ -1079,7 +1079,7 @@ Allowed target states:
|
||||
**Note**: With the combined review flow, `awaiting_instrumental_selection` is no longer a valid reset target for new jobs. Use `awaiting_review` instead to re-select the instrumental.
|
||||
|
||||
The `instrumental_selected` state is useful for re-encoding and re-distributing a job after using "Delete Outputs":
|
||||
1. Delete outputs → Removes YouTube/Dropbox/GDrive files, frees brand code
|
||||
1. Delete outputs → Removes YouTube/Dropbox/GDrive files, recycles brand code
|
||||
2. Reset to `instrumental_selected` → Clears video state, keeps settings, auto-triggers video worker
|
||||
3. Job re-processes with same instrumental, lyrics, and distribution settings
|
||||
|
||||
@@ -1304,7 +1304,7 @@ POST /api/admin/jobs/{job_id}/delete-outputs
|
||||
Authorization: Bearer ADMIN_TOKEN
|
||||
```
|
||||
|
||||
Deletes all distributed outputs (YouTube, Dropbox, Google Drive) for a job while preserving the job record. Use this to fix quality issues: delete outputs, reset to `awaiting_review`, correct lyrics, and re-process.
|
||||
Deletes all distributed outputs (YouTube, Dropbox, Google Drive) for a job and recycles the brand code. The job record is preserved. Use this to fix quality issues: delete outputs, reset to `awaiting_review`, correct lyrics, and re-process.
|
||||
|
||||
Requirements:
|
||||
- Job must be in terminal state (`complete`, `prep_complete`, `failed`, or `cancelled`)
|
||||
@@ -1319,7 +1319,8 @@ Response:
|
||||
"deleted_services": {
|
||||
"youtube": {"status": "success", "video_id": "dQw4w9WgXcQ"},
|
||||
"dropbox": {"status": "success", "path": "/Karaoke/NOMAD-1234 - Artist - Title"},
|
||||
"gdrive": {"status": "success", "files": {"mp4": true, "mp4_720p": true}}
|
||||
"gdrive": {"status": "success", "files": {"mp4": true, "mp4_720p": true}},
|
||||
"brand_code": {"status": "recycled", "code": "NOMAD-1234"}
|
||||
},
|
||||
"cleared_state_data": ["youtube_url", "brand_code", "dropbox_link", "gdrive_files"],
|
||||
"outputs_deleted_at": "2026-01-10T12:00:00Z"
|
||||
@@ -1328,7 +1329,7 @@ Response:
|
||||
|
||||
Service statuses: `success`, `failed`, `skipped` (not configured or no data), `partial` (some files failed), `error` (exception).
|
||||
|
||||
The brand code is freed for reuse when the Dropbox folder is deleted. When the job is re-processed and outputs are re-uploaded, the `outputs_deleted_at` flag is automatically cleared.
|
||||
The brand code is automatically recycled after both Dropbox and GDrive cleanup succeed. If either cleanup fails, the brand code is preserved to prevent collisions. Brand code recycling status is returned in `deleted_services.brand_code`. The `DELETE /api/jobs/{id}` endpoint also recycles brand codes before deletion. When the job is re-processed and outputs are re-uploaded, the `outputs_deleted_at` flag is automatically cleared.
|
||||
|
||||
#### Clear Worker Progress
|
||||
|
||||
|
||||
@@ -36,12 +36,13 @@
|
||||
- [ ] Click "Search" or equivalent button
|
||||
- [ ] Wait for search results to appear in the UI
|
||||
|
||||
### 3. Audio Selection (UI Only)
|
||||
### 3. Audio Selection & Customization (UI Only)
|
||||
|
||||
- [ ] Audio selection dialog/panel should appear
|
||||
- [ ] View available audio options in the UI
|
||||
- [ ] Click to select the first/best audio option
|
||||
- [ ] Confirm the selection via UI button
|
||||
- [ ] **Enable private mode** (check the `#guided-private` checkbox) — test jobs use `NOMADNP` prefix to avoid consuming public `NOMAD` brand codes and skip GDrive/YouTube uploads
|
||||
- [ ] Wait for job to transition to processing state
|
||||
|
||||
### 4. Wait for Lyrics Transcription
|
||||
@@ -93,14 +94,12 @@
|
||||
> **CRITICAL**: Test MUST clean up after itself to avoid polluting production distribution channels
|
||||
|
||||
- [ ] Verify job.state_data contains distribution results:
|
||||
- [ ] `brand_code` - The generated brand code (e.g., "NOMAD-1234")
|
||||
- [ ] `youtube_url` - YouTube video URL (if YouTube enabled)
|
||||
- [ ] `brand_code` - The generated brand code (e.g., `NOMADNP-0042` for private mode)
|
||||
- [ ] `dropbox_link` - Dropbox shared link (if Dropbox enabled)
|
||||
- [ ] `gdrive_files` - Google Drive file IDs (if GDrive enabled)
|
||||
- [ ] **CLEANUP** - After verification, delete all distributed content:
|
||||
- [ ] Delete YouTube video via API (using stored youtube_url)
|
||||
- [ ] Delete Dropbox folder via API (using brand_code + dropbox_path)
|
||||
- [ ] Delete Google Drive files via API (using gdrive_files IDs)
|
||||
- [ ] YouTube and GDrive should NOT be present (private mode skips them)
|
||||
- [ ] **CLEANUP** - After verification, clean up via `cleanup-distribution` endpoint:
|
||||
- [ ] Deletes Dropbox folder and recycles brand code
|
||||
- [ ] YouTube/GDrive cleanup skipped for private jobs
|
||||
- [ ] Delete the test job from the system (GCS + Firestore)
|
||||
|
||||
## Technical Requirements
|
||||
|
||||
@@ -1534,8 +1534,9 @@ function AdminJobsPageContent() {
|
||||
This will permanently delete:
|
||||
<ul className="list-disc list-inside mt-2 space-y-1">
|
||||
<li>YouTube video (if uploaded)</li>
|
||||
<li>Dropbox folder (frees brand code for reuse)</li>
|
||||
<li>Dropbox folder (if uploaded)</li>
|
||||
<li>Google Drive files (if uploaded)</li>
|
||||
<li>Brand code (recycled for reuse if cleanup succeeds)</li>
|
||||
</ul>
|
||||
<br />
|
||||
The job record will be preserved with a timestamp marking when outputs were deleted.
|
||||
@@ -1653,6 +1654,33 @@ function AdminJobsPageContent() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Brand Code */}
|
||||
{deleteOutputsResult.deleted_services.brand_code && (
|
||||
<div className="flex items-start gap-3 p-3 rounded-lg bg-muted/50">
|
||||
<div className={`w-2 h-2 rounded-full mt-1.5 ${
|
||||
deleteOutputsResult.deleted_services.brand_code.status === "recycled"
|
||||
? "bg-green-500"
|
||||
: deleteOutputsResult.deleted_services.brand_code.status === "skipped"
|
||||
? "bg-gray-400"
|
||||
: "bg-red-500"
|
||||
}`} />
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="font-medium text-sm">Brand Code</div>
|
||||
<div className="text-xs text-muted-foreground">
|
||||
{deleteOutputsResult.deleted_services.brand_code.status === "recycled" && (
|
||||
<>Recycled <code className="text-xs bg-muted px-1 rounded">{deleteOutputsResult.deleted_services.brand_code.code}</code> for reuse</>
|
||||
)}
|
||||
{deleteOutputsResult.deleted_services.brand_code.status === "skipped" && (
|
||||
<>{deleteOutputsResult.deleted_services.brand_code.reason}</>
|
||||
)}
|
||||
{deleteOutputsResult.deleted_services.brand_code.status === "failed" && (
|
||||
<span className="text-red-500">{deleteOutputsResult.deleted_services.brand_code.error}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{deleteOutputsResult.cleared_state_data.length > 0 && (
|
||||
|
||||
@@ -453,6 +453,11 @@ test.describe('E2E Happy Path - Real User with Full UI Interactions', () => {
|
||||
await page.waitForTimeout(3000);
|
||||
await page.screenshot({ path: 'test-results/05b-customize-step.png' });
|
||||
|
||||
// Enable private mode - test jobs should never consume public NOMAD brand codes
|
||||
const privateCheckbox = page.locator('#guided-private');
|
||||
await privateCheckbox.check();
|
||||
console.log(' Enabled private mode (NOMADNP prefix, no GDrive/YouTube)');
|
||||
|
||||
// Accept defaults and create
|
||||
await page.getByRole('button', { name: /create karaoke video/i }).click();
|
||||
console.log(' Clicked "Create Karaoke Video"');
|
||||
@@ -904,18 +909,21 @@ test.describe('E2E Happy Path - Real User with Full UI Interactions', () => {
|
||||
console.log('STEP 11: Verify Distribution');
|
||||
console.log('========================================');
|
||||
|
||||
// Check for distribution indicators in job card or state
|
||||
// Private mode skips public distribution (YouTube, GDrive) — only Dropbox may be present
|
||||
const cardText = await jobCard.textContent() || '';
|
||||
|
||||
if (cardText.toLowerCase().includes('youtube') ||
|
||||
cardText.toLowerCase().includes('dropbox') ||
|
||||
cardText.toLowerCase().includes('drive')) {
|
||||
console.log(' Distribution indicators found in UI');
|
||||
console.log(' WARNING: Public distribution indicators found despite private mode!');
|
||||
} else {
|
||||
console.log(' No distribution indicators visible in UI (may be in backend state)');
|
||||
console.log(' No public distribution indicators (expected for private/NOMADNP jobs)');
|
||||
}
|
||||
|
||||
console.log('STEP 11 COMPLETE: Distribution check done');
|
||||
if (cardText.toLowerCase().includes('dropbox')) {
|
||||
console.log(' Dropbox distribution present (private jobs still upload to Dropbox)');
|
||||
}
|
||||
|
||||
console.log('STEP 11 COMPLETE: Distribution check done (private mode)');
|
||||
|
||||
// =========================================================================
|
||||
// STEP 12: Cleanup
|
||||
|
||||
@@ -2084,6 +2084,7 @@ export interface DeleteOutputsResponse {
|
||||
youtube: { status: string; video_id?: string; reason?: string; error?: string };
|
||||
dropbox: { status: string; path?: string; reason?: string; error?: string };
|
||||
gdrive: { status: string; files?: Record<string, boolean>; reason?: string; error?: string };
|
||||
brand_code?: { status: string; code?: string; reason?: string; error?: string };
|
||||
};
|
||||
cleared_state_data: string[];
|
||||
outputs_deleted_at: string;
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "karaoke-gen-frontend",
|
||||
"version": "0.85.5",
|
||||
"version": "0.85.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "karaoke-gen-frontend",
|
||||
"version": "0.85.5",
|
||||
"version": "0.85.7",
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.10.0",
|
||||
"@radix-ui/react-accordion": "1.2.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "karaoke-gen-frontend",
|
||||
"version": "0.85.6",
|
||||
"version": "0.85.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "next build && node scripts/spa-redirect-404.js",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "karaoke-gen"
|
||||
version = "0.122.1"
|
||||
version = "0.122.2"
|
||||
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"
|
||||
|
||||
Reference in new issue
Block a user