mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-30 17:21:26 +09:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0539479281 | ||
|
|
b7c4edc7fc |
No files matched your search
@@ -96,10 +96,6 @@ See `docs/TESTING.md` § "Ad-Hoc Production Debugging" for full details.
|
||||
- Never modify GCP resources directly via console or `gcloud` CLI
|
||||
- `gcloud` CLI for reading/debugging only (e.g., checking logs, SSH to VMs)
|
||||
- Stop and notify user on auth issues
|
||||
- **GCS ops on macOS: never use `gsutil -m`** — its fork-based multiprocessing segfaults
|
||||
on macOS (crash-report popups + the parent process hangs forever). Use `gcloud storage`
|
||||
instead (`gcloud storage cp/rm/rsync …`) — no fork, and faster. Plain `gsutil` (no `-m`)
|
||||
is safe but slower. `~/.boto` pins `parallel_process_count=1` as a safety net; don't remove it.
|
||||
|
||||
### Internationalization (i18n)
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ from backend.services.flacfetch_client import get_flacfetch_client
|
||||
from backend.services.email_service import get_email_service
|
||||
from backend.services.stripe_service import get_stripe_service
|
||||
from backend.services.encoding_service import get_encoding_service
|
||||
from backend.services.encoding_worker_preference import infer_machine_type, PRIMARY_MACHINE_TYPE
|
||||
from backend.services.spacy_preloader import get_preloaded_model, is_model_preloaded
|
||||
from backend.services.nltk_preloader import get_preloaded_cmudict, is_cmudict_preloaded
|
||||
from backend.services.langfuse_preloader import get_preloaded_langfuse_handler, is_langfuse_preloaded, is_langfuse_configured
|
||||
@@ -444,26 +443,6 @@ async def system_status(
|
||||
if manager:
|
||||
try:
|
||||
config = manager.get_config()
|
||||
|
||||
# Which VM is actually serving right now? When a capacity
|
||||
# fallback is active (e.g. a c4d stockout routed us to an
|
||||
# alternate family) the override points at the live VM;
|
||||
# otherwise it's the blue-green primary. The primary pair is
|
||||
# always c4d — fallbacks carry their family in the VM name
|
||||
# (…-fallback-n2c, …-fallback-c4a), which infer_machine_type
|
||||
# decodes when no explicit machine_type is stored on the config.
|
||||
on_fallback = bool(config.active_override_vm)
|
||||
active_vm = config.active_override_vm or config.primary_vm
|
||||
default_zone = getattr(manager, "_zone", "us-central1-c")
|
||||
active_zone = config.active_override_zone or default_zone
|
||||
if on_fallback:
|
||||
active_machine_type = infer_machine_type({"vm": active_vm})
|
||||
else:
|
||||
active_machine_type = (
|
||||
getattr(config, "primary_machine_type", None)
|
||||
or PRIMARY_MACHINE_TYPE
|
||||
)
|
||||
|
||||
encoder_svc["admin_details"] = {
|
||||
"primary_vm": config.primary_vm,
|
||||
"primary_ip": config.primary_ip,
|
||||
@@ -477,11 +456,6 @@ async def system_status(
|
||||
"deploy_in_progress": config.deploy_in_progress,
|
||||
"active_jobs": encoding_status.get("active_jobs", 0),
|
||||
"queue_length": encoding_status.get("queue_length", 0),
|
||||
# Currently-serving worker (fallback-aware)
|
||||
"active_vm": active_vm,
|
||||
"active_zone": active_zone,
|
||||
"active_machine_type": active_machine_type,
|
||||
"on_fallback": on_fallback,
|
||||
}
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to get blue-green config: {e}")
|
||||
|
||||
@@ -325,29 +325,10 @@ class LocalEncodingService:
|
||||
output_file: str,
|
||||
) -> bool:
|
||||
"""
|
||||
Convert the source "With Vocals" video (MOV/MKV) to a standard, portable MP4.
|
||||
|
||||
This produces the "(With Vocals).mp4" sing-along deliverable. It is a leaf
|
||||
output — no later encode reads it — so the encode is chosen purely for the
|
||||
deliverable itself:
|
||||
- ``-pix_fmt yuv420p``: the renderer emits High 4:4:4 (yuv444p), which many
|
||||
browsers/TVs/phones cannot decode. Normalize to 4:2:0 so it plays
|
||||
everywhere and matches every other output. (Also ~halves this stage's CPU
|
||||
time vs. re-encoding 4:4:4, and yields a slightly smaller file.)
|
||||
- ``-preset veryfast``: this is the single longest finalization stage; a fast
|
||||
preset roughly halves it (~56s → ~28s on a 32-vCPU worker) with negligible
|
||||
quality difference for karaoke content (static background + text).
|
||||
- ``-c:a aac``: the source audio is FLAC; FLAC-in-MP4 is non-standard. Encode
|
||||
AAC 320k so the file is fully portable. Matches the documented spec
|
||||
("4k H264/AAC with original vocals", see template_service.py).
|
||||
|
||||
Both commands force ``-pix_fmt yuv420p`` (h264_nvenc can otherwise *preserve* a
|
||||
yuv444p input). Prod encoding workers are CPU-only, so ``cpu_command`` is the
|
||||
real path; if the NVENC command ever errors, ``_execute_command_with_fallback``
|
||||
drops to the (correct) CPU command.
|
||||
Convert MOV to MP4 format.
|
||||
|
||||
Args:
|
||||
input_file: Path to input MOV/MKV file (source "With Vocals" video)
|
||||
input_file: Path to input MOV file
|
||||
output_file: Path for output MP4 file
|
||||
|
||||
Returns:
|
||||
@@ -355,13 +336,11 @@ class LocalEncodingService:
|
||||
"""
|
||||
gpu_command = (
|
||||
f'{self._ffmpeg_base_command} {self.hwaccel_decode_flags} -i "{input_file}" '
|
||||
f'-c:v {self.video_encoder} -pix_fmt yuv420p -c:a {self.aac_codec} -ar 48000 -b:a 320k '
|
||||
f'{self.MP4_FLAGS} "{output_file}"'
|
||||
f'-c:v {self.video_encoder} -c:a copy {self.MP4_FLAGS} "{output_file}"'
|
||||
)
|
||||
cpu_command = (
|
||||
f'{self._ffmpeg_base_command} -i "{input_file}" '
|
||||
f'-c:v libx264 -pix_fmt yuv420p -preset veryfast '
|
||||
f'-c:a {self.aac_codec} -ar 48000 -b:a 320k {self.MP4_FLAGS} "{output_file}"'
|
||||
f'-c:v libx264 -c:a copy {self.MP4_FLAGS} "{output_file}"'
|
||||
)
|
||||
return self._execute_command_with_fallback(
|
||||
gpu_command, cpu_command, "Converting MOV to MP4"
|
||||
|
||||
@@ -57,93 +57,61 @@ class VisibilityChangeService:
|
||||
"""
|
||||
Change a public job to private (fast path).
|
||||
|
||||
Distribute-then-delete: the track is first redistributed to the private
|
||||
destination (private Dropbox archive + NOMADNP code, no YouTube/GDrive),
|
||||
and only *after* that succeeds are the public outputs (YouTube, public
|
||||
Dropbox folder, public GDrive files) deleted and the public NOMAD number
|
||||
recycled. GCS finals are always kept.
|
||||
|
||||
This ordering is deliberate: YouTube deletion is irreversible, so nothing
|
||||
public may be destroyed until the private archive exists. If redistribution
|
||||
fails, the job is reverted to public and left fully intact (no partial
|
||||
deletion, no leaked NOMADNP code — see redistribute_video's failure path).
|
||||
Deletes distributed outputs (YouTube/Dropbox/GDrive) but keeps GCS finals,
|
||||
then redistributes to private destination.
|
||||
"""
|
||||
logger.info(f"[job:{job_id}] Starting visibility change: public -> private (by {user_email})")
|
||||
|
||||
db = self.job_manager.firestore.db
|
||||
job_ref = db.collection("jobs").document(job_id)
|
||||
|
||||
# Capture the public output references BEFORE redistribution overwrites
|
||||
# state_data with the new private values — we need them to delete the
|
||||
# public outputs afterwards.
|
||||
state_data = job.state_data or {}
|
||||
public_outputs = {
|
||||
"youtube_url": state_data.get("youtube_url"),
|
||||
"brand_code": state_data.get("brand_code"),
|
||||
"gdrive_files": state_data.get("gdrive_files"),
|
||||
"dropbox_path": getattr(job, "dropbox_path", None),
|
||||
"artist": job.artist,
|
||||
"title": job.title,
|
||||
}
|
||||
|
||||
# Set guard flag + flip to private so redistribution targets the private
|
||||
# destination. Public outputs remain live until the private archive exists.
|
||||
# No "changed to private" timeline event yet — it is only recorded once the
|
||||
# move actually succeeds (this is reverted if redistribution fails).
|
||||
# Set guard flag
|
||||
job_ref.update({
|
||||
"state_data.visibility_change_in_progress": True,
|
||||
"is_private": True,
|
||||
"updated_at": datetime.now(timezone.utc),
|
||||
})
|
||||
|
||||
# Step 1: Redistribute to the private destination FIRST (public outputs
|
||||
# still live). This is the only phase whose failure is safe to fully roll
|
||||
# back — nothing public has been touched yet. redistribute_video verifies
|
||||
# the archive actually materialized and recycles any NOMADNP code it
|
||||
# allocated on failure, so a False return means "no-op, still public".
|
||||
try:
|
||||
# Step 1: Delete distributed outputs (keep GCS finals)
|
||||
await self._delete_distributed_outputs(job_id, job, keep_gcs_finals=True)
|
||||
|
||||
# Step 2: Update job to private
|
||||
job_ref.update({
|
||||
"is_private": True,
|
||||
"updated_at": datetime.now(timezone.utc),
|
||||
"timeline": ArrayUnion([{
|
||||
"status": "complete",
|
||||
"timestamp": datetime.now(timezone.utc).isoformat(),
|
||||
"message": f"Visibility changed to private by {user_email}",
|
||||
}]),
|
||||
})
|
||||
|
||||
# Step 3: Trigger redistribution via video worker
|
||||
from backend.workers.video_worker import redistribute_video
|
||||
success = await redistribute_video(job_id)
|
||||
except Exception as e:
|
||||
logger.error(f"[job:{job_id}] Redistribution raised during visibility change: {e}", exc_info=True)
|
||||
success = False
|
||||
|
||||
if not success:
|
||||
# Roll back to public: no public outputs were deleted, so restoring
|
||||
# is_private=False leaves the job fully intact and public.
|
||||
logger.error(f"[job:{job_id}] Visibility change to private failed: redistribution did not succeed")
|
||||
if not success:
|
||||
raise RuntimeError("Redistribution failed - check worker logs")
|
||||
|
||||
# Clear guard flag (redistribution updates state_data with new brand_code etc.)
|
||||
job_ref.update({
|
||||
"is_private": False,
|
||||
"state_data.visibility_change_in_progress": DELETE_FIELD,
|
||||
"updated_at": datetime.now(timezone.utc),
|
||||
})
|
||||
raise RuntimeError("Redistribution failed - check worker logs")
|
||||
|
||||
# Step 2: Private archive now exists. From here we do NOT revert to public,
|
||||
# even if public cleanup hiccups — the private move has committed. Deleting
|
||||
# the public outputs + recycling the public NOMAD number is best-effort
|
||||
# (each failure is logged inside the helper, never raised), so a stray
|
||||
# orphaned public artifact cannot undo the successful private move.
|
||||
await self._delete_public_outputs(job_id, public_outputs)
|
||||
logger.info(f"[job:{job_id}] Visibility change to private complete")
|
||||
return {
|
||||
"status": "success",
|
||||
"message": "Job changed to private. Outputs redistributed to private destination.",
|
||||
"reprocessing_required": False,
|
||||
}
|
||||
|
||||
# Record the completed move and clear the guard flag. redistribute_video
|
||||
# already updated state_data with the new private brand_code etc.
|
||||
job_ref.update({
|
||||
"state_data.visibility_change_in_progress": DELETE_FIELD,
|
||||
"updated_at": datetime.now(timezone.utc),
|
||||
"timeline": ArrayUnion([{
|
||||
"status": "complete",
|
||||
"timestamp": datetime.now(timezone.utc).isoformat(),
|
||||
"message": f"Visibility changed to private by {user_email}",
|
||||
}]),
|
||||
})
|
||||
|
||||
logger.info(f"[job:{job_id}] Visibility change to private complete")
|
||||
return {
|
||||
"status": "success",
|
||||
"message": "Job changed to private. Outputs redistributed to private destination.",
|
||||
"reprocessing_required": False,
|
||||
}
|
||||
except Exception as e:
|
||||
logger.error(f"[job:{job_id}] Visibility change to private failed: {e}", exc_info=True)
|
||||
# Clear guard flag on failure
|
||||
job_ref.update({
|
||||
"state_data.visibility_change_in_progress": DELETE_FIELD,
|
||||
})
|
||||
raise
|
||||
|
||||
async def change_to_public(self, job_id: str, job, user_email: str) -> dict:
|
||||
"""
|
||||
@@ -248,103 +216,6 @@ class VisibilityChangeService:
|
||||
"reprocessing_required": True,
|
||||
}
|
||||
|
||||
async def _delete_public_outputs(self, job_id: str, public_outputs: dict):
|
||||
"""Delete the captured PUBLIC outputs and recycle the public NOMAD number.
|
||||
|
||||
Used by change_to_private AFTER a successful private redistribution. Operates
|
||||
on references captured before redistribution (which overwrites state_data with
|
||||
private values). Does not touch GCS finals and does not clear state_data keys
|
||||
(redistribution already set the new private values). Best-effort: individual
|
||||
failures are logged, not raised, so one orphaned artifact can't undo the move.
|
||||
"""
|
||||
import re
|
||||
|
||||
# Track whether each public destination was fully cleaned. The NOMAD number
|
||||
# is only recycled when every deletion succeeded — otherwise a future public
|
||||
# track could reuse the number while the old public files still linger,
|
||||
# producing a duplicate. (Mirrors the admin delete-outputs recycle gate.)
|
||||
youtube_ok = True
|
||||
dropbox_ok = True
|
||||
gdrive_ok = True
|
||||
|
||||
youtube_url = public_outputs.get("youtube_url")
|
||||
if youtube_url:
|
||||
try:
|
||||
video_id_match = re.search(r'(?:youtu\.be/|youtube\.com/watch\?v=)([^&\s]+)', youtube_url)
|
||||
if video_id_match:
|
||||
video_id = video_id_match.group(1)
|
||||
from karaoke_gen.karaoke_finalise.karaoke_finalise import KaraokeFinalise
|
||||
from backend.services.youtube_service import get_youtube_service
|
||||
youtube_service = get_youtube_service()
|
||||
if youtube_service.is_configured:
|
||||
finalise = KaraokeFinalise(
|
||||
dry_run=False, non_interactive=True,
|
||||
user_youtube_credentials=youtube_service.get_credentials_dict()
|
||||
)
|
||||
finalise.delete_youtube_video(video_id)
|
||||
logger.info(f"[job:{job_id}] Deleted public YouTube video {video_id}")
|
||||
except Exception as e:
|
||||
youtube_ok = False
|
||||
logger.warning(f"[job:{job_id}] Failed to delete public YouTube video: {e}")
|
||||
|
||||
brand_code = public_outputs.get("brand_code")
|
||||
dropbox_path = public_outputs.get("dropbox_path")
|
||||
if brand_code and dropbox_path:
|
||||
try:
|
||||
from backend.services.dropbox_service import get_dropbox_service
|
||||
dropbox = get_dropbox_service()
|
||||
if dropbox.is_configured:
|
||||
from karaoke_gen.utils import sanitize_filename
|
||||
safe_artist = sanitize_filename(public_outputs.get("artist")) if public_outputs.get("artist") else "Unknown"
|
||||
safe_title = sanitize_filename(public_outputs.get("title")) if public_outputs.get("title") else "Unknown"
|
||||
folder_name = f"{brand_code} - {safe_artist} - {safe_title}"
|
||||
full_path = f"{dropbox_path}/{folder_name}"
|
||||
dropbox.delete_folder(full_path)
|
||||
logger.info(f"[job:{job_id}] Deleted public Dropbox folder {full_path}")
|
||||
except Exception as e:
|
||||
dropbox_ok = False
|
||||
logger.warning(f"[job:{job_id}] Failed to delete public Dropbox folder: {e}")
|
||||
|
||||
gdrive_files = public_outputs.get("gdrive_files")
|
||||
if gdrive_files:
|
||||
try:
|
||||
from backend.services.gdrive_service import get_gdrive_service
|
||||
gdrive = get_gdrive_service()
|
||||
if gdrive.is_configured:
|
||||
file_ids = list(gdrive_files.values()) if isinstance(gdrive_files, dict) else []
|
||||
gdrive.delete_files(file_ids)
|
||||
logger.info(f"[job:{job_id}] Deleted public Google Drive files")
|
||||
except Exception as e:
|
||||
gdrive_ok = False
|
||||
logger.warning(f"[job:{job_id}] Failed to delete public Google Drive files: {e}")
|
||||
|
||||
# A track going private should also leave the public Nomad GCS fast-sync
|
||||
# mirror (and thus kjbox). Prefix-keyed by the public brand_code, non-fatal.
|
||||
if brand_code:
|
||||
try:
|
||||
from backend.services.nomad_master_mirror import cleanup_nomad_masters
|
||||
cleanup_nomad_masters(brand_code)
|
||||
except Exception as e:
|
||||
logger.warning(f"[job:{job_id}] Failed to clean up Nomad mirror for {brand_code}: {e}")
|
||||
|
||||
# Recycle the public NOMAD number so the next public track fills the gap —
|
||||
# but only if every public deletion succeeded. If any lingered, keep the
|
||||
# number reserved (a permanent gap the validator will flag) rather than
|
||||
# risk a future duplicate; the leftover artifacts can then be cleaned up.
|
||||
if brand_code and youtube_ok and dropbox_ok and gdrive_ok:
|
||||
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"[job:{job_id}] Recycled public brand code {brand_code}")
|
||||
except Exception as e:
|
||||
logger.warning(f"[job:{job_id}] Failed to recycle public brand code {brand_code}: {e}")
|
||||
elif brand_code:
|
||||
logger.warning(
|
||||
f"[job:{job_id}] NOT recycling public brand code {brand_code}: "
|
||||
f"public cleanup incomplete (youtube={youtube_ok}, dropbox={dropbox_ok}, gdrive={gdrive_ok})"
|
||||
)
|
||||
|
||||
async def _delete_distributed_outputs(self, job_id: str, job, keep_gcs_finals: bool = False):
|
||||
"""Delete distributed outputs (YouTube, Dropbox, GDrive) and recycle brand code."""
|
||||
import re
|
||||
|
||||
@@ -101,9 +101,7 @@ class TestChangeToPrivate:
|
||||
"""Test public -> private visibility change."""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_redistributes_then_deletes_public(self):
|
||||
"""Distribute-then-delete: redistribute runs, then public outputs are deleted
|
||||
with the references captured before redistribution overwrote state."""
|
||||
async def test_calls_redistribute(self):
|
||||
mock_job_manager = MagicMock()
|
||||
mock_job_ref = MagicMock()
|
||||
mock_job_manager.firestore.db.collection.return_value.document.return_value = mock_job_ref
|
||||
@@ -112,29 +110,18 @@ class TestChangeToPrivate:
|
||||
job = _make_job(is_private=False, state_data={
|
||||
"youtube_url": "https://youtube.com/watch?v=abc",
|
||||
"brand_code": "NOMAD-0001",
|
||||
"gdrive_files": {"mp4": "id1"},
|
||||
"dropbox_link": "https://dropbox.com/test",
|
||||
})
|
||||
|
||||
call_order = []
|
||||
mock_redist = AsyncMock(return_value=True, side_effect=lambda *a, **k: call_order.append("redist") or True)
|
||||
mock_delete = AsyncMock(side_effect=lambda *a, **k: call_order.append("delete"))
|
||||
|
||||
with patch("backend.services.visibility_change_service.VisibilityChangeService._delete_public_outputs", mock_delete), \
|
||||
patch("backend.workers.video_worker.redistribute_video", mock_redist):
|
||||
with patch("backend.services.visibility_change_service.VisibilityChangeService._delete_distributed_outputs", new_callable=AsyncMock) as mock_delete, \
|
||||
patch("backend.workers.video_worker.redistribute_video", new_callable=AsyncMock, return_value=True) as mock_redist:
|
||||
|
||||
result = await service.change_to_private("test-123", job, "user@example.com")
|
||||
|
||||
assert result["status"] == "success"
|
||||
assert result["reprocessing_required"] is False
|
||||
mock_delete.assert_called_once_with("test-123", job, keep_gcs_finals=True)
|
||||
mock_redist.assert_called_once_with("test-123")
|
||||
# Redistribution must happen BEFORE any public deletion.
|
||||
assert call_order == ["redist", "delete"]
|
||||
# Public deletion receives the references captured before redistribution.
|
||||
captured = mock_delete.call_args.args[1]
|
||||
assert captured["youtube_url"] == "https://youtube.com/watch?v=abc"
|
||||
assert captured["brand_code"] == "NOMAD-0001"
|
||||
assert captured["gdrive_files"] == {"mp4": "id1"}
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_sets_is_private_true(self):
|
||||
@@ -145,7 +132,7 @@ class TestChangeToPrivate:
|
||||
service = VisibilityChangeService(job_manager=mock_job_manager)
|
||||
job = _make_job(is_private=False, state_data={})
|
||||
|
||||
with patch("backend.services.visibility_change_service.VisibilityChangeService._delete_public_outputs", new_callable=AsyncMock), \
|
||||
with patch("backend.services.visibility_change_service.VisibilityChangeService._delete_distributed_outputs", new_callable=AsyncMock), \
|
||||
patch("backend.workers.video_worker.redistribute_video", new_callable=AsyncMock, return_value=True):
|
||||
|
||||
await service.change_to_private("test-123", job, "user@example.com")
|
||||
@@ -296,33 +283,22 @@ class TestChangeToPrivateErrors:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_rollback_on_redistribute_failure(self):
|
||||
"""On redistribution failure NOTHING public is deleted and the job is
|
||||
reverted to public — a failed going-private is a no-op, not a partial."""
|
||||
mock_job_manager = MagicMock()
|
||||
mock_job_ref = MagicMock()
|
||||
mock_job_manager.firestore.db.collection.return_value.document.return_value = mock_job_ref
|
||||
|
||||
service = VisibilityChangeService(job_manager=mock_job_manager)
|
||||
job = _make_job(is_private=False, state_data={
|
||||
"youtube_url": "https://youtube.com/watch?v=abc",
|
||||
"brand_code": "NOMAD-0001",
|
||||
"gdrive_files": {"mp4": "id1"},
|
||||
})
|
||||
job = _make_job(is_private=False, state_data={})
|
||||
|
||||
mock_delete = AsyncMock()
|
||||
with patch("backend.services.visibility_change_service.VisibilityChangeService._delete_public_outputs", mock_delete), \
|
||||
with patch("backend.services.visibility_change_service.VisibilityChangeService._delete_distributed_outputs", new_callable=AsyncMock), \
|
||||
patch("backend.workers.video_worker.redistribute_video", new_callable=AsyncMock, return_value=False):
|
||||
|
||||
with pytest.raises(RuntimeError, match="Redistribution failed"):
|
||||
await service.change_to_private("test-123", job, "user@example.com")
|
||||
|
||||
# Public outputs must NOT be deleted when redistribution fails.
|
||||
mock_delete.assert_not_called()
|
||||
|
||||
# Job reverted to public + guard flag cleared (DELETE_FIELD sentinel).
|
||||
last_update = mock_job_ref.update.call_args_list[-1].args[0]
|
||||
assert last_update.get("is_private") is False
|
||||
val = last_update.get("state_data.visibility_change_in_progress")
|
||||
# Guard flag should be cleared on failure (DELETE_FIELD sentinel)
|
||||
last_update = mock_job_ref.update.call_args_list[-1]
|
||||
val = last_update.args[0].get("state_data.visibility_change_in_progress")
|
||||
assert "delete" in str(type(val)).lower() or "sentinel" in str(val).lower()
|
||||
|
||||
|
||||
@@ -347,65 +323,6 @@ class TestDeleteDistributedOutputs:
|
||||
|
||||
mock_brand_svc.recycle_brand_code.assert_called_once_with("NOMAD", 42)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_public_outputs_recycles_public_code(self):
|
||||
"""_delete_public_outputs recycles the captured public NOMAD number."""
|
||||
mock_job_manager = MagicMock()
|
||||
service = VisibilityChangeService(job_manager=mock_job_manager)
|
||||
|
||||
public_outputs = {
|
||||
"youtube_url": None,
|
||||
"brand_code": "NOMAD-0042",
|
||||
"gdrive_files": None,
|
||||
"dropbox_path": None,
|
||||
"artist": "A",
|
||||
"title": "T",
|
||||
}
|
||||
|
||||
with patch("backend.services.brand_code_service.get_brand_code_service") as mock_bcs, \
|
||||
patch("backend.services.brand_code_service.BrandCodeService.parse_brand_code", return_value=("NOMAD", 42)), \
|
||||
patch("backend.services.nomad_master_mirror.cleanup_nomad_masters") as mock_mirror:
|
||||
mock_brand_svc = MagicMock()
|
||||
mock_bcs.return_value = mock_brand_svc
|
||||
|
||||
await service._delete_public_outputs("test-123", public_outputs)
|
||||
|
||||
# No public YouTube/Dropbox/GDrive present → all deletions "succeed" →
|
||||
# the public number is recycled and the mirror is cleaned.
|
||||
mock_mirror.assert_called_once_with("NOMAD-0042")
|
||||
mock_brand_svc.recycle_brand_code.assert_called_once_with("NOMAD", 42)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delete_public_outputs_skips_recycle_on_incomplete_cleanup(self):
|
||||
"""If a public deletion fails, the number is NOT recycled (avoids a future
|
||||
duplicate against lingering public files)."""
|
||||
mock_job_manager = MagicMock()
|
||||
service = VisibilityChangeService(job_manager=mock_job_manager)
|
||||
|
||||
public_outputs = {
|
||||
"youtube_url": None,
|
||||
"brand_code": "NOMAD-0042",
|
||||
"gdrive_files": {"mp4": "id1"},
|
||||
"dropbox_path": None,
|
||||
"artist": "A",
|
||||
"title": "T",
|
||||
}
|
||||
|
||||
with patch("backend.services.gdrive_service.get_gdrive_service") as mock_gd, \
|
||||
patch("backend.services.nomad_master_mirror.cleanup_nomad_masters"), \
|
||||
patch("backend.services.brand_code_service.get_brand_code_service") as mock_bcs, \
|
||||
patch("backend.services.brand_code_service.BrandCodeService.parse_brand_code", return_value=("NOMAD", 42)):
|
||||
gd = MagicMock()
|
||||
gd.is_configured = True
|
||||
gd.delete_files.side_effect = RuntimeError("gdrive boom")
|
||||
mock_gd.return_value = gd
|
||||
mock_brand_svc = MagicMock()
|
||||
mock_bcs.return_value = mock_brand_svc
|
||||
|
||||
await service._delete_public_outputs("test-123", public_outputs)
|
||||
|
||||
mock_brand_svc.recycle_brand_code.assert_not_called()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_clears_distribution_state_keys(self):
|
||||
mock_job_manager = MagicMock()
|
||||
|
||||
@@ -171,7 +171,7 @@ class TestLocalEncodingServiceEncodingMethods:
|
||||
|
||||
@patch.object(LocalEncodingService, "_execute_command_with_fallback")
|
||||
def test_convert_mov_to_mp4(self, mock_execute):
|
||||
"""Test MOV to MP4 conversion produces a standard, portable "With Vocals" mp4."""
|
||||
"""Test MOV to MP4 conversion."""
|
||||
mock_execute.return_value = True
|
||||
|
||||
service = LocalEncodingService()
|
||||
@@ -182,19 +182,6 @@ class TestLocalEncodingServiceEncodingMethods:
|
||||
|
||||
assert result is True
|
||||
mock_execute.assert_called_once()
|
||||
gpu_command, cpu_command = mock_execute.call_args[0][0], mock_execute.call_args[0][1]
|
||||
# The CPU (software) command is what runs on prod encoding workers (no NVENC).
|
||||
# It must normalize 4:4:4 -> 4:2:0 for playback compatibility, use a fast preset
|
||||
# (this is the longest finalization stage), and emit portable AAC (not FLAC-in-mp4).
|
||||
assert "-pix_fmt yuv420p" in cpu_command
|
||||
assert "-preset veryfast" in cpu_command
|
||||
assert "-c:a aac" in cpu_command
|
||||
assert "-b:a 320k" in cpu_command
|
||||
assert "-c:a copy" not in cpu_command # regression guard: no FLAC-in-mp4
|
||||
# GPU path also forces 4:2:0 (h264_nvenc can preserve yuv444p) and emits AAC.
|
||||
assert "-pix_fmt yuv420p" in gpu_command
|
||||
assert "-c:a aac" in gpu_command
|
||||
assert "-b:a 320k" in gpu_command
|
||||
|
||||
@patch.object(LocalEncodingService, "_execute_command_with_fallback")
|
||||
def test_encode_lossless_mp4_without_end(self, mock_execute):
|
||||
|
||||
@@ -51,12 +51,6 @@ def mock_encoding_worker_config():
|
||||
config.deploy_in_progress = False
|
||||
config.deploy_in_progress_since = None
|
||||
config.last_activity_at = None
|
||||
# No capacity fallback active by default → serving the c4d primary.
|
||||
config.active_override_vm = None
|
||||
config.active_override_ip = None
|
||||
config.active_override_zone = None
|
||||
config.active_override_set_at = None
|
||||
config.primary_machine_type = None
|
||||
return config
|
||||
|
||||
|
||||
@@ -140,7 +134,6 @@ class TestSystemStatusAdmin:
|
||||
|
||||
mock_auth = ("token123", UserType.ADMIN, -1)
|
||||
mock_manager = MagicMock()
|
||||
mock_manager._zone = "us-central1-c"
|
||||
mock_manager.get_config.return_value = mock_encoding_worker_config
|
||||
|
||||
with patch("backend.api.routes.health.check_encoding_worker_status", new_callable=AsyncMock, return_value=mock_encoding_status), \
|
||||
@@ -162,46 +155,3 @@ class TestSystemStatusAdmin:
|
||||
assert admin["secondary_vm"] == "encoding-worker-a"
|
||||
assert admin["last_swap_at"] == "2026-03-31T18:10:00Z"
|
||||
assert admin["deploy_in_progress"] is False
|
||||
|
||||
# No fallback active → serving the c4d primary VM.
|
||||
assert admin["on_fallback"] is False
|
||||
assert admin["active_vm"] == "encoding-worker-b"
|
||||
assert admin["active_zone"] == "us-central1-c"
|
||||
assert admin["active_machine_type"] == "c4d-highcpu-32"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_admin_sees_capacity_fallback_worker(
|
||||
self, mock_encoding_status, mock_flacfetch_status, mock_separator_status, mock_encoding_worker_config
|
||||
):
|
||||
"""When a stockout routes off the primary, the live worker reflects the fallback."""
|
||||
from backend.api.routes.health import system_status
|
||||
from backend.services.auth_service import UserType
|
||||
|
||||
# Capacity fallback active: serving an n2-family VM in an alternate zone.
|
||||
mock_encoding_worker_config.active_override_vm = "encoding-worker-fallback-n2c"
|
||||
mock_encoding_worker_config.active_override_ip = "34.9.9.9"
|
||||
mock_encoding_worker_config.active_override_zone = "us-central1-a"
|
||||
|
||||
mock_auth = ("token123", UserType.ADMIN, -1)
|
||||
mock_manager = MagicMock()
|
||||
mock_manager._zone = "us-central1-c"
|
||||
mock_manager.get_config.return_value = mock_encoding_worker_config
|
||||
|
||||
with patch("backend.api.routes.health.check_encoding_worker_status", new_callable=AsyncMock, return_value=mock_encoding_status), \
|
||||
patch("backend.api.routes.health.check_flacfetch_service_status", new_callable=AsyncMock, return_value=mock_flacfetch_status), \
|
||||
patch("backend.api.routes.health.check_audio_separator_status", return_value=mock_separator_status), \
|
||||
patch("backend.api.routes.health.VERSION", "0.155.3"), \
|
||||
patch("backend.api.routes.health.COMMIT_SHA", ""), \
|
||||
patch("backend.api.routes.health.PR_NUMBER", ""), \
|
||||
patch("backend.api.routes.health.PR_TITLE", ""), \
|
||||
patch("backend.api.routes.health.STARTUP_TIME", "2026-03-31T18:10:00Z"), \
|
||||
patch("backend.api.routes.health._get_encoding_worker_manager", return_value=mock_manager):
|
||||
|
||||
result = await system_status(auth=mock_auth)
|
||||
|
||||
admin = result["services"]["encoder"]["admin_details"]
|
||||
assert admin["on_fallback"] is True
|
||||
assert admin["active_vm"] == "encoding-worker-fallback-n2c"
|
||||
assert admin["active_zone"] == "us-central1-a"
|
||||
# "n2c" family token → n2-highcpu-32 (inferred from the VM name).
|
||||
assert admin["active_machine_type"] == "n2-highcpu-32"
|
||||
@@ -21,7 +21,6 @@ from backend.workers.video_worker_orchestrator import (
|
||||
VideoWorkerOrchestrator,
|
||||
create_orchestrator_config_from_job,
|
||||
)
|
||||
from backend.models.job import JobStatus
|
||||
|
||||
|
||||
class TestOrchestratorConfig:
|
||||
@@ -2133,52 +2132,3 @@ class TestOriginalVocalsGuideEmit:
|
||||
|
||||
with patch("backend.workers.style_helper.load_style_config", side_effect=fake_load):
|
||||
assert await orch._resolve_intro_seconds() == 8.0
|
||||
|
||||
|
||||
class TestRedistributeModeProgress:
|
||||
"""redistribute_mode must not attempt job status transitions.
|
||||
|
||||
Regression for the public->private data-loss bug: redistributing an already
|
||||
`complete` job drove `_update_progress(PACKAGING)`, which raised
|
||||
InvalidStateTransitionError (`complete -> packaging`) and aborted the
|
||||
redistribution after the public outputs had already been deleted.
|
||||
"""
|
||||
|
||||
def _config(self, redistribute_mode):
|
||||
return OrchestratorConfig(
|
||||
job_id="job-1",
|
||||
artist="A",
|
||||
title="T",
|
||||
title_video_path="",
|
||||
karaoke_video_path="",
|
||||
instrumental_audio_path="",
|
||||
redistribute_mode=redistribute_mode,
|
||||
)
|
||||
|
||||
def test_redistribute_mode_skips_status_transition(self):
|
||||
jm = MagicMock()
|
||||
orch = VideoWorkerOrchestrator(
|
||||
config=self._config(redistribute_mode=True),
|
||||
job_manager=jm,
|
||||
storage=MagicMock(),
|
||||
job_logger=MagicMock(),
|
||||
)
|
||||
|
||||
orch._update_progress(JobStatus.PACKAGING, 90, "Uploading files")
|
||||
|
||||
jm.transition_to_state.assert_not_called()
|
||||
jm.update_job.assert_called_once_with("job-1", {"progress": 90})
|
||||
|
||||
def test_normal_mode_drives_status_transition(self):
|
||||
jm = MagicMock()
|
||||
orch = VideoWorkerOrchestrator(
|
||||
config=self._config(redistribute_mode=False),
|
||||
job_manager=jm,
|
||||
storage=MagicMock(),
|
||||
job_logger=MagicMock(),
|
||||
)
|
||||
|
||||
orch._update_progress(JobStatus.PACKAGING, 90, "Uploading files")
|
||||
|
||||
jm.transition_to_state.assert_called_once()
|
||||
jm.update_job.assert_not_called()
|
||||
@@ -128,10 +128,7 @@ async def _encode_via_gce(
|
||||
"base_name": base_name,
|
||||
"instrumental_selection": instrumental_selection,
|
||||
"existing_instrumental": existing_instrumental,
|
||||
# NOTE: intentionally no "ffmpeg_threads" — finalization ffmpeg commands in
|
||||
# LocalEncodingService carry no -threads flag, so x264 uses its all-core auto
|
||||
# default (measured ~66-78% of a 32-vCPU worker busy during the heavy libx264
|
||||
# stages — not capped). See docs/archive/2026-08-16-finalization-cpu-efficiency-handoff.md.
|
||||
"ffmpeg_threads": 8, # c4-standard-8 has 8 vCPUs
|
||||
}
|
||||
|
||||
job_log.info(f"Submitting encoding job to GCE worker")
|
||||
@@ -505,7 +502,6 @@ async def redistribute_video(job_id: str) -> bool:
|
||||
return False
|
||||
|
||||
temp_dir = tempfile.mkdtemp(prefix=f"karaoke_redist_{job_id}_")
|
||||
orchestrator = None
|
||||
|
||||
try:
|
||||
# Download existing finals from GCS by listing the finals folder
|
||||
@@ -575,10 +571,6 @@ async def redistribute_video(job_id: str) -> bool:
|
||||
gdrive_folder_id=dist.gdrive_folder_id,
|
||||
enable_cdg=getattr(job, 'enable_cdg', False),
|
||||
enable_txt=getattr(job, 'enable_txt', False),
|
||||
# Redistributing an already-`complete` job: progress updates must not
|
||||
# attempt status transitions (complete -> packaging is illegal and
|
||||
# would abort the redistribution).
|
||||
redistribute_mode=True,
|
||||
)
|
||||
|
||||
orchestrator = VideoWorkerOrchestrator(
|
||||
@@ -609,24 +601,6 @@ async def redistribute_video(job_id: str) -> bool:
|
||||
await orchestrator._run_distribution()
|
||||
await orchestrator._run_notifications()
|
||||
|
||||
# Verify the redistribution actually produced the archive before reporting
|
||||
# success. The orchestrator swallows brand-code and Dropbox failures as
|
||||
# non-fatal warnings, so an apparent "success" can hide a missing archive.
|
||||
# Reporting success in that case would let the caller (public->private
|
||||
# visibility change) delete the still-live public outputs against a
|
||||
# non-existent private archive — the exact data-loss bug this path fixes.
|
||||
if config.brand_prefix and not orchestrator.result.brand_code:
|
||||
raise RuntimeError(
|
||||
"Redistribution produced no brand code — archive identity is missing"
|
||||
)
|
||||
if config.dropbox_path:
|
||||
dropbox_failed = any(
|
||||
"Dropbox upload failed" in w
|
||||
for w in (orchestrator.result.distribution_warnings or [])
|
||||
)
|
||||
if dropbox_failed:
|
||||
raise RuntimeError("Redistribution failed to upload the Dropbox archive")
|
||||
|
||||
# Update job state_data with new distribution results
|
||||
state_update = dict(job.state_data or {})
|
||||
state_update['brand_code'] = orchestrator.result.brand_code
|
||||
@@ -646,27 +620,6 @@ async def redistribute_video(job_id: str) -> bool:
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"[job:{job_id}] WORKER_END worker=video-redistribute status=error error={e}")
|
||||
# A brand code may have been allocated during _run_organization before the
|
||||
# failure. It was never persisted to the job, so return it to the pool to
|
||||
# avoid leaking a number (and, for a public->private change, so the caller's
|
||||
# rollback leaves no orphaned NOMADNP code).
|
||||
allocated = getattr(getattr(orchestrator, "result", None), "brand_code", None)
|
||||
if allocated:
|
||||
try:
|
||||
from backend.services.brand_code_service import (
|
||||
BrandCodeService,
|
||||
get_brand_code_service,
|
||||
)
|
||||
prefix, number = BrandCodeService.parse_brand_code(allocated)
|
||||
get_brand_code_service().recycle_brand_code(prefix, number)
|
||||
logger.info(
|
||||
f"[job:{job_id}] Recycled brand code {allocated} after failed redistribution"
|
||||
)
|
||||
except Exception as recycle_err:
|
||||
logger.warning(
|
||||
f"[job:{job_id}] Failed to recycle brand code {allocated} "
|
||||
f"after failed redistribution: {recycle_err}"
|
||||
)
|
||||
return False
|
||||
|
||||
finally:
|
||||
|
||||
@@ -105,14 +105,6 @@ class OrchestratorConfig:
|
||||
dry_run: bool = False
|
||||
non_interactive: bool = True
|
||||
|
||||
# Redistribution mode: when True, this orchestrator run is redistributing the
|
||||
# finals of an already-`complete` job (e.g. a public->private visibility change)
|
||||
# rather than driving a fresh job through its lifecycle. In this mode
|
||||
# _update_progress must NOT attempt job status transitions — the job is (and
|
||||
# stays) `complete`, and `complete -> packaging`/`encoding` are illegal
|
||||
# transitions that would otherwise abort the redistribution.
|
||||
redistribute_mode: bool = False
|
||||
|
||||
|
||||
@dataclass
|
||||
class OrchestratorResult:
|
||||
@@ -242,28 +234,14 @@ class VideoWorkerOrchestrator:
|
||||
return self._discord_service
|
||||
|
||||
def _update_progress(self, status: JobStatus, progress: int, message: str):
|
||||
"""Update job progress if job_manager is available.
|
||||
|
||||
In redistribute_mode the job is already `complete` and must stay that way,
|
||||
so we update only the progress percentage/message and skip the (illegal)
|
||||
status transition. Outside redistribute_mode this drives the normal
|
||||
lifecycle transition with validation.
|
||||
"""
|
||||
if not self.job_manager:
|
||||
return
|
||||
if self.config.redistribute_mode:
|
||||
# Progress-only update; do not transition status (job stays `complete`).
|
||||
self.job_manager.update_job(
|
||||
self.config.job_id,
|
||||
{"progress": progress},
|
||||
"""Update job progress if job_manager is available."""
|
||||
if self.job_manager:
|
||||
self.job_manager.transition_to_state(
|
||||
job_id=self.config.job_id,
|
||||
new_status=status,
|
||||
progress=progress,
|
||||
message=message
|
||||
)
|
||||
return
|
||||
self.job_manager.transition_to_state(
|
||||
job_id=self.config.job_id,
|
||||
new_status=status,
|
||||
progress=progress,
|
||||
message=message
|
||||
)
|
||||
|
||||
async def run(self) -> OrchestratorResult:
|
||||
"""
|
||||
|
||||
@@ -274,4 +274,3 @@ The cloud function does metadata-only checks via the GDrive API (fast, cheap, ca
|
||||
- **2026-02-28**: Added SendGrid email (primary), kept Pushbullet (fallback). Added post-job trigger from backend. Added `scripts/check_public_share.py` for manual invocation. Motivated by NOMAD-1271 duplicate brand code incident where daily-only checks left a duplicate undetected for ~24 hours.
|
||||
- **2026-03-02**: NOMAD-1276 incident fix. Post-job trigger now uses 5-minute Cloud Tasks delay instead of immediate invocation, preventing false "all clear" when E2E test files are still in GDrive during cleanup. Also fixed cross-folder gap detection (uses global max across all folders) and added 28 unit tests for the Cloud Function.
|
||||
- **2026-03-06**: NOMAD-1295 gap. Stale GCE encoding cache (#499) caused job `f4a552bf` to produce bad output on first run (allocated NOMAD-1295, only CDG uploaded). Admin re-triggered the job, which allocated a new brand code (NOMAD-1297) without recycling 1295. Fix: recycled 1295 back to the pool. Updated docs to clarify that new gaps must always be investigated and fixed, never added to KNOWN_GAPS.
|
||||
- **2026-08-18**: NOMAD-1537 gap. A **public→private visibility change** on job `25d076e5` (`Alma Nocturna – Mejor Cállate`) deleted the public GDrive/YouTube/Dropbox outputs and recycled 1537, then the private redistribution crashed (`redistribute_video` drove an illegal `complete → packaging` transition), so the change failed *after* the public files were already gone — a delete-first, no-rollback flow. The daily validator caught the hole; it self-closed when an unrelated public job reused the recycled 1537. **Going-private is a legitimate cause of a transient gap** (the number is recycled and refilled by the next public track) — the alert is expected and desired, not suppressed. Fixes (v0.196.1): `redistribute_video` runs in `redistribute_mode` (no status transition, stays `complete`); `change_to_private` is now **distribute-then-delete** (public outputs removed only after the private archive succeeds; on failure the job stays fully public); failed redistributions recycle any allocated `NOMADNP` code. Validator intentionally left unchanged.
|
||||
@@ -1,11 +1,6 @@
|
||||
# Handoff: Investigate prod finalization CPU efficiency / utilization — 2026-08-16
|
||||
|
||||
**Status:** ✅ RESOLVED 2026-08-16 — outcome (a): CPU already well-utilized (NOT
|
||||
capped at 8 cores); removed dead `ffmpeg_threads` config. Empirical measurement +
|
||||
resolution appended at the bottom under "RESOLUTION". The original investigation
|
||||
brief follows unchanged for context.
|
||||
|
||||
**Status (original):** OPEN investigation (not started). Written for a fresh Claude session —
|
||||
**Status:** OPEN investigation (not started). Written for a fresh Claude session —
|
||||
self-contained; all facts you need are inlined below or in the linked repo docs.
|
||||
**Origin:** surfaced by the encode-worker multi-instance-type benchmark
|
||||
(`docs/archive/2026-08-15-encoding-instance-type-diversity-plan.md`; benchmark
|
||||
@@ -144,71 +139,3 @@ close this out and just fix the stale comment; or (b) confirm an ~2–4× idle-c
|
||||
gap → raise threads / parallelize formats, validate the speedup and RAM headroom,
|
||||
ship it. Bump `pyproject.toml` version; if the fix is in the wheel's
|
||||
`LocalEncodingService`, it ships via the normal wheel → `ensure_latest_wheel` path.
|
||||
|
||||
---
|
||||
|
||||
## RESOLUTION (2026-08-16) — outcome (a): already efficient; dead config removed
|
||||
|
||||
**Verdict: the "leaving 75% idle" fear is unfounded. Finalization uses ~21–25 of a
|
||||
worker's 32 vCPUs during every heavy libx264 stage. No threading fix warranted.**
|
||||
|
||||
### 1. `ffmpeg_threads` is dead config — confirmed statically AND empirically
|
||||
- Before this change, `grep -rn ffmpeg_threads backend/` returned exactly one hit —
|
||||
the setter `"ffmpeg_threads": 8` in the `encoding_config` dict at
|
||||
`video_worker.py:131` — with zero consumers; `EncodingConfig(...)` at
|
||||
`gce_encoding/main.py:1111` never passes it. This change removes that setter
|
||||
(line 131 is now the explanatory NOTE comment), so grep now returns no setter.
|
||||
- **Empirically**, the deployed ffmpeg argv captured mid-encode (`ps`/probe on the
|
||||
worker) carry **no `-threads` flag** on any finalization command — x264 runs its
|
||||
all-core auto default. Sample argv observed:
|
||||
- `… -i with_vocals.mkv -c:v libx264 -c:a copy … (With Vocals).mp4`
|
||||
- `… concat=n=3… -c:v libx264 -c:a pcm_s16le … (Final Karaoke Lossless 4k).mp4`
|
||||
- `… -i …Lossless 4k.mp4 -c:v copy -c:a aac … (Lossy 4k).mp4`
|
||||
- `… -c:v libx264 -vf scale=1280:720 -preset medium -tune animation … (Lossy 720p).mp4`
|
||||
|
||||
### 2. Process-level CPU measurement (the point of this task)
|
||||
Method: started `encoding-worker-fallback-c4a` (c4-highcpu-32, 32 vCPU / 62 GB),
|
||||
recreated the bench input, POSTed `/encode` **directly to the VM IP**, and sampled
|
||||
`top -bH -d 2` on that same VM for the whole run. The authoritative signal is the
|
||||
system-wide `%Cpu(s)` summary line (0–100% across all 32 cores):
|
||||
|
||||
| Stage (serial) | ffmpeg cmd | `%Cpu us` (of 32) | ≈cores busy | peak RSS | ~duration |
|
||||
|---------------------------|------------------------------------|-------------------|-------------|----------|-----------|
|
||||
| "With Vocals" mp4 convert | `libx264 -c:a copy` (mkv→mp4) | 64–70% | ~21 | ~11 GB | ~59 s |
|
||||
| **Lossless 4K concat** | `libx264 -c:a pcm_s16le` | 72–75% | ~23 | ~9 GB | ~45 s |
|
||||
| Lossy 4K | `-c:v copy -c:a aac` (stream copy) | 3–5% | I/O-bound | <0.1 GB | ~4 s |
|
||||
| MKV (YouTube) | `-c:v copy -c:a flac` (copy) | low | I/O-bound | — | ~2 s |
|
||||
| 720p | `libx264 scale=1280:720 -preset medium` | 76–78% | ~25 | ~1.2 GB | ~12 s |
|
||||
|
||||
Full run: ~122 s of encoding + ~35 s GCS download/upload = **~158 s wall** (matches
|
||||
the ~139 s c4 baseline plus I/O). An 8-core cap would show `us≈25%, idle≈75%`; we
|
||||
observed the **opposite** (`us≈66–78%, idle≈22–34%`). Not capped.
|
||||
|
||||
### 3. Why the residual ~25–30% idle is NOT recoverable by more threads
|
||||
The heavy processes already spawn 90–162 OS threads (`nlwp`); x264's auto default is
|
||||
~1.5×cores. The idle is the structural ceiling of x264 **frame-threading**
|
||||
(inter-frame dependencies + a partially-serial lookahead), not a thread cap. Forcing
|
||||
`-threads 32`/`-x264-params threads=N` above auto gives negligible speed and can hurt
|
||||
quality. **Formats are serial and dependency-chained** (`encode_all_formats` steps
|
||||
3→{4,5,6}; lossy/mkv/720p all consume the lossless output), and the only overlap-able
|
||||
work after lossless is two near-free stream copies (lossy, mkv) — so parallelizing
|
||||
formats buys ~nothing and would raise peak RAM against the 32 GB fallback floor +
|
||||
the `ENCODING_HEAVY_CONCURRENCY=1` OOM constraint. Not worth it.
|
||||
|
||||
### 4. What shipped
|
||||
- Removed the dead `"ffmpeg_threads": 8` field + stale `c4-standard-8` comment at
|
||||
`video_worker.py:131`, replaced with a NOTE explaining the measured all-core
|
||||
behaviour (so nobody re-opens this). No behaviour change. Version bump only.
|
||||
|
||||
### 5. Follow-up worth its own task (NOT done here — out of scope, needs verification)
|
||||
The single biggest CPU cost is the **"With Vocals" preview** — a full 4K libx264
|
||||
re-encode (~59 s, longer than the lossless master itself). The source
|
||||
`with_vocals.mkv` is **already H.264** (High 4:4:4 Predictive, 3840×2160, `yuv444p`).
|
||||
If nothing downstream needs a re-encode / a different `pix_fmt`, this could become a
|
||||
container remux (`-c:v copy`) and save ~40–50 s/job — a far bigger win than any
|
||||
threading tweak. Requires confirming: (a) do players/consumers need `yuv420p` (4:4:4
|
||||
mp4 is poorly supported), and (b) does `convert_mov_to_mp4` intentionally normalize
|
||||
pix_fmt? Left for a dedicated investigation.
|
||||
|
||||
### Operational note
|
||||
Bench VM stopped, `gs://…/bench/**` deleted after the run, per hygiene.
|
||||
@@ -1,71 +0,0 @@
|
||||
# "With Vocals" preview encode — faster, smaller, more portable (2026-08-16)
|
||||
|
||||
**Status:** ✅ SHIPPED (v0.196.0). Follow-up from the finalization-CPU investigation
|
||||
(`2026-08-16-finalization-cpu-efficiency-handoff.md`), which identified the "With
|
||||
Vocals" conversion as the single longest finalization stage.
|
||||
|
||||
## Problem
|
||||
|
||||
`convert_mov_to_mp4` produces the **"(With Vocals).mp4"** sing-along deliverable from
|
||||
the renderer's source video. Process-level measurement on a live c4-highcpu-32 worker
|
||||
showed this was the **longest single finalization stage (~59s)** — longer than the
|
||||
lossless master itself.
|
||||
|
||||
Probing a real prod job (`faafd5ad`) revealed the encode was *accidentally* bad:
|
||||
- **No `-pix_fmt`** → inherited the renderer's `High 4:4:4 Predictive / yuv444p`. This
|
||||
is the **only** 4:4:4 file in the deliverable set (every other output is `yuv420p`),
|
||||
and 4:4:4 H.264 is rejected by many browsers/TVs/phones.
|
||||
- **Default `medium` preset** → slow.
|
||||
- **`-c:a copy`** (LocalEncodingService path) → **FLAC-in-MP4**, which is non-standard,
|
||||
despite the customer-facing spec (`template_service.py`) documenting the file as
|
||||
"4k H264/**AAC**".
|
||||
|
||||
## Safety check — is the "With Vocals" mp4 used downstream?
|
||||
|
||||
**No.** Confirmed in both encode paths (cloud `encode_all_formats` and local
|
||||
`KaraokeFinalise.remux_and_encode_output_video_files`): every later output (Karaoke.mp4,
|
||||
Lossless/Lossy/720p, MKV) derives from the **source** `with_vocals` file (via
|
||||
`remux_with_instrumental` → `Karaoke.mp4` → concat) and carries the **instrumental**
|
||||
audio. YouTube upload uses `final_karaoke_lossless_mkv`. The "(With Vocals).mp4" is
|
||||
written once and only uploaded/delivered — a leaf. So its encode can be chosen purely
|
||||
for the deliverable.
|
||||
|
||||
## Fix
|
||||
|
||||
`convert_mov_to_mp4` software (CPU) command — the path that runs on prod workers
|
||||
(no NVENC) — changed to:
|
||||
|
||||
```
|
||||
-c:v libx264 -pix_fmt yuv420p -preset veryfast -c:a aac -ar 48000 -b:a 320k -movflags +faststart
|
||||
```
|
||||
|
||||
Applied to **both** implementations (kept in sync):
|
||||
- `backend/services/local_encoding_service.py::LocalEncodingService.convert_mov_to_mp4`
|
||||
(cloud worker — prod)
|
||||
- `karaoke_gen/karaoke_finalise/karaoke_finalise.py::KaraokeFinalise.convert_mov_to_mp4`
|
||||
(local CLI; already emitted AAC, now also 4:2:0 + veryfast + 320k)
|
||||
|
||||
GPU/NVENC command: emits AAC 320k; `h264_nvenc` encodes 4:2:0 natively so no `-pix_fmt`
|
||||
needed. (Prod workers are CPU-only; NVENC is a local/GPU path.)
|
||||
|
||||
## Measured result (real source: Arctic Monkeys – Riot Van, 138s 4K)
|
||||
|
||||
| Metric | Before (prod) | After |
|
||||
|---|---|---|
|
||||
| Encode time | 56 s | **29 s** (~2×) |
|
||||
| File size | 22 MB | **14 MB** (~36% smaller) |
|
||||
| Video | h264 High 4:4:4 / yuv444p | **h264 High / yuv420p** |
|
||||
| Audio | FLAC-in-mp4 (~639 kbps) | **AAC-LC 48 kHz / 320 kbps** |
|
||||
|
||||
This is the longest finalization stage, so ~halving it cuts **~20-25% off total
|
||||
finalization wall-time**. The file gets **smaller** (AAC 320k ≪ FLAC ~639k, and 4:2:0
|
||||
< 4:4:4), so there is no size/CPU tradeoff — every axis improves, plus universal
|
||||
playback and spec-alignment.
|
||||
|
||||
## Notes / non-goals
|
||||
- Quality: for karaoke content (static background + text) `veryfast` vs `medium` is
|
||||
visually negligible; CRF-based, comparable bitrate.
|
||||
- The finalise-only **user-upload** path (a user's own `.mov`/`.mkv`, arbitrary codec)
|
||||
still re-encodes correctly — the command is codec-agnostic (no stream-copy assumption).
|
||||
- Not touched: whether a "reference" file needs to be 4K at all (a 1080p variant would
|
||||
be smaller still) — a product decision, left for later.
|
||||
@@ -1,204 +0,0 @@
|
||||
# Plan: Fix visibility-change redistribution + make sequence-gap alerts recycle-aware
|
||||
|
||||
**Created:** 2026-08-18
|
||||
**Branch:** feat/sess-20260818-1124-visibility-recycle-dataloss
|
||||
**Status:** Draft
|
||||
|
||||
## Overview
|
||||
|
||||
Investigation of a "GDrive Validation: missing 1537" alert traced to a **public→private
|
||||
visibility change** on NOMAD-1537 (`Alma Nocturna – Mejor Cállate`, job `25d076e5`),
|
||||
not a brand-code allocation race. Two real defects and one policy gap were found:
|
||||
|
||||
1. **`redistribute_video` always crashes** on `complete → packaging`
|
||||
(`video_worker_orchestrator.py:661`), so **every** public→private conversion silently
|
||||
fails its private-side redistribution — the track is never archived to the
|
||||
`Tracks-NonPublished` Dropbox and never gets a `NOMADNP` code. It looks fine to the
|
||||
customer because downloads serve from GCS finals.
|
||||
2. **`change_to_private` deletes first, rebuilds second, with no rollback**
|
||||
(`visibility_change_service.py:74-114`): it deletes YouTube/Dropbox/GDrive + recycles
|
||||
the public number, *then* calls the (always-failing) redistribution. Each failure also
|
||||
**leaks a `NOMADNP` code** (allocated, never saved, never recycled — e.g. `NOMADNP-0214`).
|
||||
3. **The gdrive-validator has no awareness of intentionally-vacated numbers.** Going-private
|
||||
recycles the public number (kept behaviour — see Decisions). Between recycle and the next
|
||||
public job reusing it, the number is legitimately absent from the public share, so the
|
||||
daily validator fires a false "missing" alert. (Here, `e921ab26 / Luvcat – Spider` later
|
||||
reused 1537, closing the gap ~5h after the alert.)
|
||||
|
||||
### Root-cause timeline (UTC 2026-08-18, confirmed from logs)
|
||||
- `00:05:54–58` — public→private on `25d076e5`: deleted YouTube `TJUKJRyb5MQ`, Dropbox folder,
|
||||
GDrive public-share files for 1537; recycled `NOMAD-1537`; cleared distribution state.
|
||||
- `00:06:07` — allocated `NOMADNP-0214`, started distribution, crashed
|
||||
`Invalid state transition … complete -> packaging`; redistribution aborted, **no rollback**.
|
||||
- `01:00:11` — gdrive-validator daily run reports `CDG/MP4/MP4-720p: missing 1537` → the alert.
|
||||
- `05:5x` — unrelated public job `e921ab26` (Luvcat – Spider) allocated the recycled `1537`
|
||||
and published under it.
|
||||
- `07:0x` — GCS/divebar mirror pulled `NOMAD-1537 - Luvcat - Spider.*` → gap closed.
|
||||
|
||||
Customer impact: **none** — `25d076e5` is a healthy private track (GCS-backed downloads work).
|
||||
Internal impact: no `Tracks-NonPublished` archive / `NOMADNP` code for it; one leaked private
|
||||
code; spurious operator alert.
|
||||
|
||||
## Decisions (from product owner, 2026-08-18)
|
||||
|
||||
- **Number policy: recycle & reuse (keep current).** A vacated public number returns to the
|
||||
pool and the next public job fills it.
|
||||
- **Validator: leave as-is — the transient gap warning is DESIRED.** Going-private is rare, the
|
||||
gap fills naturally on the next public track, and the owner explicitly wants the alert even
|
||||
in that case. → **Part E is dropped**; no change to `gdrive_validator/main.py` or
|
||||
`check_public_share.py`. Do not add anything to static `KNOWN_GAPS` either.
|
||||
- **Private archive: yes — fix redistribution.** Going-private must archive to
|
||||
`Tracks-NonPublished` with a `NOMADNP` code, consistent with native-private jobs, and must
|
||||
be atomic (public outputs removed only after the private archive succeeds).
|
||||
|
||||
Scope is therefore **A–D only** (fix + harden the redistribution path and recover the one
|
||||
affected job); the alerting pipeline is intentionally untouched.
|
||||
|
||||
## Requirements
|
||||
|
||||
- [ ] **A.** `redistribute_video` runs org+distribution+notifications on a `complete` job
|
||||
without an illegal status transition; job remains `complete` throughout.
|
||||
- [ ] **B.** `change_to_private` is **distribute-then-delete**: private redistribution +
|
||||
`NOMADNP` allocation succeed *before* public YouTube/Dropbox/GDrive deletion + public
|
||||
number recycle. On any failure: no public deletion, no leaked private code, job stays
|
||||
fully public and `complete`.
|
||||
- [ ] **C.** No leaked `NOMADNP` codes: a private code allocated during a redistribution that
|
||||
later fails is recycled (or not allocated until the success path).
|
||||
- [ ] **D.** Recover `25d076e5` (create its NonPublished archive + `NOMADNP` code) and recycle
|
||||
the leaked `NOMADNP-0214`.
|
||||
- [ ] Regression tests for A, B, C. All existing `test_change_visibility.py` tests still pass.
|
||||
- [ ] Validator and `KNOWN_GAPS` unchanged (transient going-private alert is desired).
|
||||
|
||||
**Out of scope (explicitly not doing):** ~~E — recycle-aware validator~~. The owner wants to keep
|
||||
receiving the gap warning for going-private events; it self-resolves on the next public track.
|
||||
|
||||
## Technical Approach
|
||||
|
||||
### A. Fix the `complete → packaging` crash (proximate bug)
|
||||
`redistribute_video` (`backend/workers/video_worker.py:481`) reuses
|
||||
`VideoWorkerOrchestrator._run_organization/_run_distribution/_run_notifications`;
|
||||
`_run_distribution` calls `self._update_progress(JobStatus.PACKAGING, 90, …)`
|
||||
(`video_worker_orchestrator.py:661`), which invokes `JobManager.transition_status(...,
|
||||
raise_on_invalid=True)`. From `complete` that's illegal (`models/job.py:193`:
|
||||
`COMPLETE → [AWAITING_REVIEW, LYRICS_COMPLETE]`).
|
||||
|
||||
**Chosen fix:** add a `redistribute_mode: bool = False` flag to `OrchestratorConfig`
|
||||
(or an `update_status: bool` param threaded to `_update_progress`). When set, `_update_progress`
|
||||
updates the progress **percentage/message only** and **skips the status write**, leaving the job
|
||||
`complete`. Rationale: a redistribution is not a lifecycle change; the job is and remains
|
||||
complete. Avoids polluting `STATE_TRANSITIONS` with a `COMPLETE↔PACKAGING` round-trip that other
|
||||
call sites could misuse.
|
||||
|
||||
- Guard: keep `raise_on_invalid=True` for the normal pipeline; the flag only bypasses the write.
|
||||
- Verify no other stage in the redistribute-only path (`_run_organization`, `_run_distribution`,
|
||||
`_run_notifications`) performs a status transition that assumes a fresh pipeline.
|
||||
|
||||
### B. Distribute-then-delete + rollback (`change_to_private`) — as implemented
|
||||
|
||||
1. **Capture the public output references** (`youtube_url`, `brand_code`, `gdrive_files`,
|
||||
`dropbox_path`, artist/title) from the job snapshot *before* anything mutates state —
|
||||
redistribution overwrites `state_data` with the new private values.
|
||||
2. Set the guard flag **and** `is_private=True` up front (a *temporary* flag) so
|
||||
`get_effective_distribution_for_job()` selects the private destination during redistribution.
|
||||
No "changed to private" timeline event yet.
|
||||
3. **Redistribute to the private destination** (`redistribute_video`): reuse GCS finals
|
||||
(`keep_gcs_finals` stays true — never deleted for this path), upload to `Tracks-NonPublished`,
|
||||
allocate `NOMADNP` code. Public outputs are still live at this point.
|
||||
4. **If redistribution fails** (raises or returns False): revert `is_private=False`, clear the
|
||||
guard flag, re-raise `RuntimeError("Redistribution failed …")`. No public output was touched,
|
||||
and `redistribute_video` already recycled any `NOMADNP` code it allocated (C) — a failed
|
||||
going-private is a clean no-op.
|
||||
5. **On success**, the private archive exists and the move has committed — from here we do
|
||||
**not** revert to public. Delete the *public* outputs (YouTube, public Dropbox folder, public
|
||||
GDrive files) via `_delete_public_outputs` (best-effort, never raises) and **recycle the public
|
||||
`NOMAD` number** — but only if every public deletion succeeded (else keep the number reserved
|
||||
to avoid a future duplicate). Then record the "changed to private" timeline event and clear the
|
||||
guard flag.
|
||||
|
||||
Note the YouTube deletion is irreversible, which is *why* it must be last — the old delete-first
|
||||
order could never be safely rolled back. `redistribute_video` additionally verifies the archive
|
||||
actually materialized (brand code allocated + Dropbox upload not failed) before returning success,
|
||||
because the orchestrator swallows brand-code/Dropbox failures as warnings; without this a false
|
||||
"success" would delete the public outputs against a non-existent private archive.
|
||||
|
||||
### C. No leaked private codes
|
||||
Two options; prefer (i):
|
||||
- (i) Allocate the `NOMADNP` code inside the redistribution success path only; if redistribution
|
||||
fails before it is persisted, nothing to recycle. Where allocation already happens early
|
||||
(orchestrator `_run_organization`), wrap the redistribute call so a failure recycles
|
||||
`orchestrator.result.brand_code` if one was allocated.
|
||||
- (ii) Always recycle `orchestrator.result.brand_code` in the `except` path of `change_to_private`.
|
||||
|
||||
### D. Recovery (operational, after A–C deployed)
|
||||
- **`25d076e5`:** re-run the fixed private redistribution (finals + packages confirmed present in
|
||||
`gs://…/jobs/25d076e5/{finals,packages}/`). Produces the NonPublished archive + `NOMADNP` code.
|
||||
Use the admin re-distribute path or a one-off `redistribute_video('25d076e5')` invocation.
|
||||
- **Leaked `NOMADNP-0214`:** recycle into `brand_code_counters/NOMADNP.recycled` (currently
|
||||
`next_number=216, recycled=[215]`), or leave — private prefixes aren't validated. Recycle for
|
||||
hygiene.
|
||||
- No action needed on `NOMAD-1537` (already correctly reused by Luvcat, gap closed).
|
||||
|
||||
### E. (dropped)
|
||||
Recycle-aware validator suppression is intentionally **not** implemented — see Decisions. The
|
||||
transient going-private gap warning is desired and self-resolves on the next public track. The
|
||||
post-job re-validation trigger (`video_worker_orchestrator.py:305`, gated on `gdrive_folder_id`)
|
||||
is correct as-is for private conversions (no public folder to re-check).
|
||||
|
||||
## Files to Create/Modify
|
||||
|
||||
| File | Action | Description |
|
||||
|------|--------|-------------|
|
||||
| `backend/workers/video_worker_orchestrator.py` | Modify | `redistribute_mode`/`update_status` flag; `_update_progress` skips status write when set |
|
||||
| `backend/workers/video_worker.py` | Modify | `redistribute_video` passes the flag; recycle allocated code on failure |
|
||||
| `backend/services/visibility_change_service.py` | Modify | Reorder `change_to_private` to distribute-then-delete; split `_delete_distributed_outputs`; recycle-on-failure |
|
||||
| `backend/models/job.py` | Review | Confirm no `STATE_TRANSITIONS` change needed (preferred: none) |
|
||||
| `backend/tests/test_change_visibility.py` | Modify | Real distribute-then-delete + rollback assertions (not just guard-flag) |
|
||||
| `backend/tests/test_video_worker_redistribute.py` | Create | `redistribute_video` on `complete` job succeeds, no illegal transition |
|
||||
| `docs/GDRIVE-VALIDATOR.md` | Modify | Add incident to History; note going-private is a legitimate (alerting) cause of gaps |
|
||||
| `pyproject.toml` | Modify | Version bump |
|
||||
|
||||
## Testing Strategy
|
||||
|
||||
Follow `docs/TESTING.md`; backend unit/integration in `backend/tests/` (mock GCP), validator
|
||||
unit in `infrastructure/functions/gdrive_validator/test_main.py`.
|
||||
|
||||
- **A:** `redistribute_video` on a `complete` job runs all three stages and does **not** raise
|
||||
`InvalidStateTransitionError`; job status stays `complete`; brand_code/dropbox_link written.
|
||||
- **B:** `change_to_private` — (a) success path: private redistribute called *before* any public
|
||||
delete; public delete + public-code recycle happen only after; (b) failure path: redistribution
|
||||
raises → **assert public YouTube/Dropbox/GDrive delete were NOT called**, `is_private` stays
|
||||
False, guard flag cleared, exception re-raised. Strengthen the existing
|
||||
`test_rollback_on_redistribute_failure` (today only checks the guard flag).
|
||||
- **C:** redistribution failure → allocated `NOMADNP` code is recycled exactly once.
|
||||
- **Regression:** full `test_change_visibility.py` + `test_brand_code_service.py` green.
|
||||
- **Post-deploy (once):** re-run `python scripts/check_public_share.py` → clean; recover
|
||||
`25d076e5` and confirm NonPublished archive + `NOMADNP` code appear.
|
||||
|
||||
## Recovery Runbook (D)
|
||||
|
||||
```python
|
||||
# After A–C deployed. Recover the private archive for 25d076e5 (finals present in GCS).
|
||||
from backend.workers.video_worker import redistribute_video
|
||||
await redistribute_video("25d076e5") # job already is_private=True → NonPublished + NOMADNP
|
||||
|
||||
# Recycle the leaked private code
|
||||
from backend.services.brand_code_service import get_brand_code_service
|
||||
get_brand_code_service().recycle_brand_code("NOMADNP", 214)
|
||||
```
|
||||
|
||||
## Open Questions
|
||||
|
||||
- [ ] Preferred A mechanism: config `redistribute_mode` flag vs. threading `update_status=False`
|
||||
through `_update_progress`? (Leaning: config flag — single choke point.)
|
||||
- [ ] For B, is it acceptable for the private `Tracks-NonPublished` archive to exist *simultaneously*
|
||||
with the still-live public outputs for the few seconds before public deletion? (Expected: yes.)
|
||||
|
||||
## Rollback Plan
|
||||
|
||||
- Pure backend code; no schema changes, no infra/validator changes. Revert the PR to restore prior
|
||||
behaviour.
|
||||
- `redistribute_mode` is opt-in (only the redistribute path sets it); the normal pipeline is
|
||||
unaffected, so A/B cannot regress fresh-job distribution.
|
||||
- Recovery step (D) is idempotent-ish: re-running `redistribute_video` re-uploads from GCS finals;
|
||||
safe to retry.
|
||||
```
|
||||
@@ -1,86 +0,0 @@
|
||||
# Health-check alert noise + frontend graceful degradation (2026-08-22)
|
||||
|
||||
## Trigger
|
||||
|
||||
A "Karaoke Backend - Service Unavailable" uptime alert fired at 06:06 UTC on
|
||||
2026-08-22 and auto-recovered ~1m41s later. Investigation of the noise, plus a
|
||||
follow-on request to make the frontend degrade gracefully during such blips.
|
||||
|
||||
## Root cause of the alert
|
||||
|
||||
**A routine, platform-initiated Cloud Run instance recycle — not a crash.**
|
||||
|
||||
- The backend runs on `--min-instances 1` (a deliberate cost choice).
|
||||
- At 06:01:53 UTC Cloud Run reaped the single warm instance (which had run ~9.6h
|
||||
since the previous evening's deploy) and started a replacement
|
||||
(`Reason: MANUAL_OR_CUSTOMER_MIN_INSTANCE`, then `AUTOSCALING`). The new
|
||||
container's STARTUP probe passed ~06:03:13.
|
||||
- During the ~80s gap (06:02:30–06:03:50) there was **no warm origin**, so
|
||||
Cloudflare failed the health check from **all 6** uptime checker regions
|
||||
simultaneously. Zero `/api/health` requests reached the origin in that window;
|
||||
no `SIGTERM`/OOM/error was logged (platform reaps leave no teardown log).
|
||||
- The uptime alert (reworked 2026-08-19 to page only when >1 checker location
|
||||
fails) did its job — it caught a genuine, if brief, hard-down.
|
||||
- A second, related failure mode was also observed (00:11–00:12 UTC): the single
|
||||
instance's event loop stalled (orchestrating an encoding-worker fallback
|
||||
cold-start with blocking timeouts), so health probes queued past the 10s
|
||||
uptime timeout across regions, then flushed at once.
|
||||
|
||||
Blast radius of such a blip: ~80s of API unavailability. The **frontend still
|
||||
loads** (static Cloudflare Pages export), **Cloud Run Jobs** (video renders) and
|
||||
**GCE encoding-worker** executions already in flight **keep running**; only
|
||||
backend-side orchestration is briefly paused and self-heals via Cloud
|
||||
Tasks/Scheduler retries + the recover-stuck-jobs / retry-pending-render crons.
|
||||
|
||||
## Change 1 — soften the alert (server-side)
|
||||
|
||||
`infrastructure/modules/monitoring.py`: the "Service Unavailable" condition
|
||||
`duration` 60s → **300s**. A sub-5-min self-healing recycle/stall no longer
|
||||
pages; a sustained hard-down still fires (~5–6 min). The read-retry budget in the
|
||||
frontend (`lib/backend-status.ts`) is aligned to the same ~10s escalation.
|
||||
|
||||
We deliberately did **not** raise `--min-instances` to 2 (cost choice). If real
|
||||
outages ever slip through undetected, that is the cheaper-detection lever and it
|
||||
removes both failure modes at the source.
|
||||
|
||||
## Change 2 — graceful degradation (frontend)
|
||||
|
||||
Goal: during a blip, retry transparently and show one reassuring app-wide message
|
||||
instead of every screen throwing a generic error.
|
||||
|
||||
- **`lib/backend-status.ts`** — framework-agnostic connectivity store
|
||||
(`online | reconnecting | unavailable`) + `useBackendStatus()`. Escalates to
|
||||
`unavailable` after `UNAVAILABLE_AFTER_MS` (10s) of unbroken trouble; any
|
||||
success returns to `online`.
|
||||
- **`lib/api.ts` — `apiFetch`** wraps every backend call (drop-in for `fetch`;
|
||||
internals use `globalThis.fetch`). Design decisions:
|
||||
- **Decoupled** the non-aborting "reconnecting" hint (2.5s) from the hard
|
||||
backstop (45s) + transient-status/network detection — so a legitimately slow
|
||||
GET shows the hint then clears on success and is **never falsely failed**.
|
||||
- **Retries GET only** (idempotent); **never auto-retries non-GET** (a replayed
|
||||
create/submit/payment could double-charge). GETs retry within a ~10s budget,
|
||||
then throw `BackendUnavailableError`.
|
||||
- Transient = 502/503/504 + Cloudflare 520–524. Third-party hosts (GCS
|
||||
signed-URL uploads) pass straight through untouched.
|
||||
- **`components/backend-status-banner.tsx`** — the two UX states; mounted in
|
||||
`app/[locale]/layout.tsx` so it covers all customer-facing surfaces (landing,
|
||||
logged-in dashboard, review screens) with full i18n. `/admin/*` is intentionally
|
||||
not covered (internal, English-only).
|
||||
- **i18n** — `backendStatus` namespace added to `messages/en.json` and translated
|
||||
to all 32 other locales.
|
||||
|
||||
### Copy (en)
|
||||
|
||||
> **We're having trouble reaching our servers**
|
||||
> This is usually temporary — please try again in a couple of minutes.
|
||||
> Any karaoke videos currently being created are unaffected and will keep processing.
|
||||
|
||||
## Tests
|
||||
|
||||
- `__tests__/backend-status.test.ts` — store transitions + timer escalation.
|
||||
- `__tests__/api-fetch.test.ts` — GET retry→unavailable, transient-503 retry,
|
||||
transparent recovery, non-GET no-retry, GCS passthrough, caller-abort passthrough.
|
||||
- `lib/__tests__/api.test.ts` — updated `completeJobUpload` assertion (network
|
||||
failure now maps to `BackendUnavailableError` preserving `.cause`).
|
||||
- Banner verified visually (reconnecting + unavailable, en + es) via local dev.
|
||||
- Full suite: 1129 passing.
|
||||
@@ -1,180 +0,0 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*
|
||||
* Tests for apiFetch — the timeout + safe-retry wrapper that all backend calls go
|
||||
* through (lib/api.ts). In jsdom the hostname is "localhost", so API_BASE_URL is ""
|
||||
* and backend calls are addressed with relative "/api/..." URLs.
|
||||
*/
|
||||
|
||||
import { apiFetch, BackendUnavailableError } from '@/lib/api'
|
||||
import {
|
||||
getBackendStatus,
|
||||
reportBackendOnline,
|
||||
UNAVAILABLE_AFTER_MS,
|
||||
} from '@/lib/backend-status'
|
||||
|
||||
function mockResponse(status: number, body: unknown = {}): Response {
|
||||
return {
|
||||
ok: status >= 200 && status < 300,
|
||||
status,
|
||||
json: async () => body,
|
||||
} as unknown as Response
|
||||
}
|
||||
|
||||
describe('apiFetch', () => {
|
||||
const fetchMock = jest.fn()
|
||||
|
||||
beforeEach(() => {
|
||||
fetchMock.mockReset()
|
||||
;(globalThis as unknown as { fetch: unknown }).fetch = fetchMock
|
||||
reportBackendOnline()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
jest.useRealTimers()
|
||||
})
|
||||
|
||||
it('returns the response and marks the backend online on a successful GET', async () => {
|
||||
fetchMock.mockResolvedValue(mockResponse(200, { ok: true }))
|
||||
|
||||
const res = await apiFetch('/api/jobs/abc')
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1)
|
||||
expect(getBackendStatus()).toBe('online')
|
||||
})
|
||||
|
||||
it('does NOT retry a deterministic 404 and stays online (backend was reached)', async () => {
|
||||
fetchMock.mockResolvedValue(mockResponse(404))
|
||||
|
||||
const res = await apiFetch('/api/jobs/missing')
|
||||
|
||||
expect(res.status).toBe(404)
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1)
|
||||
expect(getBackendStatus()).toBe('online')
|
||||
})
|
||||
|
||||
it('retries a GET on repeated network failure, then throws BackendUnavailableError', async () => {
|
||||
jest.useFakeTimers()
|
||||
fetchMock.mockRejectedValue(new TypeError('Failed to fetch'))
|
||||
|
||||
const p = apiFetch('/api/jobs/abc')
|
||||
const assertion = expect(p).rejects.toBeInstanceOf(BackendUnavailableError)
|
||||
|
||||
// Drive the two backoff sleeps (600ms, then 1500ms) between the 3 attempts.
|
||||
await jest.advanceTimersByTimeAsync(600)
|
||||
await jest.advanceTimersByTimeAsync(1500)
|
||||
|
||||
await assertion
|
||||
expect(fetchMock).toHaveBeenCalledTimes(3)
|
||||
// A fast-failing retry budget (~2s) still only shows the subtle "reconnecting"
|
||||
// hint — the full banner is gated on the UNAVAILABLE_AFTER_MS (10s) clock.
|
||||
expect(getBackendStatus()).toBe('reconnecting')
|
||||
await jest.advanceTimersByTimeAsync(UNAVAILABLE_AFTER_MS)
|
||||
expect(getBackendStatus()).toBe('unavailable')
|
||||
})
|
||||
|
||||
it('retries a GET that keeps returning a transient 503, then throws', async () => {
|
||||
jest.useFakeTimers()
|
||||
fetchMock.mockResolvedValue(mockResponse(503))
|
||||
|
||||
const p = apiFetch('/api/jobs/abc')
|
||||
const assertion = expect(p).rejects.toBeInstanceOf(BackendUnavailableError)
|
||||
|
||||
await jest.advanceTimersByTimeAsync(600)
|
||||
await jest.advanceTimersByTimeAsync(1500)
|
||||
|
||||
await assertion
|
||||
expect(fetchMock).toHaveBeenCalledTimes(3)
|
||||
expect(getBackendStatus()).toBe('reconnecting')
|
||||
await jest.advanceTimersByTimeAsync(UNAVAILABLE_AFTER_MS)
|
||||
expect(getBackendStatus()).toBe('unavailable')
|
||||
})
|
||||
|
||||
it('reads method + signal from a Request input (a POST Request is not retried)', async () => {
|
||||
// jsdom has no global Request; provide a minimal stand-in with the fields
|
||||
// apiFetch reads (url/method/signal) so `input instanceof Request` engages.
|
||||
class FakeRequest {
|
||||
url: string
|
||||
method: string
|
||||
signal?: AbortSignal
|
||||
constructor(url: string, init?: { method?: string; signal?: AbortSignal }) {
|
||||
this.url = url
|
||||
this.method = init?.method ?? 'GET'
|
||||
this.signal = init?.signal
|
||||
}
|
||||
}
|
||||
;(globalThis as unknown as { Request: unknown }).Request = FakeRequest
|
||||
|
||||
try {
|
||||
fetchMock.mockRejectedValue(new TypeError('Failed to fetch'))
|
||||
|
||||
// A Request carrying method=POST must be treated as a non-idempotent mutation:
|
||||
// one attempt only, never replayed (which could double-submit).
|
||||
const req = new FakeRequest('http://localhost/api/jobs/create-from-url', {
|
||||
method: 'POST',
|
||||
})
|
||||
|
||||
await expect(apiFetch(req as unknown as Request)).rejects.toBeInstanceOf(
|
||||
BackendUnavailableError,
|
||||
)
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1)
|
||||
expect(getBackendStatus()).toBe('reconnecting')
|
||||
} finally {
|
||||
delete (globalThis as unknown as { Request?: unknown }).Request
|
||||
}
|
||||
})
|
||||
|
||||
it('recovers transparently when a retried GET succeeds on a later attempt', async () => {
|
||||
jest.useFakeTimers()
|
||||
fetchMock
|
||||
.mockRejectedValueOnce(new TypeError('Failed to fetch'))
|
||||
.mockResolvedValueOnce(mockResponse(200, { ok: true }))
|
||||
|
||||
const p = apiFetch('/api/jobs/abc')
|
||||
await jest.advanceTimersByTimeAsync(600)
|
||||
const res = await p
|
||||
|
||||
expect(res.status).toBe(200)
|
||||
expect(fetchMock).toHaveBeenCalledTimes(2)
|
||||
expect(getBackendStatus()).toBe('online')
|
||||
})
|
||||
|
||||
it('never auto-retries a non-GET (avoids duplicate submits) and does not hard-fail to "unavailable"', async () => {
|
||||
fetchMock.mockRejectedValue(new TypeError('Failed to fetch'))
|
||||
|
||||
await expect(
|
||||
apiFetch('/api/jobs/create-from-url', { method: 'POST', body: '{}' }),
|
||||
).rejects.toBeInstanceOf(BackendUnavailableError)
|
||||
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1)
|
||||
// A single mutation blip shows the subtle hint, not the full "unavailable" banner.
|
||||
expect(getBackendStatus()).toBe('reconnecting')
|
||||
})
|
||||
|
||||
it('passes non-backend URLs (e.g. GCS uploads) straight through with the original error', async () => {
|
||||
const gcsError = new TypeError('gcs unreachable')
|
||||
fetchMock.mockRejectedValue(gcsError)
|
||||
|
||||
await expect(
|
||||
apiFetch('https://storage.googleapis.com/bucket/obj', { method: 'PUT', body: 'x' }),
|
||||
).rejects.toBe(gcsError)
|
||||
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1)
|
||||
// Third-party hosts must not drive our backend-status banner.
|
||||
expect(getBackendStatus()).toBe('online')
|
||||
})
|
||||
|
||||
it('propagates a caller-initiated abort without reporting backend trouble', async () => {
|
||||
const abortErr = new DOMException('Aborted', 'AbortError')
|
||||
fetchMock.mockRejectedValue(abortErr)
|
||||
const controller = new AbortController()
|
||||
controller.abort()
|
||||
|
||||
await expect(
|
||||
apiFetch('/api/jobs/abc', { signal: controller.signal }),
|
||||
).rejects.toBe(abortErr)
|
||||
|
||||
expect(getBackendStatus()).toBe('online')
|
||||
})
|
||||
})
|
||||
@@ -1,78 +0,0 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*
|
||||
* Tests for the backend-connectivity status store (lib/backend-status.ts).
|
||||
*/
|
||||
|
||||
import {
|
||||
getBackendStatus,
|
||||
reportBackendOnline,
|
||||
reportBackendTrouble,
|
||||
reportBackendUnavailable,
|
||||
UNAVAILABLE_AFTER_MS,
|
||||
} from '@/lib/backend-status'
|
||||
|
||||
describe('backend-status store', () => {
|
||||
beforeEach(() => {
|
||||
// Reset the module singleton to a known-good baseline before each test.
|
||||
reportBackendOnline()
|
||||
jest.useFakeTimers()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllTimers()
|
||||
jest.useRealTimers()
|
||||
})
|
||||
|
||||
it('starts online', () => {
|
||||
expect(getBackendStatus()).toBe('online')
|
||||
})
|
||||
|
||||
it('moves to "reconnecting" on first trouble, then escalates to "unavailable" after the threshold', async () => {
|
||||
reportBackendTrouble()
|
||||
expect(getBackendStatus()).toBe('reconnecting')
|
||||
|
||||
// Just before the threshold it should still be reconnecting...
|
||||
await jest.advanceTimersByTimeAsync(UNAVAILABLE_AFTER_MS - 1)
|
||||
expect(getBackendStatus()).toBe('reconnecting')
|
||||
|
||||
// ...and cross it to become unavailable.
|
||||
await jest.advanceTimersByTimeAsync(2)
|
||||
expect(getBackendStatus()).toBe('unavailable')
|
||||
})
|
||||
|
||||
it('does not reset the escalation clock on repeated trouble reports', async () => {
|
||||
reportBackendTrouble()
|
||||
await jest.advanceTimersByTimeAsync(UNAVAILABLE_AFTER_MS - 2000)
|
||||
// A second failure partway through must NOT push the deadline out.
|
||||
reportBackendTrouble()
|
||||
expect(getBackendStatus()).toBe('reconnecting')
|
||||
await jest.advanceTimersByTimeAsync(2001)
|
||||
expect(getBackendStatus()).toBe('unavailable')
|
||||
})
|
||||
|
||||
it('reportBackendUnavailable escalates immediately without waiting', () => {
|
||||
reportBackendTrouble()
|
||||
reportBackendUnavailable()
|
||||
expect(getBackendStatus()).toBe('unavailable')
|
||||
})
|
||||
|
||||
it('reportBackendOnline clears trouble and cancels a pending escalation', async () => {
|
||||
reportBackendTrouble()
|
||||
expect(getBackendStatus()).toBe('reconnecting')
|
||||
|
||||
reportBackendOnline()
|
||||
expect(getBackendStatus()).toBe('online')
|
||||
|
||||
// The previously-armed escalation timer must have been cancelled.
|
||||
await jest.advanceTimersByTimeAsync(UNAVAILABLE_AFTER_MS + 1000)
|
||||
expect(getBackendStatus()).toBe('online')
|
||||
})
|
||||
|
||||
it('recovers to online from the unavailable state', () => {
|
||||
reportBackendUnavailable()
|
||||
expect(getBackendStatus()).toBe('unavailable')
|
||||
reportBackendOnline()
|
||||
expect(getBackendStatus()).toBe('online')
|
||||
})
|
||||
})
|
||||
@@ -1,93 +0,0 @@
|
||||
import { render, screen, waitFor } from '@testing-library/react'
|
||||
import { SystemStatusModal } from '@/components/system-status-modal'
|
||||
import type { SystemStatus } from '@/lib/api'
|
||||
|
||||
// Mock the API layer so the modal renders against controlled status payloads.
|
||||
const getSystemStatus = jest.fn()
|
||||
jest.mock('@/lib/api', () => ({
|
||||
api: {
|
||||
getSystemStatus: () => getSystemStatus(),
|
||||
},
|
||||
}))
|
||||
|
||||
function baseStatus(overrides: Partial<SystemStatus['services']> = {}): SystemStatus {
|
||||
return {
|
||||
services: {
|
||||
frontend: { status: 'ok', version: '0.196.3' },
|
||||
backend: { status: 'ok', version: '0.196.3' },
|
||||
encoder: { status: 'ok', version: '0.196.3' },
|
||||
flacfetch: { status: 'ok', version: '0.21.1' },
|
||||
separator: { status: 'offline' },
|
||||
...overrides,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
describe('SystemStatusModal', () => {
|
||||
beforeEach(() => {
|
||||
getSystemStatus.mockReset()
|
||||
})
|
||||
|
||||
it('shows the live encoding worker instance type on the primary (no fallback)', async () => {
|
||||
getSystemStatus.mockResolvedValue(
|
||||
baseStatus({
|
||||
encoder: {
|
||||
status: 'ok',
|
||||
version: '0.196.3',
|
||||
admin_details: {
|
||||
primary_vm: 'encoding-worker-a',
|
||||
active_vm: 'encoding-worker-a',
|
||||
active_zone: 'us-central1-c',
|
||||
active_machine_type: 'c4d-highcpu-32',
|
||||
on_fallback: false,
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
render(<SystemStatusModal open onClose={() => {}} />)
|
||||
|
||||
// Instance type + serving VM are surfaced for the live worker.
|
||||
expect(await screen.findByText('c4d-highcpu-32')).toBeInTheDocument()
|
||||
expect(screen.getByText(/encoding-worker-a · us-central1-c/)).toBeInTheDocument()
|
||||
// No fallback badge/notice when serving the primary.
|
||||
expect(screen.queryByText('Fallback')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('flags a capacity fallback with the fallback badge and notice', async () => {
|
||||
getSystemStatus.mockResolvedValue(
|
||||
baseStatus({
|
||||
encoder: {
|
||||
status: 'ok',
|
||||
version: '0.196.3',
|
||||
admin_details: {
|
||||
primary_vm: 'encoding-worker-a',
|
||||
active_vm: 'encoding-worker-fallback-n2c',
|
||||
active_zone: 'us-central1-a',
|
||||
active_machine_type: 'n2-highcpu-32',
|
||||
on_fallback: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
render(<SystemStatusModal open onClose={() => {}} />)
|
||||
|
||||
expect(await screen.findByText('n2-highcpu-32')).toBeInTheDocument()
|
||||
expect(screen.getByText('Fallback')).toBeInTheDocument()
|
||||
expect(
|
||||
screen.getByText(/Primary capacity unavailable/i),
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('omits the live-worker section for non-admins (no admin_details)', async () => {
|
||||
getSystemStatus.mockResolvedValue(baseStatus())
|
||||
|
||||
render(<SystemStatusModal open onClose={() => {}} />)
|
||||
|
||||
// Encoder card still renders, but there is no live-worker detail.
|
||||
await waitFor(() => expect(getSystemStatus).toHaveBeenCalled())
|
||||
expect(screen.queryByText('Live worker:')).not.toBeInTheDocument()
|
||||
expect(screen.queryByText('Fallback')).not.toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
@@ -131,25 +131,13 @@ describe('TenantJobFlow — error handling', () => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
// Mirrors handleSubmit's catch mapping in TenantJobFlow.tsx, using the en
|
||||
// jobFlow strings that t('submitError') / t('submitNetworkError') resolve to.
|
||||
const SUBMIT_ERROR = 'Something went wrong. Please try again.'
|
||||
const SUBMIT_NETWORK_ERROR = 'Network error — please check your connection and try again.'
|
||||
function mapSubmitError(err: any): string {
|
||||
const { ApiError } = require('@/lib/api')
|
||||
if (err instanceof ApiError) return err.message
|
||||
if (err instanceof TypeError || /network|failed to fetch|load failed/i.test(String(err?.message ?? ''))) {
|
||||
return SUBMIT_NETWORK_ERROR
|
||||
}
|
||||
return SUBMIT_ERROR
|
||||
}
|
||||
|
||||
it('ApiError message is surfaced when createJobWithUploadUrls fails', async () => {
|
||||
const { ApiError } = require('@/lib/api')
|
||||
mockApi.createJobWithUploadUrls.mockRejectedValue(
|
||||
new ApiError('Tenant file upload is not enabled', 403),
|
||||
)
|
||||
|
||||
// Simulate handleSubmit error path
|
||||
let errorMessage = ''
|
||||
try {
|
||||
await api.createJobWithUploadUrls('Artist', 'Title', [], {
|
||||
@@ -157,15 +145,16 @@ describe('TenantJobFlow — error handling', () => {
|
||||
existing_instrumental: true,
|
||||
})
|
||||
} catch (err: any) {
|
||||
errorMessage = mapSubmitError(err)
|
||||
errorMessage = err instanceof ApiError ? err.message : 'Something went wrong. Please try again.'
|
||||
}
|
||||
|
||||
expect(errorMessage).toBe('Tenant file upload is not enabled')
|
||||
})
|
||||
|
||||
it('network-level failures map to the network error message', async () => {
|
||||
mockApi.createJobWithUploadUrls.mockRejectedValue(new TypeError('Failed to fetch'))
|
||||
it('generic errors get fallback message', async () => {
|
||||
mockApi.createJobWithUploadUrls.mockRejectedValue(new TypeError('Network error'))
|
||||
|
||||
const { ApiError } = require('@/lib/api')
|
||||
let errorMessage = ''
|
||||
try {
|
||||
await api.createJobWithUploadUrls('Artist', 'Title', [], {
|
||||
@@ -173,26 +162,10 @@ describe('TenantJobFlow — error handling', () => {
|
||||
existing_instrumental: true,
|
||||
})
|
||||
} catch (err: any) {
|
||||
errorMessage = mapSubmitError(err)
|
||||
errorMessage = err instanceof ApiError ? err.message : 'Something went wrong. Please try again.'
|
||||
}
|
||||
|
||||
expect(errorMessage).toBe(SUBMIT_NETWORK_ERROR)
|
||||
})
|
||||
|
||||
it('non-network, non-ApiError failures get the generic fallback message', async () => {
|
||||
mockApi.createJobWithUploadUrls.mockRejectedValue(new Error('boom'))
|
||||
|
||||
let errorMessage = ''
|
||||
try {
|
||||
await api.createJobWithUploadUrls('Artist', 'Title', [], {
|
||||
is_private: true,
|
||||
existing_instrumental: true,
|
||||
})
|
||||
} catch (err: any) {
|
||||
errorMessage = mapSubmitError(err)
|
||||
}
|
||||
|
||||
expect(errorMessage).toBe(SUBMIT_ERROR)
|
||||
expect(errorMessage).toBe('Something went wrong. Please try again.')
|
||||
})
|
||||
|
||||
it('missing upload URL throws ApiError', async () => {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { hasLocale } from 'next-intl';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { routing } from '@/i18n/routing';
|
||||
import { ReferralCapture } from '@/components/ReferralCapture';
|
||||
import { BackendStatusBanner } from '@/components/backend-status-banner';
|
||||
|
||||
export function generateStaticParams() {
|
||||
return routing.locales.map((locale) => ({ locale }));
|
||||
@@ -38,7 +37,6 @@ export default async function LocaleLayout({
|
||||
<Suspense fallback={null}>
|
||||
<ReferralCapture />
|
||||
</Suspense>
|
||||
<BackendStatusBanner />
|
||||
{children}
|
||||
</NextIntlClientProvider>
|
||||
);
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
"use client"
|
||||
|
||||
import { useEffect, useState } from "react"
|
||||
import { useTranslations } from "next-intl"
|
||||
import { Loader2, CloudOff, X } from "lucide-react"
|
||||
import {
|
||||
useBackendStatus,
|
||||
__installBackendStatusDevHook,
|
||||
} from "@/lib/backend-status"
|
||||
|
||||
/**
|
||||
* App-wide, non-blocking banner that reacts to backend connectivity (see
|
||||
* lib/backend-status.ts). During a brief origin blip — e.g. Cloud Run recycling its
|
||||
* single min-instance — the API is momentarily unreachable even though nothing is
|
||||
* broken and any in-flight karaoke renders keep running. Rather than every screen
|
||||
* showing its own scary error, this shows a single reassuring message:
|
||||
*
|
||||
* - "reconnecting": a subtle pill with a spinner while we transparently retry.
|
||||
* - "unavailable": a gentle card explaining it's temporary and that ongoing jobs
|
||||
* are unaffected, once trouble persists past the threshold.
|
||||
*
|
||||
* It floats over content (no layout shift) and disappears the instant connectivity
|
||||
* is restored.
|
||||
*/
|
||||
export function BackendStatusBanner() {
|
||||
const status = useBackendStatus()
|
||||
const t = useTranslations("backendStatus")
|
||||
const [dismissed, setDismissed] = useState(false)
|
||||
|
||||
// Expose the dev/preview trigger (window.__nkBackendStatus) for manual UX review.
|
||||
useEffect(() => {
|
||||
__installBackendStatusDevHook()
|
||||
}, [])
|
||||
|
||||
// Re-arm the dismiss so a *later* outage episode shows again.
|
||||
useEffect(() => {
|
||||
if (status === "online") setDismissed(false)
|
||||
}, [status])
|
||||
|
||||
if (status === "online") return null
|
||||
|
||||
if (status === "reconnecting") {
|
||||
return (
|
||||
<div
|
||||
className="fixed top-3 left-1/2 z-[60] -translate-x-1/2 pointer-events-none"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
>
|
||||
<div className="flex items-center gap-2 rounded-full border border-amber-500/30 bg-amber-950/80 px-3.5 py-1.5 text-xs text-amber-200 shadow-lg backdrop-blur">
|
||||
<Loader2 className="h-3.5 w-3.5 shrink-0 animate-spin" />
|
||||
<span>{t("reconnecting")}</span>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// status === "unavailable"
|
||||
if (dismissed) return null
|
||||
|
||||
return (
|
||||
<div
|
||||
className="fixed top-3 left-1/2 z-[60] w-[calc(100%-1.5rem)] max-w-md -translate-x-1/2"
|
||||
role="alert"
|
||||
aria-live="assertive"
|
||||
>
|
||||
<div className="relative rounded-xl border border-amber-500/40 bg-amber-950/90 px-4 py-3 pr-9 text-amber-100 shadow-2xl backdrop-blur">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setDismissed(true)}
|
||||
aria-label={t("dismiss")}
|
||||
className="absolute right-2 top-2 rounded-md p-1 text-amber-300/70 transition-colors hover:bg-amber-800/50 hover:text-amber-100"
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</button>
|
||||
<div className="flex items-start gap-3">
|
||||
<CloudOff className="mt-0.5 h-5 w-5 shrink-0 text-amber-300" />
|
||||
<div className="space-y-1">
|
||||
<p className="text-sm font-semibold text-amber-50">{t("unavailable.title")}</p>
|
||||
<p className="text-xs leading-relaxed text-amber-200/90">{t("unavailable.body")}</p>
|
||||
<p className="text-xs leading-relaxed text-amber-200/70">
|
||||
{t("unavailable.reassurance")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -119,21 +119,9 @@ export function TenantJobFlow({ onJobCreated }: TenantJobFlowProps) {
|
||||
setPhase("done")
|
||||
onJobCreated()
|
||||
} catch (err: any) {
|
||||
// Surface the real cause for debugging — the generic user-facing string
|
||||
// below hides which step failed (create / upload / complete).
|
||||
console.error("[TenantJobFlow] submit failed:", err)
|
||||
let message: string
|
||||
if (err instanceof ApiError) {
|
||||
message = err.message
|
||||
} else if (
|
||||
err instanceof TypeError ||
|
||||
/network|failed to fetch|load failed/i.test(String(err?.message ?? ""))
|
||||
) {
|
||||
// fetch()/XHR network-level failure (offline, connection reset, CORS).
|
||||
message = t('submitNetworkError')
|
||||
} else {
|
||||
message = t('submitError')
|
||||
}
|
||||
const message = err instanceof ApiError
|
||||
? err.message
|
||||
: "Something went wrong. Please try again."
|
||||
setError(message)
|
||||
setPhase("idle")
|
||||
setUploadProgress(0)
|
||||
|
||||
@@ -59,7 +59,7 @@ function ServiceCard({
|
||||
className="rounded-lg border p-4"
|
||||
style={{
|
||||
borderColor: "var(--card-border)",
|
||||
backgroundColor: "var(--card)",
|
||||
backgroundColor: "var(--card-bg)",
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center justify-between mb-1">
|
||||
@@ -106,38 +106,6 @@ function ServiceCard({
|
||||
);
|
||||
}
|
||||
|
||||
function LiveWorkerSection({ details }: { details: NonNullable<ServiceStatus["admin_details"]> }) {
|
||||
const t = useTranslations('status');
|
||||
|
||||
return (
|
||||
<div className="mt-2 text-xs">
|
||||
<div className="flex items-center gap-1.5 flex-wrap">
|
||||
<span className="opacity-60">{t('liveWorker')}:</span>
|
||||
<span className="font-mono font-medium">{details.active_machine_type}</span>
|
||||
{details.on_fallback && (
|
||||
<span
|
||||
className="rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-400"
|
||||
style={{ backgroundColor: "rgba(251,191,36,0.12)" }}
|
||||
>
|
||||
{t('fallbackBadge')}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{details.active_vm && (
|
||||
<div className="mt-0.5 font-mono opacity-50">
|
||||
{details.active_vm}
|
||||
{details.active_zone ? ` · ${details.active_zone}` : ""}
|
||||
</div>
|
||||
)}
|
||||
{details.on_fallback && (
|
||||
<div className="mt-1 opacity-50 text-[10px] leading-snug">
|
||||
{t('fallbackNote')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function BlueGreenSection({ details }: { details: NonNullable<ServiceStatus["admin_details"]> }) {
|
||||
const t = useTranslations('status');
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
@@ -248,7 +216,7 @@ export function SystemStatusModal({ open, onClose }: SystemStatusModalProps) {
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && onClose()}>
|
||||
<DialogContent className="sm:max-w-lg" style={{ backgroundColor: "var(--bg)", borderColor: "var(--card-border)" }}>
|
||||
<DialogContent className="sm:max-w-lg" style={{ backgroundColor: "var(--card-bg)", borderColor: "var(--card-border)" }}>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="text-foreground">{t('systemStatus')}</DialogTitle>
|
||||
</DialogHeader>
|
||||
@@ -266,12 +234,10 @@ export function SystemStatusModal({ open, onClose }: SystemStatusModalProps) {
|
||||
<ServiceCard name={t('frontend')} service={frontendService} />
|
||||
<ServiceCard name={t('backend')} service={services.backend} />
|
||||
<ServiceCard name={t('encoder')} service={services.encoder}>
|
||||
{services.encoder.admin_details?.active_machine_type && (
|
||||
<LiveWorkerSection details={services.encoder.admin_details} />
|
||||
)}
|
||||
{services.encoder.admin_details?.primary_vm && (
|
||||
<BlueGreenSection details={services.encoder.admin_details} />
|
||||
)}
|
||||
{services.encoder.admin_details &&
|
||||
services.encoder.admin_details.primary_vm && (
|
||||
<BlueGreenSection details={services.encoder.admin_details} />
|
||||
)}
|
||||
</ServiceCard>
|
||||
<ServiceCard name={t('flacfetch')} service={services.flacfetch} />
|
||||
<ServiceCard name={t('separator')} service={services.separator} />
|
||||
|
||||
@@ -1,28 +1,15 @@
|
||||
// frontend/e2e/helpers/stripe-checkout.ts
|
||||
import { Page, Frame, Locator } from '@playwright/test';
|
||||
import { Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Automate Stripe's hosted checkout page (checkout.stripe.com).
|
||||
*
|
||||
* ⚠️ Stripe changes this page's structure without notice — likely A/B testing
|
||||
* or staged rollouts, so BOTH the old and new layouts can appear on any given
|
||||
* day (and can flip back). We have observed at least three variants:
|
||||
* 1. Multi-method accordion of *radios* (Card / Cash App / Klarna / Bank),
|
||||
* card fields inside iframes, Pay button in the top frame. (Apr 2026)
|
||||
* 2. Single method (Card only): card fields render as *direct* textboxes in
|
||||
* the top document, no chooser at all. (#916, Aug 17)
|
||||
* 3. Multi-method Payment Element where the chooser is *buttons* (not radios)
|
||||
* and the whole element — chooser, card fields AND the "Pay" button — is
|
||||
* rendered inside a nested same-origin iframe. (Aug 19-20)
|
||||
*
|
||||
* DO NOT narrow this helper to a single layout — it must tolerate all of the
|
||||
* above. It does so by being layout-agnostic:
|
||||
* - `page.getByRole(...)` only sees the top frame, so we search EVERY frame
|
||||
* (top + nested iframes) for each element via `locateVisibleInFrames`.
|
||||
* - The "Card" chooser is matched as a radio OR a button.
|
||||
* - Card fields are matched whether direct inputs or iframe-nested.
|
||||
* If Stripe introduces yet another layout, extend the locators here rather than
|
||||
* assuming a single shape.
|
||||
* Stripe Checkout (as of April 2026) shows:
|
||||
* - "Pay with Link" / "Pay with Klarna" buttons at top
|
||||
* - Payment method radio buttons: Card, Cash App Pay, Klarna, Bank
|
||||
* - Clicking "Card" reveals card input fields (number, expiry, CVC)
|
||||
* - Card fields are inside iframes within the page
|
||||
* - A "Pay" button at the bottom
|
||||
*
|
||||
* Environment variables:
|
||||
* E2E_STRIPE_CARD_NUMBER, E2E_STRIPE_CARD_EXPIRY,
|
||||
@@ -51,32 +38,6 @@ function getCardDetailsFromEnv(): CardDetails {
|
||||
return { number, expiry, cvc, name };
|
||||
}
|
||||
|
||||
/**
|
||||
* Poll every frame (top document + nested iframes) for the first locator that
|
||||
* is visible, returning it (or null on timeout). Playwright's Page-level
|
||||
* locators only see the top frame; Stripe's Payment Element lives in a nested
|
||||
* iframe, so we must look frame-by-frame.
|
||||
*/
|
||||
async function locateVisibleInFrames(
|
||||
page: Page,
|
||||
make: (frame: Frame) => Locator,
|
||||
timeout = 30_000
|
||||
): Promise<Locator | null> {
|
||||
const deadline = Date.now() + timeout;
|
||||
do {
|
||||
for (const frame of page.frames()) {
|
||||
if (frame.isDetached()) continue;
|
||||
const loc = make(frame).first();
|
||||
// isVisible() rejects if the frame detaches mid-check — treat as "not here".
|
||||
if (await loc.isVisible({ timeout: 1_000 }).catch(() => false)) {
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
await page.waitForTimeout(300);
|
||||
} while (Date.now() < deadline);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete the Stripe Checkout page with card details from environment.
|
||||
*
|
||||
@@ -89,128 +50,75 @@ export async function completeStripeCheckout(page: Page): Promise<void> {
|
||||
// Step 1: Wait for Stripe Checkout page to fully load
|
||||
console.log(' Waiting for Stripe Checkout page...');
|
||||
await page.waitForURL(/checkout\.stripe\.com/, { timeout: 30_000 });
|
||||
|
||||
// The "Pay" button is one of the last elements to render and confirms the
|
||||
// Payment Element is interactive. It may be in the top frame (single-method
|
||||
// layout) or a nested iframe (multi-method layout). Match it exactly so the
|
||||
// "Pay with Link" / "Pay with Klarna" express buttons don't shadow it.
|
||||
const payButton = await locateVisibleInFrames(
|
||||
page,
|
||||
(f) => f.getByRole('button', { name: /^Pay$/i }),
|
||||
30_000
|
||||
);
|
||||
if (!payButton) {
|
||||
await page.screenshot({ path: 'test-results/stripe-no-pay-button.png' });
|
||||
throw new Error('Stripe "Pay" button not visible in any frame after 30s');
|
||||
}
|
||||
// Wait for the page to be fully interactive — look for the "Pay" button
|
||||
// which is one of the last elements to render
|
||||
await page.getByRole('button', { name: /^Pay$/i }).waitFor({
|
||||
state: 'visible',
|
||||
timeout: 30_000,
|
||||
});
|
||||
await page.screenshot({ path: 'test-results/stripe-checkout-loaded.png' });
|
||||
console.log(' Stripe Checkout loaded');
|
||||
|
||||
// Step 2: Ensure the card fields are shown. In the single-method layout they
|
||||
// are already visible; in the multi-method accordion we must expand "Card"
|
||||
// (rendered as a button or radio depending on Stripe's variant).
|
||||
// Step 2: Select "Card" payment method
|
||||
// Stripe uses an accordion with radio buttons overlaid by buttons.
|
||||
// Use force:true to bypass the overlay interception.
|
||||
console.log(' Selecting Card payment method...');
|
||||
let cardNumberField = await locateVisibleInFrames(
|
||||
page,
|
||||
(f) => cardFieldLocator(f, 'cardNumber'),
|
||||
5_000
|
||||
);
|
||||
const cardRadio = page.getByRole('radio', { name: 'Card' });
|
||||
await cardRadio.check({ force: true, timeout: 10_000 });
|
||||
console.log(' Card payment method selected');
|
||||
|
||||
if (cardNumberField) {
|
||||
console.log(' Card fields already visible — no chooser to expand');
|
||||
} else {
|
||||
const cardChoice = await locateVisibleInFrames(
|
||||
page,
|
||||
(f) =>
|
||||
f
|
||||
.getByRole('radio', { name: /^Card$/i })
|
||||
.or(f.getByRole('button', { name: /^Card$/i })),
|
||||
5_000
|
||||
);
|
||||
if (cardChoice) {
|
||||
// force:true bypasses any overlay/accordion animation intercepting clicks.
|
||||
await cardChoice.click({ force: true }).catch(() => {});
|
||||
console.log(' Card payment method selected');
|
||||
} else {
|
||||
console.log(' No Card chooser found — waiting for card fields to render...');
|
||||
}
|
||||
cardNumberField = await locateVisibleInFrames(
|
||||
page,
|
||||
(f) => cardFieldLocator(f, 'cardNumber'),
|
||||
15_000
|
||||
);
|
||||
if (!cardNumberField) {
|
||||
console.log(' WARNING: card number field not visible after selecting Card');
|
||||
}
|
||||
}
|
||||
|
||||
await page.waitForTimeout(1000);
|
||||
// Wait for card input fields to appear after selecting Card
|
||||
// Stripe renders card fields inside iframes after the radio is clicked
|
||||
await page.waitForTimeout(2000);
|
||||
await page.screenshot({ path: 'test-results/stripe-card-selected.png' });
|
||||
|
||||
// Step 3-5: Fill card number, expiry, CVC
|
||||
// Step 3: Fill card number
|
||||
// After clicking "Card", Stripe shows card input fields.
|
||||
// These may be direct inputs (#cardNumber) or inside iframes.
|
||||
console.log(' Filling card number...');
|
||||
await fillCardField(page, 'cardNumber', card.number);
|
||||
|
||||
// Step 4: Fill expiry
|
||||
console.log(' Filling card expiry...');
|
||||
await fillCardField(page, 'cardExpiry', card.expiry);
|
||||
|
||||
// Step 5: Fill CVC
|
||||
console.log(' Filling CVC...');
|
||||
await fillCardField(page, 'cardCvc', card.cvc);
|
||||
|
||||
// Step 6: Fill cardholder name if the field exists (any frame)
|
||||
// Step 6: Fill cardholder name if field exists
|
||||
if (card.name) {
|
||||
const nameInput = await locateVisibleInFrames(
|
||||
page,
|
||||
(f) =>
|
||||
f
|
||||
.locator('#billingName, input[name="billingName"], input[placeholder="Full name on card"]')
|
||||
.or(f.getByRole('textbox', { name: /cardholder name/i })),
|
||||
2_000
|
||||
);
|
||||
if (nameInput) {
|
||||
const nameInput = page.locator('#billingName, input[name="billingName"]');
|
||||
if (await nameInput.isVisible({ timeout: 2000 }).catch(() => false)) {
|
||||
console.log(' Filling cardholder name...');
|
||||
await nameInput.fill(card.name);
|
||||
}
|
||||
}
|
||||
|
||||
// Step 6b: Fill ZIP code (required for US cards) — search any frame
|
||||
const zipInput = await locateVisibleInFrames(
|
||||
page,
|
||||
(f) =>
|
||||
f
|
||||
.locator('#billingPostalCode, input[name="billingPostalCode"], input[placeholder="ZIP"]')
|
||||
.or(f.getByRole('textbox', { name: /^zip$|postal code/i })),
|
||||
2_000
|
||||
);
|
||||
if (zipInput) {
|
||||
// Step 6b: Fill ZIP code (required for US cards)
|
||||
const zipInput = page.locator('#billingPostalCode, input[name="billingPostalCode"], input[placeholder="ZIP"]');
|
||||
if (await zipInput.isVisible({ timeout: 2000 }).catch(() => false)) {
|
||||
console.log(' Filling ZIP code...');
|
||||
await zipInput.fill(process.env.E2E_STRIPE_ZIP || '10001');
|
||||
}
|
||||
|
||||
// Step 6c: Uncheck "Save my information" to avoid a phone-number requirement
|
||||
const saveCheckbox = await locateVisibleInFrames(
|
||||
page,
|
||||
(f) => f.getByRole('checkbox', { name: /save my information/i }),
|
||||
2_000
|
||||
);
|
||||
if (saveCheckbox && (await saveCheckbox.isChecked().catch(() => false))) {
|
||||
console.log(' Unchecking "Save my information"...');
|
||||
await saveCheckbox.uncheck({ force: true }).catch(() => {});
|
||||
// Step 6c: Uncheck "Save my information" to avoid phone number requirement
|
||||
const saveCheckbox = page.getByRole('checkbox', { name: /save my information/i });
|
||||
if (await saveCheckbox.isVisible({ timeout: 2000 }).catch(() => false)) {
|
||||
if (await saveCheckbox.isChecked()) {
|
||||
console.log(' Unchecking "Save my information"...');
|
||||
await saveCheckbox.uncheck({ force: true });
|
||||
}
|
||||
}
|
||||
|
||||
await page.screenshot({ path: 'test-results/stripe-checkout-filled.png' });
|
||||
console.log(' Card details filled');
|
||||
|
||||
// Step 7: Click "Pay" button (re-locate in case the frame re-rendered)
|
||||
// Step 7: Click "Pay" button
|
||||
console.log(' Clicking Pay button...');
|
||||
const finalPay = await locateVisibleInFrames(
|
||||
page,
|
||||
(f) => f.getByRole('button', { name: /^Pay$/i }),
|
||||
10_000
|
||||
);
|
||||
if (!finalPay) {
|
||||
await page.screenshot({ path: 'test-results/stripe-no-pay-button-final.png' });
|
||||
throw new Error('Stripe "Pay" button not visible when ready to submit');
|
||||
}
|
||||
await finalPay.click();
|
||||
const payButton = page.getByRole('button', { name: /^Pay$/i });
|
||||
await payButton.waitFor({ state: 'visible', timeout: 10_000 });
|
||||
await payButton.click();
|
||||
|
||||
console.log(' Payment submitted, waiting for redirect...');
|
||||
// Wait for redirect back to our site
|
||||
@@ -222,44 +130,42 @@ export async function completeStripeCheckout(page: Page): Promise<void> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessible-name and placeholder metadata for each Stripe card field, used to
|
||||
* build robust locators that work whether Stripe renders the field as a direct
|
||||
* input (single-payment-method layout) or inside an iframe.
|
||||
*/
|
||||
const CARD_FIELD_META: Record<string, { name: RegExp; placeholder?: string }> = {
|
||||
cardNumber: { name: /card number/i, placeholder: '1234 1234 1234 1234' },
|
||||
cardExpiry: { name: /expiration|expiry/i, placeholder: 'MM / YY' },
|
||||
cardCvc: { name: /^cvc$|security code/i },
|
||||
};
|
||||
|
||||
/**
|
||||
* Locator for a Stripe card field within a given frame. Matches by Stripe's
|
||||
* stable field-name attribute, element id, input name, placeholder, or
|
||||
* accessible name — whichever the current Checkout layout uses.
|
||||
*/
|
||||
function cardFieldLocator(frame: Frame, fieldName: string): Locator {
|
||||
const meta = CARD_FIELD_META[fieldName];
|
||||
const selectors = [
|
||||
`[data-elements-stable-field-name="${fieldName}"]`,
|
||||
`#${fieldName}`,
|
||||
`input[name="${fieldName}"]`,
|
||||
];
|
||||
if (meta?.placeholder) selectors.push(`input[placeholder="${meta.placeholder}"]`);
|
||||
let loc = frame.locator(selectors.join(', '));
|
||||
if (meta) loc = loc.or(frame.getByRole('textbox', { name: meta.name }));
|
||||
return loc.first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill a card field by name, searching every frame (top document + nested
|
||||
* iframes). Stripe renders card fields either as direct inputs (single-payment-
|
||||
* method layout) or inside the Payment Element iframe (multi-method layout).
|
||||
* Fill a card field by name. Tries direct input first, then iframe-based.
|
||||
*
|
||||
* Stripe Checkout card fields use IDs like #cardNumber, #cardExpiry, #cardCvc
|
||||
* when rendered as direct inputs, or are inside iframes when using Elements.
|
||||
*/
|
||||
async function fillCardField(page: Page, fieldName: string, value: string): Promise<void> {
|
||||
const input = await locateVisibleInFrames(page, (f) => cardFieldLocator(f, fieldName), 15_000);
|
||||
if (!input) {
|
||||
throw new Error(`Could not find card field: ${fieldName} in any frame`);
|
||||
// Try 1: Direct input by ID
|
||||
const directInput = page.locator(`#${fieldName}`);
|
||||
if (await directInput.isVisible({ timeout: 3000 }).catch(() => false)) {
|
||||
await directInput.click();
|
||||
await directInput.type(value, { delay: 50 });
|
||||
return;
|
||||
}
|
||||
await input.click();
|
||||
await input.type(value, { delay: 50 });
|
||||
|
||||
// Try 2: Direct input by data attribute
|
||||
const dataInput = page.locator(`[data-elements-stable-field-name="${fieldName}"]`);
|
||||
if (await dataInput.isVisible({ timeout: 2000 }).catch(() => false)) {
|
||||
await dataInput.click();
|
||||
await dataInput.type(value, { delay: 50 });
|
||||
return;
|
||||
}
|
||||
|
||||
// Try 3: Input inside an iframe (Stripe Elements)
|
||||
// Find all iframes and try each one for the card input
|
||||
const iframes = page.locator('iframe');
|
||||
const iframeCount = await iframes.count();
|
||||
for (let i = 0; i < iframeCount; i++) {
|
||||
const frame = iframes.nth(i).contentFrame();
|
||||
// Look for inputs inside this iframe
|
||||
const input = frame.locator(`input[name="${fieldName}"], input[autocomplete*="cc"]`).first();
|
||||
if (await input.isVisible({ timeout: 1000 }).catch(() => false)) {
|
||||
await input.type(value, { delay: 50 });
|
||||
console.log(` Found ${fieldName} in iframe ${i}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`Could not find card field: ${fieldName} (tried direct input, data attribute, and ${iframeCount} iframes)`);
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* Tests for API client
|
||||
*/
|
||||
|
||||
import { api, ApiError, BackendUnavailableError, extractErrorMessage } from "../api"
|
||||
import { api, ApiError, extractErrorMessage } from "../api"
|
||||
|
||||
// Mock fetch globally
|
||||
global.fetch = jest.fn()
|
||||
@@ -293,48 +293,6 @@ describe("API Client", () => {
|
||||
const body = JSON.parse(call[1].body)
|
||||
expect(body.uploaded_files).toEqual(["audio"])
|
||||
})
|
||||
|
||||
it("retries on a transient network failure and then succeeds", async () => {
|
||||
const mockResponse = { status: "success", message: "Processing started" }
|
||||
|
||||
;(global.fetch as jest.Mock)
|
||||
.mockRejectedValueOnce(new TypeError("Failed to fetch"))
|
||||
.mockResolvedValueOnce({ ok: true, json: async () => mockResponse })
|
||||
|
||||
const result = await api.completeJobUpload("job-789", ["audio"])
|
||||
|
||||
expect(result).toEqual(mockResponse)
|
||||
expect(global.fetch).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
it("gives up after 3 network failures with BackendUnavailableError (preserving the cause)", async () => {
|
||||
const networkError = new TypeError("Failed to fetch")
|
||||
;(global.fetch as jest.Mock).mockRejectedValue(networkError)
|
||||
|
||||
// apiFetch maps a network-level failure to a typed BackendUnavailableError
|
||||
// (which drives the app-wide connectivity banner) while keeping the original
|
||||
// error as `.cause`, so nothing is silently swallowed.
|
||||
const err = await api
|
||||
.completeJobUpload("job-789", ["audio"])
|
||||
.catch((e) => e)
|
||||
expect(err).toBeInstanceOf(BackendUnavailableError)
|
||||
expect(err.cause).toBe(networkError)
|
||||
expect(global.fetch).toHaveBeenCalledTimes(3)
|
||||
})
|
||||
|
||||
it("does NOT retry on an HTTP error response (deterministic)", async () => {
|
||||
;(global.fetch as jest.Mock).mockResolvedValueOnce({
|
||||
ok: false,
|
||||
status: 400,
|
||||
json: async () => ({ detail: "Job is not in pending state" }),
|
||||
})
|
||||
|
||||
await expect(api.completeJobUpload("job-789", ["audio"])).rejects.toBeInstanceOf(
|
||||
ApiError
|
||||
)
|
||||
// A 4xx is not a transient failure — it must not be retried.
|
||||
expect(global.fetch).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe("uploadJobSmart", () => {
|
||||
|
||||
+172
-380
File diff suppressed because it is too large.
Load diff
@@ -9,7 +9,6 @@
|
||||
* flows through the existing corrections/complete paths.
|
||||
*/
|
||||
import type { LyricsSegment, ReferenceSource } from '@/lib/lyrics-review/types'
|
||||
import { apiFetch } from '@/lib/api'
|
||||
|
||||
const API_BASE =
|
||||
process.env.NEXT_PUBLIC_API_BASE ?? 'https://api.nomadkaraoke.com'
|
||||
@@ -101,7 +100,7 @@ export async function fetchAutoCorrectSuggestions(
|
||||
}
|
||||
if (token) headers.Authorization = `Bearer ${token}`
|
||||
|
||||
const response = await apiFetch(
|
||||
const response = await fetch(
|
||||
`${API_BASE}/api/review/${encodeURIComponent(jobId)}/auto-correct`,
|
||||
{
|
||||
method: 'POST',
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
* preview. Persistence still flows through the existing replace-segments
|
||||
* Save path.
|
||||
*/
|
||||
import { apiFetch } from '@/lib/api'
|
||||
|
||||
const API_BASE =
|
||||
process.env.NEXT_PUBLIC_API_BASE ?? 'https://api.nomadkaraoke.com'
|
||||
|
||||
@@ -97,7 +95,7 @@ export async function generateCustomLyrics(
|
||||
const headers: Record<string, string> = {}
|
||||
if (token) headers.Authorization = `Bearer ${token}`
|
||||
|
||||
const response = await apiFetch(
|
||||
const response = await fetch(
|
||||
`${API_BASE}/api/review/${encodeURIComponent(jobId)}/custom-lyrics/generate`,
|
||||
{ method: 'POST', body: form, headers, signal },
|
||||
)
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
'use client'
|
||||
|
||||
/**
|
||||
* Global backend-connectivity status.
|
||||
*
|
||||
* The backend runs on Cloud Run with `--min-instances 1`. When Cloud Run recycles
|
||||
* that single instance (routine host maintenance / instance max-lifetime), there is
|
||||
* a brief (~1-2 min worst case, usually well under) window where the origin is
|
||||
* unreachable and API calls fail even though nothing is actually broken — and any
|
||||
* karaoke jobs already rendering (Cloud Run Jobs / GCE encoding VMs) keep running
|
||||
* untouched. See infrastructure/modules/monitoring.py for the server-side story.
|
||||
*
|
||||
* `apiFetch` (lib/api.ts) reports request outcomes here so a single app-wide banner
|
||||
* can reassure the user during those blips instead of every screen showing its own
|
||||
* scary generic error. This is a tiny framework-agnostic store (module singleton +
|
||||
* listeners) consumed via the `useBackendStatus` hook.
|
||||
*/
|
||||
|
||||
import { useSyncExternalStore } from 'react'
|
||||
|
||||
export type BackendStatus =
|
||||
/** Requests are succeeding (or we have no evidence of trouble). */
|
||||
| 'online'
|
||||
/** A request just failed and we're transparently retrying — show a subtle hint. */
|
||||
| 'reconnecting'
|
||||
/** Trouble has persisted past the threshold — show the gentle full message. */
|
||||
| 'unavailable'
|
||||
|
||||
/**
|
||||
* How long connectivity trouble must persist before we escalate from the subtle
|
||||
* "reconnecting" hint to the full "temporarily unavailable" message. Kept in sync
|
||||
* with the read-retry budget in lib/api.ts so a request that exhausts its retries
|
||||
* lands right around the same time this escalates.
|
||||
*/
|
||||
export const UNAVAILABLE_AFTER_MS = 10_000
|
||||
|
||||
let status: BackendStatus = 'online'
|
||||
let firstTroubleAt: number | null = null
|
||||
let escalationTimer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
const listeners = new Set<() => void>()
|
||||
|
||||
function emit() {
|
||||
listeners.forEach((l) => l())
|
||||
}
|
||||
|
||||
function setStatus(next: BackendStatus) {
|
||||
if (status === next) return
|
||||
status = next
|
||||
emit()
|
||||
}
|
||||
|
||||
function clearEscalationTimer() {
|
||||
if (escalationTimer) {
|
||||
clearTimeout(escalationTimer)
|
||||
escalationTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Report that a backend request attempt failed and we're about to retry (or it
|
||||
* ultimately failed but might just be a transient blip). Moves us to "reconnecting"
|
||||
* immediately and arms a timer that escalates to "unavailable" if trouble persists.
|
||||
*/
|
||||
export function reportBackendTrouble() {
|
||||
if (firstTroubleAt === null) {
|
||||
firstTroubleAt = Date.now()
|
||||
}
|
||||
if (status === 'online') {
|
||||
setStatus('reconnecting')
|
||||
}
|
||||
if (status !== 'unavailable' && escalationTimer === null) {
|
||||
const elapsed = Date.now() - (firstTroubleAt ?? Date.now())
|
||||
const remaining = Math.max(0, UNAVAILABLE_AFTER_MS - elapsed)
|
||||
escalationTimer = setTimeout(() => {
|
||||
escalationTimer = null
|
||||
// Still no success by now → this is more than a momentary blip.
|
||||
if (firstTroubleAt !== null) setStatus('unavailable')
|
||||
}, remaining)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Report that trouble is confirmed sustained (e.g. a read exhausted its full retry
|
||||
* budget). Escalates to "unavailable" right away without waiting on the timer.
|
||||
*/
|
||||
export function reportBackendUnavailable() {
|
||||
if (firstTroubleAt === null) firstTroubleAt = Date.now()
|
||||
clearEscalationTimer()
|
||||
setStatus('unavailable')
|
||||
}
|
||||
|
||||
/**
|
||||
* Report a successful backend request. Clears any trouble state and returns us to
|
||||
* "online" — the banner disappears the moment connectivity is restored.
|
||||
*/
|
||||
export function reportBackendOnline() {
|
||||
firstTroubleAt = null
|
||||
clearEscalationTimer()
|
||||
setStatus('online')
|
||||
}
|
||||
|
||||
export function getBackendStatus(): BackendStatus {
|
||||
return status
|
||||
}
|
||||
|
||||
function subscribe(listener: () => void): () => void {
|
||||
listeners.add(listener)
|
||||
return () => {
|
||||
listeners.delete(listener)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* React hook: subscribe to the current backend connectivity status. Server render
|
||||
* always yields "online" so the banner never appears in the static HTML.
|
||||
*/
|
||||
export function useBackendStatus(): BackendStatus {
|
||||
return useSyncExternalStore(subscribe, getBackendStatus, () => 'online')
|
||||
}
|
||||
|
||||
/**
|
||||
* Dev/preview-only escape hatch so the outage UX can be demoed without actually
|
||||
* taking the backend down. Exposed on `window.__nkBackendStatus` and no-ops on the
|
||||
* production consumer build. Not referenced by app code paths.
|
||||
*/
|
||||
export function __installBackendStatusDevHook() {
|
||||
if (typeof window === 'undefined') return
|
||||
const host = window.location.hostname
|
||||
const isProd = host === 'gen.nomadkaraoke.com'
|
||||
if (isProd) return
|
||||
;(window as unknown as { __nkBackendStatus?: unknown }).__nkBackendStatus = {
|
||||
reconnecting: () => reportBackendTrouble(),
|
||||
unavailable: () => reportBackendUnavailable(),
|
||||
online: () => reportBackendOnline(),
|
||||
get: () => getBackendStatus(),
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "الخلفية",
|
||||
"encoder": "المشفر",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "الفاصل",
|
||||
"fallbackBadge": "احتياطي",
|
||||
"fallbackNote": "السعة الأساسية غير متوفرة — تم التوجيه إلى خادم احتياطي.",
|
||||
"liveWorker": "عامل نشط"
|
||||
"separator": "الفاصل"
|
||||
},
|
||||
"credits": {
|
||||
"title": "شراء المزيد من الأرصدة",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "استخدام التصحيح",
|
||||
"matchUseTidied": "استخدام النسخة المنقحة",
|
||||
"matchUsingTyped": "استخدام ما كتبته: {value}",
|
||||
"checkingUrl": "جاري التحقق...",
|
||||
"submitNetworkError": "خطأ في الشبكة — يرجى التحقق من اتصالك والمحاولة مرة أخرى.",
|
||||
"submitError": "حدث خطأ ما. يرجى المحاولة مرة أخرى."
|
||||
"checkingUrl": "جاري التحقق..."
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "جاري الإعداد",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} إضافي",
|
||||
"variantOriginal": "أصلي",
|
||||
"variantReissue": "إعادة إصدار"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "جارٍ إعادة الاتصال…",
|
||||
"unavailable": {
|
||||
"body": "هذا عادةً ما يكون مؤقتاً — يرجى المحاولة مرة أخرى بعد بضع دقائق.",
|
||||
"reassurance": "أي مقاطع فيديو كاريوكي يتم إنشاؤها حالياً لن تتأثر وستستمر قيد المعالجة.",
|
||||
"title": "نواجه مشكلة في الوصول إلى خوادمنا"
|
||||
},
|
||||
"dismiss": "تجاهل"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Codificador",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separador",
|
||||
"fallbackBadge": "De reserva",
|
||||
"fallbackNote": "Capacitat principal no disponible — s'ha redirigit a un tipus d'instància de reserva.",
|
||||
"liveWorker": "Procés actiu"
|
||||
"separator": "Separador"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Compra més crèdits",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "utilitza la correcció",
|
||||
"matchUseTidied": "utilitza la versió polida",
|
||||
"matchUsingTyped": "Utilitzant el que has escrit: {value}",
|
||||
"checkingUrl": "Comprovant…",
|
||||
"submitNetworkError": "Error de xarxa — si us plau, comprova la teva connexió i torna-ho a provar.",
|
||||
"submitError": "Alguna cosa ha anat malament. Torna-ho a provar."
|
||||
"checkingUrl": "Comprovant…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Configurant",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Reedició"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Reconnectant…",
|
||||
"unavailable": {
|
||||
"body": "Això sol ser temporal — si us plau, torna-ho a provar d'aquí a un parell de minuts.",
|
||||
"reassurance": "Els vídeos de karaoke que s'estiguin creant ara mateix no es veuran afectats i es continuaran processant.",
|
||||
"title": "Tenim problemes per connectar amb els nostres servidors"
|
||||
},
|
||||
"dismiss": "Descarta"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Enkodér",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separátor",
|
||||
"fallbackBadge": "Záložní",
|
||||
"fallbackNote": "Primární kapacita je nedostupná — přesměrováno na záložní typ instance.",
|
||||
"liveWorker": "Aktivní worker"
|
||||
"separator": "Separátor"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Koupit další kredity",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "použít opravu",
|
||||
"matchUseTidied": "použít upravenou verzi",
|
||||
"matchUsingTyped": "Používám to, co jsi zadal: {value}",
|
||||
"checkingUrl": "Probíhá kontrola…",
|
||||
"submitNetworkError": "Chyba sítě — zkontroluj prosím své připojení a zkus to znovu.",
|
||||
"submitError": "Něco se pokazilo. Zkus to prosím znovu."
|
||||
"checkingUrl": "Probíhá kontrola…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Nastavování",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Originál",
|
||||
"variantReissue": "Reedice"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Obnovování připojení…",
|
||||
"unavailable": {
|
||||
"body": "Většinou jde o dočasný problém — zkus to prosím znovu za pár minut.",
|
||||
"reassurance": "Právě vytvářená karaoke videa nejsou nijak ovlivněna a budou se nadále zpracovávat.",
|
||||
"title": "Nedaří se nám spojit s našimi servery"
|
||||
},
|
||||
"dismiss": "Zavřít"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Fallback",
|
||||
"fallbackNote": "Primær kapacitet utilgængelig — omdirigeret til en fallback-instanstype.",
|
||||
"liveWorker": "Live worker"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Køb flere credits",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "brug rettelsen",
|
||||
"matchUseTidied": "brug den tilrettede version",
|
||||
"matchUsingTyped": "Bruger det, du indtastede: {value}",
|
||||
"checkingUrl": "Tjekker…",
|
||||
"submitNetworkError": "Netværksfejl — tjek venligst din forbindelse, og prøv igen.",
|
||||
"submitError": "Noget gik galt. Prøv venligst igen."
|
||||
"checkingUrl": "Tjekker…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Sætter op",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Genudgivelse"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Genopretter forbindelse…",
|
||||
"unavailable": {
|
||||
"body": "Dette er som regel midlertidigt — prøv igen om et par minutter.",
|
||||
"reassurance": "Eventuelle karaokevideoer, der i øjeblikket bliver lavet, påvirkes ikke og vil fortsat blive behandlet.",
|
||||
"title": "Vi har problemer med at få forbindelse til vores servere"
|
||||
},
|
||||
"dismiss": "Afvis"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Fallback",
|
||||
"fallbackNote": "Primäre Kapazität nicht verfügbar — auf einen Fallback-Instanztyp umgeleitet.",
|
||||
"liveWorker": "Live-Worker"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Mehr Guthaben kaufen",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "Korrektur verwenden",
|
||||
"matchUseTidied": "bereinigte Version verwenden",
|
||||
"matchUsingTyped": "Verwende deine Eingabe: {value}",
|
||||
"checkingUrl": "Überprüfen…",
|
||||
"submitNetworkError": "Netzwerkfehler — bitte überprüfe deine Verbindung und versuche es erneut.",
|
||||
"submitError": "Etwas ist schiefgelaufen. Bitte versuche es erneut."
|
||||
"checkingUrl": "Überprüfen…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Richte ein",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} Bonus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Neuauflage"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Verbindung wird wiederhergestellt…",
|
||||
"unavailable": {
|
||||
"body": "Dies ist meist nur vorübergehend — bitte versuche es in ein paar Minuten noch einmal.",
|
||||
"reassurance": "Alle Karaoke-Videos, die gerade erstellt werden, sind davon nicht betroffen und werden weiterverarbeitet.",
|
||||
"title": "Wir haben Probleme, unsere Server zu erreichen"
|
||||
},
|
||||
"dismiss": "Ausblenden"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Εφεδρικό",
|
||||
"fallbackNote": "Η κύρια χωρητικότητα δεν είναι διαθέσιμη — δρομολογήθηκε σε εφεδρικό τύπο instance.",
|
||||
"liveWorker": "Ενεργός worker"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Αγόρασε Περισσότερες Μονάδες",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "χρησιμοποίησε τη διόρθωση",
|
||||
"matchUseTidied": "χρησιμοποίησε την καθαρισμένη έκδοση",
|
||||
"matchUsingTyped": "Χρησιμοποιείται αυτό που πληκτρολόγησες: {value}",
|
||||
"checkingUrl": "Έλεγχος…",
|
||||
"submitNetworkError": "Σφάλμα δικτύου — παρακαλούμε έλεγξε τη σύνδεσή σου και δοκίμασε ξανά.",
|
||||
"submitError": "Κάτι πήγε στραβά. Παρακαλώ δοκίμασε ξανά."
|
||||
"checkingUrl": "Έλεγχος…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Ρύθμιση",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} μπόνους",
|
||||
"variantOriginal": "Πρωτότυπο",
|
||||
"variantReissue": "Επανέκδοση"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Επανασύνδεση…",
|
||||
"unavailable": {
|
||||
"body": "Αυτό είναι συνήθως προσωρινό — παρακαλούμε δοκίμασε ξανά σε λίγα λεπτά.",
|
||||
"reassurance": "Τυχόν βίντεο καραόκε που δημιουργούνται αυτήν τη στιγμή δεν επηρεάζονται και η επεξεργασία τους θα συνεχιστεί.",
|
||||
"title": "Αντιμετωπίζουμε πρόβλημα σύνδεσης με τους διακομιστές μας"
|
||||
},
|
||||
"dismiss": "Απόρριψη"
|
||||
}
|
||||
}
|
||||
@@ -357,15 +357,6 @@
|
||||
"almostThere": "Almost there...",
|
||||
"firstLoadNote": "First load can take up to 30 seconds"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Reconnecting…",
|
||||
"unavailable": {
|
||||
"title": "We're having trouble reaching our servers",
|
||||
"body": "This is usually temporary — please try again in a couple of minutes.",
|
||||
"reassurance": "Any karaoke videos currently being created are unaffected and will keep processing."
|
||||
},
|
||||
"dismiss": "Dismiss"
|
||||
},
|
||||
"status": {
|
||||
"queued": "Queued",
|
||||
"processing": "Processing",
|
||||
@@ -382,9 +373,6 @@
|
||||
"secondaryStopped": "Secondary (stopped)",
|
||||
"lastSwap": "Last swap: {time}",
|
||||
"activeJobs": "Active jobs: {count}",
|
||||
"liveWorker": "Live worker",
|
||||
"fallbackBadge": "Fallback",
|
||||
"fallbackNote": "Primary capacity unavailable — routed to a fallback instance type.",
|
||||
"systemStatus": "System Status",
|
||||
"frontend": "Frontend",
|
||||
"backend": "Backend",
|
||||
@@ -553,8 +541,6 @@
|
||||
"missingAudioSource": "Missing audio source. Please go back and try again.",
|
||||
"searchExpired": "Your search results expired. Please search again — your song info is still saved.",
|
||||
"failedToStartProcessing": "Failed to start processing. Please try again.",
|
||||
"submitError": "Something went wrong. Please try again.",
|
||||
"submitNetworkError": "Network error — please check your connection and try again.",
|
||||
"trackSubmitted": "Track Submitted",
|
||||
"lyricsTranscription": "Lyrics transcription",
|
||||
"lyricsTranscriptionDesc": "We transcribe and sync lyrics from your audio. ~5 minutes",
|
||||
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Codificador",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separador",
|
||||
"fallbackBadge": "Respaldo",
|
||||
"fallbackNote": "Capacidad principal no disponible — redirigido a un tipo de instancia de respaldo.",
|
||||
"liveWorker": "Worker activo"
|
||||
"separator": "Separador"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Comprar más créditos",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "usar la corrección",
|
||||
"matchUseTidied": "usar la versión arreglada",
|
||||
"matchUsingTyped": "Usando lo que escribiste: {value}",
|
||||
"checkingUrl": "Comprobando…",
|
||||
"submitNetworkError": "Error de red — por favor, revisa tu conexión y vuelve a intentarlo.",
|
||||
"submitError": "Algo salió mal. Por favor, inténtalo de nuevo."
|
||||
"checkingUrl": "Comprobando…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Configurando",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Reedición"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Reconectando…",
|
||||
"unavailable": {
|
||||
"body": "Esto suele ser temporal — por favor, inténtalo de nuevo en un par de minutos.",
|
||||
"reassurance": "Los videos de karaoke que se estén creando en este momento no se verán afectados y seguirán procesándose.",
|
||||
"title": "Tenemos problemas para conectar con nuestros servidores"
|
||||
},
|
||||
"dismiss": "Descartar"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Varajärjestelmä",
|
||||
"fallbackNote": "Ensisijainen kapasiteetti ei ole käytettävissä — ohjattu varainstanssiin.",
|
||||
"liveWorker": "Live-työprosessi"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Osta lisää krediittejä",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "käytä korjausta",
|
||||
"matchUseTidied": "käytä siistittyä versiota",
|
||||
"matchUsingTyped": "Käytetään kirjoittamaasi: {value}",
|
||||
"checkingUrl": "Tarkistetaan…",
|
||||
"submitNetworkError": "Verkkovirhe — tarkista yhteytesi ja yritä uudelleen.",
|
||||
"submitError": "Jotain meni pieleen. Yritä uudelleen."
|
||||
"checkingUrl": "Tarkistetaan…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Asetetaan",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonusta",
|
||||
"variantOriginal": "Alkuperäinen",
|
||||
"variantReissue": "Uudelleenjulkaisu"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Yhdistetään uudelleen…",
|
||||
"unavailable": {
|
||||
"body": "Tämä on yleensä väliaikaista — yritä uudelleen parin minuutin kuluttua.",
|
||||
"reassurance": "Tämä ei vaikuta parhaillaan luotaviin karaokevideoihin, vaan niiden käsittely jatkuu normaalisti.",
|
||||
"title": "Palvelimiimme yhdistämisessä on ongelmia"
|
||||
},
|
||||
"dismiss": "Ohita"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encodeur",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Séparateur",
|
||||
"fallbackBadge": "Secours",
|
||||
"fallbackNote": "Capacité principale indisponible — redirection vers un type d'instance de secours.",
|
||||
"liveWorker": "Worker actif"
|
||||
"separator": "Séparateur"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Acheter plus de crédits",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "utiliser la correction",
|
||||
"matchUseTidied": "utiliser la version nettoyée",
|
||||
"matchUsingTyped": "Utilisation de ce que tu as tapé : {value}",
|
||||
"checkingUrl": "Vérification…",
|
||||
"submitNetworkError": "Erreur réseau — vérifie ta connexion et réessaie.",
|
||||
"submitError": "Quelque chose s'est mal passé. Réessaie."
|
||||
"checkingUrl": "Vérification…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Configuration",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Originale",
|
||||
"variantReissue": "Réédition"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Reconnexion…",
|
||||
"unavailable": {
|
||||
"body": "C'est généralement temporaire — réessaie dans quelques minutes.",
|
||||
"reassurance": "Les vidéos de karaoké en cours de création ne sont pas affectées et continueront d'être traitées.",
|
||||
"title": "Nous avons des difficultés à joindre nos serveurs"
|
||||
},
|
||||
"dismiss": "Ignorer"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "צד שרת",
|
||||
"encoder": "מקודד",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "מפריד",
|
||||
"fallbackBadge": "גיבוי",
|
||||
"fallbackNote": "הקיבולת הראשית אינה זמינה — נותב לסוג מופע גיבוי.",
|
||||
"liveWorker": "תהליך פעיל"
|
||||
"separator": "מפריד"
|
||||
},
|
||||
"credits": {
|
||||
"title": "קנה עוד קרדיטים",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "להשתמש בתיקון",
|
||||
"matchUseTidied": "להשתמש בגרסה המסודרת",
|
||||
"matchUsingTyped": "משתמשים במה שהקלדת: {value}",
|
||||
"checkingUrl": "בודק…",
|
||||
"submitNetworkError": "שגיאת רשת — אנא בדוק את החיבור שלך ונסה שוב.",
|
||||
"submitError": "משהו השתבש. אנא נסה שוב."
|
||||
"checkingUrl": "בודק…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "מגדיר",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} בונוס",
|
||||
"variantOriginal": "מקורי",
|
||||
"variantReissue": "הוצאה מחודשת"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "מתחבר מחדש…",
|
||||
"unavailable": {
|
||||
"body": "זה בדרך כלל זמני — אנא נסו שוב בעוד מספר דקות.",
|
||||
"reassurance": "סרטוני קריוקי שנוצרים כרגע לא יושפעו וימשיכו בתהליך העיבוד.",
|
||||
"title": "אנחנו מתקשים להתחבר לשרתים שלנו"
|
||||
},
|
||||
"dismiss": "התעלם"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "बैकएंड",
|
||||
"encoder": "एनकोडर",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "सेपरेटर",
|
||||
"fallbackBadge": "फ़ॉलबैक",
|
||||
"fallbackNote": "प्राथमिक क्षमता उपलब्ध नहीं है — फ़ॉलबैक इंस्टेंस प्रकार पर रूट किया गया।",
|
||||
"liveWorker": "लाइव वर्कर"
|
||||
"separator": "सेपरेटर"
|
||||
},
|
||||
"credits": {
|
||||
"title": "और क्रेडिट्स खरीदो",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "सुधार का इस्तेमाल करो",
|
||||
"matchUseTidied": "व्यवस्थित वर्शन का इस्तेमाल करो",
|
||||
"matchUsingTyped": "जो तुमने टाइप किया है, उसका इस्तेमाल हो रहा है: {value}",
|
||||
"checkingUrl": "चेक किया जा रहा है…",
|
||||
"submitNetworkError": "नेटवर्क एरर — कृपया अपना कनेक्शन चेक करो और फिर से कोशिश करो।",
|
||||
"submitError": "कुछ गलत हो गया। कृपया फिर से कोशिश करो।"
|
||||
"checkingUrl": "चेक किया जा रहा है…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "सेटअप हो रहा है",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} बोनस",
|
||||
"variantOriginal": "मूल",
|
||||
"variantReissue": "रीइश्यू"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "फिर से कनेक्ट हो रहा है…",
|
||||
"unavailable": {
|
||||
"body": "यह आमतौर पर अस्थायी होता है — कृपया कुछ मिनट बाद फिर से कोशिश करो।",
|
||||
"reassurance": "अभी बन रहे किसी भी कराओके वीडियो पर कोई असर नहीं पड़ा है और उनकी प्रोसेसिंग जारी रहेगी।",
|
||||
"title": "हमें अपने सर्वर तक पहुँचने में परेशानी हो रही है"
|
||||
},
|
||||
"dismiss": "हटाओ"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Enkoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Pričuva",
|
||||
"fallbackNote": "Primarni kapacitet nije dostupan — preusmjereno na pričuvnu vrstu instance.",
|
||||
"liveWorker": "Aktivni radnik"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Kupi još kredita",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "koristi ispravak",
|
||||
"matchUseTidied": "koristi uređenu verziju",
|
||||
"matchUsingTyped": "Koristimo ono što si upisao: {value}",
|
||||
"checkingUrl": "Provjera…",
|
||||
"submitNetworkError": "Mrežna pogreška — molim te, provjeri svoju vezu i pokušaj ponovno.",
|
||||
"submitError": "Nešto je pošlo po zlu. Pokušaj ponovno."
|
||||
"checkingUrl": "Provjera…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Postavljanje",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Reizdanje"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Ponovno povezivanje…",
|
||||
"unavailable": {
|
||||
"body": "Ovo je obično privremeno — molim te pokušaj ponovno za nekoliko minuta.",
|
||||
"reassurance": "Ovo ne utječe na karaoke videozapise koji se trenutno izrađuju i njihova će se obrada nastaviti.",
|
||||
"title": "Imamo problema s povezivanjem na naše servere"
|
||||
},
|
||||
"dismiss": "Odbaci"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Kódoló",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Szétválasztó",
|
||||
"fallbackBadge": "Tartalék",
|
||||
"fallbackNote": "Az elsődleges kapacitás nem elérhető — átirányítva egy tartalék példánytípusra.",
|
||||
"liveWorker": "Élő feldolgozó"
|
||||
"separator": "Szétválasztó"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Vásárolj több kreditet",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "javítás használata",
|
||||
"matchUseTidied": "letisztított verzió használata",
|
||||
"matchUsingTyped": "Az általad beírtak használata: {value}",
|
||||
"checkingUrl": "Ellenőrzés…",
|
||||
"submitNetworkError": "Hálózati hiba — kérlek, ellenőrizd a kapcsolatodat, és próbáld újra.",
|
||||
"submitError": "Valami hiba történt. Kérlek, próbáld újra."
|
||||
"checkingUrl": "Ellenőrzés…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Beállítás",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bónusz",
|
||||
"variantOriginal": "Eredeti",
|
||||
"variantReissue": "Újrakiadás"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Újracsatlakozás…",
|
||||
"unavailable": {
|
||||
"body": "Ez általában átmeneti — kérlek, próbáld újra néhány perc múlva.",
|
||||
"reassurance": "A jelenleg készülő karaoke videókat ez nem érinti, a feldolgozásuk zavartalanul folytatódik.",
|
||||
"title": "Nem tudjuk elérni a szervereinket"
|
||||
},
|
||||
"dismiss": "Elvetés"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Pemisah",
|
||||
"fallbackBadge": "Cadangan",
|
||||
"fallbackNote": "Kapasitas utama tidak tersedia — dialihkan ke tipe instans cadangan.",
|
||||
"liveWorker": "Pekerja aktif"
|
||||
"separator": "Pemisah"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Beli Lebih Banyak Kredit",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "gunakan koreksi",
|
||||
"matchUseTidied": "gunakan versi yang dirapikan",
|
||||
"matchUsingTyped": "Menggunakan yang Anda ketik: {value}",
|
||||
"checkingUrl": "Memeriksa…",
|
||||
"submitNetworkError": "Kesalahan jaringan — silakan periksa koneksi Anda dan coba lagi.",
|
||||
"submitError": "Terjadi kesalahan. Silakan coba lagi."
|
||||
"checkingUrl": "Memeriksa…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Menyiapkan",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Rilis ulang"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Menghubungkan kembali…",
|
||||
"unavailable": {
|
||||
"body": "Biasanya ini hanya sementara — silakan coba lagi dalam beberapa menit.",
|
||||
"reassurance": "Video karaoke yang sedang dibuat tidak akan terpengaruh dan akan terus diproses.",
|
||||
"title": "Kami kesulitan terhubung ke server"
|
||||
},
|
||||
"dismiss": "Abaikan"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separatore",
|
||||
"fallbackBadge": "Fallback",
|
||||
"fallbackNote": "Capacità principale non disponibile — reindirizzato a un tipo di istanza di fallback.",
|
||||
"liveWorker": "Worker live"
|
||||
"separator": "Separatore"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Acquista altri crediti",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "usa la correzione",
|
||||
"matchUseTidied": "usa la versione ripulita",
|
||||
"matchUsingTyped": "Uso quello che hai digitato: {value}",
|
||||
"checkingUrl": "Controllo in corso…",
|
||||
"submitNetworkError": "Errore di rete — controlla la tua connessione e riprova.",
|
||||
"submitError": "Qualcosa è andato storto. Riprova."
|
||||
"checkingUrl": "Controllo in corso…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Configurazione",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Originale",
|
||||
"variantReissue": "Ristampa"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Riconnessione…",
|
||||
"unavailable": {
|
||||
"body": "Di solito è un problema temporaneo — riprova tra un paio di minuti.",
|
||||
"reassurance": "I video karaoke attualmente in fase di creazione non subiranno interruzioni e continueranno a essere elaborati.",
|
||||
"title": "Abbiamo problemi a raggiungere i nostri server"
|
||||
},
|
||||
"dismiss": "Ignora"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "バックエンド",
|
||||
"encoder": "エンコーダー",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "セパレーター",
|
||||
"fallbackBadge": "フォールバック",
|
||||
"fallbackNote": "プライマリ容量が利用できないため、フォールバックのインスタンスタイプにルーティングされました。",
|
||||
"liveWorker": "稼働中のワーカー"
|
||||
"separator": "セパレーター"
|
||||
},
|
||||
"credits": {
|
||||
"title": "クレジットを追加購入",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "修正を適用する",
|
||||
"matchUseTidied": "整形版を使用する",
|
||||
"matchUsingTyped": "入力された内容を使用します: {value}",
|
||||
"checkingUrl": "確認中…",
|
||||
"submitNetworkError": "ネットワークエラーが発生しました。接続を確認して、もう一度お試しください。",
|
||||
"submitError": "問題が発生しました。もう一度お試しください。"
|
||||
"checkingUrl": "確認中…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "セットアップ中",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} ボーナス",
|
||||
"variantOriginal": "オリジナル",
|
||||
"variantReissue": "リイシュー"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "再接続中…",
|
||||
"unavailable": {
|
||||
"body": "通常は一時的な問題ですので、数分後にもう一度お試しください。",
|
||||
"reassurance": "現在作成中のカラオケ動画に影響はありません。そのまま処理が継続されます。",
|
||||
"title": "サーバーへの接続に問題が発生しています"
|
||||
},
|
||||
"dismiss": "閉じる"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "백엔드",
|
||||
"encoder": "인코더",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "분리기",
|
||||
"fallbackBadge": "대체",
|
||||
"fallbackNote": "기본 용량을 사용할 수 없어 대체 인스턴스 유형으로 연결되었습니다.",
|
||||
"liveWorker": "라이브 워커"
|
||||
"separator": "분리기"
|
||||
},
|
||||
"credits": {
|
||||
"title": "크레딧 추가 구매",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "수정본 사용하기",
|
||||
"matchUseTidied": "정리된 버전 사용하기",
|
||||
"matchUsingTyped": "입력한 내용 사용: {value}",
|
||||
"checkingUrl": "확인 중…",
|
||||
"submitNetworkError": "네트워크 오류 — 연결 상태를 확인하고 다시 시도해 주세요.",
|
||||
"submitError": "문제가 발생했습니다. 다시 시도해 주세요."
|
||||
"checkingUrl": "확인 중…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "설정 중",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} 보너스",
|
||||
"variantOriginal": "오리지널",
|
||||
"variantReissue": "재발매"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "다시 연결하는 중…",
|
||||
"unavailable": {
|
||||
"body": "대부분 일시적인 현상이니 몇 분 후에 다시 시도해 주세요.",
|
||||
"reassurance": "현재 생성 중인 노래방 영상은 영향을 받지 않고 정상적으로 처리됩니다.",
|
||||
"title": "서버에 연결하는 데 문제가 발생했습니다"
|
||||
},
|
||||
"dismiss": "닫기"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Bahagian Belakang",
|
||||
"encoder": "Pengekod",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Pemisah",
|
||||
"fallbackBadge": "Sandaran",
|
||||
"fallbackNote": "Kapasiti utama tidak tersedia — dihalakan ke jenis sandaran.",
|
||||
"liveWorker": "Pekerja aktif"
|
||||
"separator": "Pemisah"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Beli Lebih Banyak Kredit",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "gunakan pembetulan",
|
||||
"matchUseTidied": "gunakan versi yang dikemaskan",
|
||||
"matchUsingTyped": "Menggunakan apa yang anda taip: {value}",
|
||||
"checkingUrl": "Menyemak…",
|
||||
"submitNetworkError": "Ralat rangkaian — sila semak sambungan anda dan cuba lagi.",
|
||||
"submitError": "Sesuatu yang tidak kena berlaku. Sila cuba lagi."
|
||||
"checkingUrl": "Menyemak…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Menyediakan",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Asal",
|
||||
"variantReissue": "Keluaran semula"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Menyambung semula…",
|
||||
"unavailable": {
|
||||
"body": "Ini biasanya sementara — sila cuba lagi dalam beberapa minit.",
|
||||
"reassurance": "Sebarang video karaoke yang sedang dihasilkan tidak terjejas dan akan terus diproses.",
|
||||
"title": "Kami menghadapi masalah menyambung ke pelayan kami"
|
||||
},
|
||||
"dismiss": "Tutup"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Koder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Reserve",
|
||||
"fallbackNote": "Primærkapasitet er utilgjengelig — omdirigert til en reserveinstans.",
|
||||
"liveWorker": "Aktiv arbeider"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Kjøp flere kreditter",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "bruk rettelsen",
|
||||
"matchUseTidied": "bruk oppryddet versjon",
|
||||
"matchUsingTyped": "Bruker det du skrev inn: {value}",
|
||||
"checkingUrl": "Sjekker…",
|
||||
"submitNetworkError": "Nettverksfeil — vennligst sjekk tilkoblingen din og prøv igjen.",
|
||||
"submitError": "Noe gikk galt. Vennligst prøv igjen."
|
||||
"checkingUrl": "Sjekker…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Setter opp",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Nyutgivelse"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Kobler til på nytt…",
|
||||
"unavailable": {
|
||||
"body": "Dette er vanligvis midlertidig — prøv igjen om et par minutter.",
|
||||
"reassurance": "Eventuelle karaokevideoer som lages akkurat nå påvirkes ikke, og vil fortsette å behandles.",
|
||||
"title": "Vi har problemer med å nå serverne våre"
|
||||
},
|
||||
"dismiss": "Lukk"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Fallback",
|
||||
"fallbackNote": "Primaire capaciteit niet beschikbaar — omgeleid naar een fallback-instancetype.",
|
||||
"liveWorker": "Live worker"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Koop meer credits",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "gebruik de correctie",
|
||||
"matchUseTidied": "gebruik opgeschoonde versie",
|
||||
"matchUsingTyped": "We gebruiken wat je hebt getypt: {value}",
|
||||
"checkingUrl": "Controleren…",
|
||||
"submitNetworkError": "Netwerkfout — controleer je verbinding en probeer het opnieuw.",
|
||||
"submitError": "Er is iets misgegaan. Probeer het opnieuw."
|
||||
"checkingUrl": "Controleren…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Instellen",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Origineel",
|
||||
"variantReissue": "Heruitgave"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Opnieuw verbinden…",
|
||||
"unavailable": {
|
||||
"body": "Dit is meestal tijdelijk — probeer het over een paar minuten opnieuw.",
|
||||
"reassurance": "Karaokevideo's die momenteel worden gemaakt, ondervinden hier geen hinder van en worden gewoon verder verwerkt.",
|
||||
"title": "We kunnen onze servers even niet bereiken"
|
||||
},
|
||||
"dismiss": "Sluiten"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Koder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Zapasowy",
|
||||
"fallbackNote": "Główne zasoby niedostępne — przekierowano do zapasowego typu instancji.",
|
||||
"liveWorker": "Aktywny proces roboczy"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Kup więcej kredytów",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "użyj poprawki",
|
||||
"matchUseTidied": "użyj uporządkowanej wersji",
|
||||
"matchUsingTyped": "Używam wpisanego tekstu: {value}",
|
||||
"checkingUrl": "Sprawdzanie…",
|
||||
"submitNetworkError": "Błąd sieci — sprawdź połączenie i spróbuj ponownie.",
|
||||
"submitError": "Coś poszło nie tak. Spróbuj ponownie."
|
||||
"checkingUrl": "Sprawdzanie…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Konfigurowanie",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Oryginał",
|
||||
"variantReissue": "Reedycja"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Ponowne łączenie…",
|
||||
"unavailable": {
|
||||
"body": "To zazwyczaj problem tymczasowy — spróbuj ponownie za kilka minut.",
|
||||
"reassurance": "Obecnie tworzone filmy karaoke są bezpieczne i będą nadal przetwarzane.",
|
||||
"title": "Mamy problem z połączeniem z naszymi serwerami"
|
||||
},
|
||||
"dismiss": "Zamknij"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Fallback",
|
||||
"fallbackNote": "Capacidade principal indisponível — redirecionado para um tipo de instância de fallback.",
|
||||
"liveWorker": "Worker ativo"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Comprar Mais Créditos",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "usar a correção",
|
||||
"matchUseTidied": "usar a versão ajustada",
|
||||
"matchUsingTyped": "Usando o que você digitou: {value}",
|
||||
"checkingUrl": "Verificando…",
|
||||
"submitNetworkError": "Erro de rede — por favor, verifique sua conexão e tente novamente.",
|
||||
"submitError": "Algo deu errado. Tente novamente."
|
||||
"checkingUrl": "Verificando…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Configurando",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bônus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Reedição"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Reconectando…",
|
||||
"unavailable": {
|
||||
"body": "Isso geralmente é temporário — por favor, tente novamente em alguns minutos.",
|
||||
"reassurance": "Os vídeos de karaokê que estão sendo criados no momento não serão afetados e continuarão sendo processados.",
|
||||
"title": "Estamos com problemas para acessar nossos servidores"
|
||||
},
|
||||
"dismiss": "Dispensar"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Rezervă",
|
||||
"fallbackNote": "Capacitatea principală este indisponibilă — redirecționată către un tip de instanță de rezervă.",
|
||||
"liveWorker": "Worker activ"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Cumpără mai multe credite",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "folosește corecția",
|
||||
"matchUseTidied": "folosește versiunea curățată",
|
||||
"matchUsingTyped": "Folosim ce ai tastat: {value}",
|
||||
"checkingUrl": "Se verifică…",
|
||||
"submitNetworkError": "Eroare de rețea — te rugăm să verifici conexiunea și să încerci din nou.",
|
||||
"submitError": "Ceva nu a mers bine. Te rog să încerci din nou."
|
||||
"checkingUrl": "Se verifică…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Se configurează",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Reeditare"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Se reconectează…",
|
||||
"unavailable": {
|
||||
"body": "Această situație este de obicei temporară — încearcă din nou în câteva minute.",
|
||||
"reassurance": "Videoclipurile de karaoke aflate în curs de creare nu sunt afectate și vor continua să fie procesate.",
|
||||
"title": "Întâmpinăm probleme la conectarea cu serverele noastre"
|
||||
},
|
||||
"dismiss": "Închide"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Бэкенд",
|
||||
"encoder": "Кодировщик",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Разделитель",
|
||||
"fallbackBadge": "Резерв",
|
||||
"fallbackNote": "Основные ресурсы недоступны — перенаправлено на резервный тип инстанса.",
|
||||
"liveWorker": "Активный воркер"
|
||||
"separator": "Разделитель"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Купить еще кредиты",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "использовать исправление",
|
||||
"matchUseTidied": "использовать отформатированную версию",
|
||||
"matchUsingTyped": "Используем твой вариант: {value}",
|
||||
"checkingUrl": "Проверка…",
|
||||
"submitNetworkError": "Ошибка сети — пожалуйста, проверь подключение и попробуй еще раз.",
|
||||
"submitError": "Что-то пошло не так. Пожалуйста, попробуй еще раз."
|
||||
"checkingUrl": "Проверка…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Настройка",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} бонус",
|
||||
"variantOriginal": "Оригинал",
|
||||
"variantReissue": "Переиздание"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Переподключение…",
|
||||
"unavailable": {
|
||||
"body": "Обычно это временно — пожалуйста, попробуй еще раз через пару минут.",
|
||||
"reassurance": "Это не повлияет на караоке-видео, которые сейчас создаются — они продолжат обрабатываться.",
|
||||
"title": "Возникли проблемы с подключением к нашим серверам"
|
||||
},
|
||||
"dismiss": "Скрыть"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Enkodér",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separátor",
|
||||
"fallbackBadge": "Záloha",
|
||||
"fallbackNote": "Primárna kapacita je nedostupná — presmerovaná na záložný typ inštancie.",
|
||||
"liveWorker": "Aktívny worker"
|
||||
"separator": "Separátor"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Kúpiť viac kreditov",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "použiť opravu",
|
||||
"matchUseTidied": "použiť upravenú verziu",
|
||||
"matchUsingTyped": "Používam to, čo si zadal: {value}",
|
||||
"checkingUrl": "Kontroluje sa…",
|
||||
"submitNetworkError": "Chyba siete — skontroluj pripojenie a skús to znova.",
|
||||
"submitError": "Niečo sa pokazilo. Skús to znova."
|
||||
"checkingUrl": "Kontroluje sa…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Nastavuje sa",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Originál",
|
||||
"variantReissue": "Reedícia"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Obnovuje sa pripojenie…",
|
||||
"unavailable": {
|
||||
"body": "Zvyčajne ide len o dočasný problém — skús to znova o pár minút.",
|
||||
"reassurance": "Karaoke videá, ktoré sa práve vytvárajú, to neovplyvní a ich spracovanie bude pokračovať.",
|
||||
"title": "Máme problémy s pripojením k našim serverom"
|
||||
},
|
||||
"dismiss": "Zavrieť"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Fallback",
|
||||
"fallbackNote": "Primär kapacitet är otillgänglig — omdirigerad till en fallback-instans.",
|
||||
"liveWorker": "Live-worker"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Köp fler krediter",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "använd korrigeringen",
|
||||
"matchUseTidied": "använd rensad version",
|
||||
"matchUsingTyped": "Använder det du skrev: {value}",
|
||||
"checkingUrl": "Kontrollerar…",
|
||||
"submitNetworkError": "Nätverksfel — kontrollera din anslutning och försök igen.",
|
||||
"submitError": "Något gick fel. Försök igen."
|
||||
"checkingUrl": "Kontrollerar…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Ställer in",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Original",
|
||||
"variantReissue": "Nyutgåva"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Återansluter…",
|
||||
"unavailable": {
|
||||
"body": "Detta är oftast tillfälligt — försök igen om ett par minuter.",
|
||||
"reassurance": "Karaokevideor som håller på att skapas påverkas inte, utan fortsätter att bearbetas.",
|
||||
"title": "Vi har problem med att nå våra servrar"
|
||||
},
|
||||
"dismiss": "Avfärda"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "สำรอง",
|
||||
"fallbackNote": "ทรัพยากรหลักไม่พร้อมใช้งาน — เปลี่ยนเส้นทางไปยังอินสแตนซ์สำรองแล้ว",
|
||||
"liveWorker": "เวิร์กเกอร์ที่ทำงานอยู่"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "ซื้อเครดิตเพิ่ม",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "ใช้ตามที่แก้ไข",
|
||||
"matchUseTidied": "ใช้เวอร์ชันที่จัดระเบียบแล้ว",
|
||||
"matchUsingTyped": "ใช้ข้อความที่คุณพิมพ์: {value}",
|
||||
"checkingUrl": "กำลังตรวจสอบ…",
|
||||
"submitNetworkError": "เกิดข้อผิดพลาดของเครือข่าย — โปรดตรวจสอบการเชื่อมต่อของคุณแล้วลองใหม่อีกครั้ง",
|
||||
"submitError": "เกิดข้อผิดพลาดบางอย่าง โปรดลองอีกครั้ง"
|
||||
"checkingUrl": "กำลังตรวจสอบ…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "กำลังตั้งค่า",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} โบนัส",
|
||||
"variantOriginal": "ต้นฉบับ",
|
||||
"variantReissue": "วางจำหน่ายใหม่"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "กำลังเชื่อมต่อใหม่…",
|
||||
"unavailable": {
|
||||
"body": "ปัญหานี้มักเกิดขึ้นเพียงชั่วคราว — กรุณาลองใหม่อีกครั้งในอีกสองสามนาที",
|
||||
"reassurance": "วิดีโอคาราโอเกะที่กำลังสร้างอยู่จะไม่ได้รับผลกระทบ และจะประมวลผลต่อไป",
|
||||
"title": "เราพบปัญหาในการเชื่อมต่อกับเซิร์ฟเวอร์"
|
||||
},
|
||||
"dismiss": "ปิดทิ้ง"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Fallback",
|
||||
"fallbackNote": "Hindi available ang pangunahing kapasidad — inilipat sa isang fallback instance type.",
|
||||
"liveWorker": "Live worker"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Bumili ng Higit Pang Credits",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "gamitin ang itinama",
|
||||
"matchUseTidied": "gamitin ang inayos na bersyon",
|
||||
"matchUsingTyped": "Ginagamit ang iyong nai-type: {value}",
|
||||
"checkingUrl": "Sinusuri…",
|
||||
"submitNetworkError": "Error sa network — paki-check ang iyong koneksyon at subukang muli.",
|
||||
"submitError": "May nangyaring mali. Pakisubukan muli."
|
||||
"checkingUrl": "Sinusuri…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Sine-set up",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Orihinal",
|
||||
"variantReissue": "Muling inilabas"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Kumokonekta muli…",
|
||||
"unavailable": {
|
||||
"body": "Kadalasan ay pansamantala lamang ito — pakisubukan muli pagkalipas ng ilang minuto.",
|
||||
"reassurance": "Ang anumang karaoke video na kasalukuyang ginagawa ay hindi maaapektuhan at patuloy na ipoproseso.",
|
||||
"title": "Nahihirapan kaming kumonekta sa aming mga server"
|
||||
},
|
||||
"dismiss": "I-dismiss"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Arkayüz",
|
||||
"encoder": "Kodlayıcı",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Ayırıcı",
|
||||
"fallbackBadge": "Yedek",
|
||||
"fallbackNote": "Ana kapasite kullanılamıyor — yedek bir sunucu tipine yönlendirildi.",
|
||||
"liveWorker": "Canlı işlemci"
|
||||
"separator": "Ayırıcı"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Daha Fazla Kredi Al",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "düzeltmeyi kullan",
|
||||
"matchUseTidied": "düzenlenmiş sürümü kullan",
|
||||
"matchUsingTyped": "Yazdığın kullanılıyor: {value}",
|
||||
"checkingUrl": "Kontrol ediliyor…",
|
||||
"submitNetworkError": "Ağ hatası — lütfen bağlantını kontrol et ve tekrar dene.",
|
||||
"submitError": "Bir şeyler ters gitti. Lütfen tekrar dene."
|
||||
"checkingUrl": "Kontrol ediliyor…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Ayarlanıyor",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} bonus",
|
||||
"variantOriginal": "Orijinal",
|
||||
"variantReissue": "Yeniden basım"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Yeniden bağlanıyor…",
|
||||
"unavailable": {
|
||||
"body": "Bu genellikle geçici bir durum — lütfen birkaç dakika sonra tekrar dene.",
|
||||
"reassurance": "Şu anda oluşturulmakta olan karaoke videoları bu durumdan etkilenmez ve işlenmeye devam eder.",
|
||||
"title": "Sunucularımıza ulaşmakta sorun yaşıyoruz"
|
||||
},
|
||||
"dismiss": "Kapat"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Бекенд",
|
||||
"encoder": "Кодувальник",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Розділювач",
|
||||
"fallbackBadge": "Резерв",
|
||||
"fallbackNote": "Основні потужності недоступні — перенаправлено на резервний тип інстансу.",
|
||||
"liveWorker": "Активний воркер"
|
||||
"separator": "Розділювач"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Купити більше кредитів",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "використати виправлення",
|
||||
"matchUseTidied": "використати впорядковану версію",
|
||||
"matchUsingTyped": "Використовуємо введений тобою текст: {value}",
|
||||
"checkingUrl": "Перевірка…",
|
||||
"submitNetworkError": "Помилка мережі — будь ласка, перевір з'єднання і спробуй ще раз.",
|
||||
"submitError": "Щось пішло не так. Будь ласка, спробуй ще раз."
|
||||
"checkingUrl": "Перевірка…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Налаштування",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} бонус",
|
||||
"variantOriginal": "Оригінал",
|
||||
"variantReissue": "Перевидання"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Відновлення з'єднання…",
|
||||
"unavailable": {
|
||||
"body": "Зазвичай це тимчасово — будь ласка, спробуй ще раз за кілька хвилин.",
|
||||
"reassurance": "Це не вплине на караоке-відео, які зараз створюються, їхня обробка продовжиться.",
|
||||
"title": "Виникли проблеми зі зв'язком із нашими серверами"
|
||||
},
|
||||
"dismiss": "Закрити"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "Backend",
|
||||
"encoder": "Encoder",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "Separator",
|
||||
"fallbackBadge": "Dự phòng",
|
||||
"fallbackNote": "Tài nguyên chính không khả dụng — đã chuyển hướng sang máy chủ dự phòng.",
|
||||
"liveWorker": "Worker đang hoạt động"
|
||||
"separator": "Separator"
|
||||
},
|
||||
"credits": {
|
||||
"title": "Mua thêm credit",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "sử dụng bản sửa đổi",
|
||||
"matchUseTidied": "sử dụng bản đã tinh chỉnh",
|
||||
"matchUsingTyped": "Sử dụng nội dung bạn đã nhập: {value}",
|
||||
"checkingUrl": "Đang kiểm tra…",
|
||||
"submitNetworkError": "Lỗi mạng — vui lòng kiểm tra kết nối của bạn và thử lại.",
|
||||
"submitError": "Đã xảy ra lỗi. Vui lòng thử lại."
|
||||
"checkingUrl": "Đang kiểm tra…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "Đang thiết lập",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} tặng kèm",
|
||||
"variantOriginal": "Bản gốc",
|
||||
"variantReissue": "Tái bản"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "Đang kết nối lại…",
|
||||
"unavailable": {
|
||||
"body": "Sự cố này thường chỉ là tạm thời — vui lòng thử lại sau vài phút.",
|
||||
"reassurance": "Các video karaoke đang được tạo sẽ không bị ảnh hưởng và vẫn tiếp tục được xử lý.",
|
||||
"title": "Chúng tôi đang gặp sự cố khi kết nối với máy chủ"
|
||||
},
|
||||
"dismiss": "Bỏ qua"
|
||||
}
|
||||
}
|
||||
@@ -378,10 +378,7 @@
|
||||
"backend": "后端",
|
||||
"encoder": "编码器",
|
||||
"flacfetch": "Flacfetch",
|
||||
"separator": "分离器",
|
||||
"fallbackBadge": "备用",
|
||||
"fallbackNote": "主容量不可用 — 已切换至备用实例类型。",
|
||||
"liveWorker": "在线工作节点"
|
||||
"separator": "分离器"
|
||||
},
|
||||
"credits": {
|
||||
"title": "购买更多积分",
|
||||
@@ -552,9 +549,7 @@
|
||||
"matchUseCorrection": "使用修正内容",
|
||||
"matchUseTidied": "使用整理后的版本",
|
||||
"matchUsingTyped": "使用您输入的内容:{value}",
|
||||
"checkingUrl": "检查中…",
|
||||
"submitNetworkError": "网络错误 —— 请检查您的网络连接并重试。",
|
||||
"submitError": "出了点问题,请重试。"
|
||||
"checkingUrl": "检查中…"
|
||||
},
|
||||
"jobStatus": {
|
||||
"settingUp": "设置中",
|
||||
@@ -1683,14 +1678,5 @@
|
||||
"variantBonus": "+{count} 附加曲目",
|
||||
"variantOriginal": "原版",
|
||||
"variantReissue": "再版"
|
||||
},
|
||||
"backendStatus": {
|
||||
"reconnecting": "重新连接中…",
|
||||
"unavailable": {
|
||||
"body": "这通常是暂时现象,请几分钟后再试。",
|
||||
"reassurance": "当前正在制作的卡拉OK视频不会受到影响,系统将继续进行处理。",
|
||||
"title": "我们连接服务器时遇到了一些问题"
|
||||
},
|
||||
"dismiss": "忽略"
|
||||
}
|
||||
}
|
||||
@@ -194,124 +194,23 @@ def create_alert_policies(
|
||||
)
|
||||
|
||||
# Alert: Cloud Run Service Unavailable
|
||||
#
|
||||
# HISTORY — why this is NOT an instance-count-absence alert anymore:
|
||||
# The original condition used `condition_absent` on
|
||||
# `run.googleapis.com/container/instance_count` ("No healthy instances").
|
||||
# That metric is a *sampled* series: for a min-instances=1, low-traffic
|
||||
# service it legitimately stops reporting for short stretches even while
|
||||
# the single instance is alive and serving 200s. On 2026-08-19 03:15 UTC it
|
||||
# fired + auto-resolved in ~85s while the same instanceId was actively
|
||||
# answering the scheduled recover-stuck-jobs / retry-pending-render crons
|
||||
# with HTTP 200 — a pure metric blink, not an outage. Absence of an
|
||||
# instance-count sample is simply the wrong signal for "is the API down".
|
||||
#
|
||||
# Fix: measure reachability directly with a Cloud Monitoring uptime check
|
||||
# against the public health endpoint (through the Cloudflare edge, exactly
|
||||
# the path real users take), and page only when it FAILS from more than one
|
||||
# checker location — so a single flaky checker can't page us, but a genuine
|
||||
# hard-down (every checker failing) does after the retest window (~5-6 min
|
||||
# with the 300s `duration`; see the HISTORY note on that below).
|
||||
#
|
||||
# NOTE on granularity: with selected_regions unset the check runs from all
|
||||
# of Google's checker locations (several are in the USA alone). The
|
||||
# condition counts failing *checker locations* (REDUCE_COUNT_FALSE grouped
|
||||
# by host), NOT broad geographic regions — two failed US checkers is enough
|
||||
# to fire. That is intentional: >1 failing location is a real reachability
|
||||
# problem worth paging, and requiring >1 filters out single-checker noise.
|
||||
#
|
||||
# HISTORY — why `duration` is 300s, not 60s:
|
||||
# The service runs on `--min-instances 1` (a single warm instance). Two
|
||||
# self-healing failure modes each briefly take health checks down from ALL
|
||||
# checker locations at once, tripping the >1-location threshold:
|
||||
# (a) Instance recycle. Cloud Run periodically replaces the lone instance
|
||||
# (host maintenance / max-lifetime). On 2026-08-22 06:02:30–06:03:50
|
||||
# UTC the instance was replaced (log: "Starting new instance …
|
||||
# MIN_INSTANCE" then AUTOSCALING; STARTUP probe ready ~06:03:13),
|
||||
# leaving ~80s with no warm origin — every uptime checker failed, then
|
||||
# it self-healed. The alert fired at 06:06 and auto-cleared in ~1m41s.
|
||||
# (b) Event-loop stall. The single instance can block on synchronous-ish
|
||||
# work (e.g. orchestrating an encoding-worker fallback cold-start with
|
||||
# blocking timeouts, seen 2026-08-22 00:11–00:12 UTC where four queued
|
||||
# health probes all flushed at the same instant), so probes queue past
|
||||
# the 10s uptime timeout across regions until it frees up.
|
||||
# Both clear on their own well under 5 minutes. Rather than pay for a second
|
||||
# always-on instance, we require the >1-location failure to PERSIST for 300s
|
||||
# before paging: sub-5-min blips are suppressed, a genuine sustained hard-down
|
||||
# still pages (at ~5–6 min instead of ~1–2). If real outages ever slip
|
||||
# through undetected, the cheaper-detection lever is `--min-instances 2`
|
||||
# (ci.yml) — that removes both failure modes at the source.
|
||||
uptime_health = gcp.monitoring.UptimeCheckConfig(
|
||||
"backend-health-uptime-check",
|
||||
display_name="Karaoke Backend - /api/health",
|
||||
timeout="10s",
|
||||
period="60s",
|
||||
monitored_resource=gcp.monitoring.UptimeCheckConfigMonitoredResourceArgs(
|
||||
type="uptime_url",
|
||||
labels={"project_id": PROJECT_ID, "host": "api.nomadkaraoke.com"},
|
||||
),
|
||||
http_check=gcp.monitoring.UptimeCheckConfigHttpCheckArgs(
|
||||
path="/api/health",
|
||||
port=443,
|
||||
use_ssl=True,
|
||||
validate_ssl=True,
|
||||
request_method="GET",
|
||||
accepted_response_status_codes=[
|
||||
gcp.monitoring.UptimeCheckConfigHttpCheckAcceptedResponseStatusCodeArgs(
|
||||
status_value=200,
|
||||
),
|
||||
],
|
||||
),
|
||||
# Body must actually contain the health marker — guards against an edge
|
||||
# that returns 200 with an error/placeholder page instead of the app.
|
||||
content_matchers=[
|
||||
gcp.monitoring.UptimeCheckConfigContentMatcherArgs(
|
||||
content="healthy",
|
||||
matcher="CONTAINS_STRING",
|
||||
),
|
||||
],
|
||||
)
|
||||
alerts["health_uptime_check"] = uptime_health
|
||||
|
||||
# Build the alert filter once the check id is known. `check_id` in the metric
|
||||
# label is the short id exposed as `.uptime_check_id`.
|
||||
_uptime_filter = uptime_health.uptime_check_id.apply(
|
||||
lambda check_id: (
|
||||
'resource.type="uptime_url" '
|
||||
'AND metric.type="monitoring.googleapis.com/uptime_check/check_passed" '
|
||||
f'AND metric.label.check_id="{check_id}"'
|
||||
)
|
||||
)
|
||||
|
||||
alerts["service_unavailable"] = gcp.monitoring.AlertPolicy(
|
||||
"service-unavailable-alert",
|
||||
display_name="Karaoke Backend - Service Unavailable",
|
||||
combiner="OR",
|
||||
conditions=[
|
||||
gcp.monitoring.AlertPolicyConditionArgs(
|
||||
display_name="Health check failing from >1 checker location",
|
||||
condition_threshold=gcp.monitoring.AlertPolicyConditionConditionThresholdArgs(
|
||||
filter=_uptime_filter,
|
||||
# Count how many checker locations reported a *failed* check
|
||||
# over the window; fire when more than one location is failing.
|
||||
comparison="COMPARISON_GT",
|
||||
threshold_value=1,
|
||||
# Require the >1-location failure to persist for 5 minutes
|
||||
# before paging. Filters out sub-5-min self-healing blips on
|
||||
# the single min-instance (recycle gap + event-loop stall);
|
||||
# see the HISTORY note above. A sustained hard-down still fires.
|
||||
display_name="No healthy instances",
|
||||
condition_absent=gcp.monitoring.AlertPolicyConditionConditionAbsentArgs(
|
||||
filter='resource.type="cloud_run_revision" AND resource.labels.service_name="karaoke-backend" AND metric.type="run.googleapis.com/container/instance_count"',
|
||||
duration="300s",
|
||||
aggregations=[
|
||||
gcp.monitoring.AlertPolicyConditionConditionThresholdAggregationArgs(
|
||||
alignment_period="1200s",
|
||||
per_series_aligner="ALIGN_NEXT_OLDER",
|
||||
cross_series_reducer="REDUCE_COUNT_FALSE",
|
||||
group_by_fields=["resource.label.host"],
|
||||
gcp.monitoring.AlertPolicyConditionConditionAbsentAggregationArgs(
|
||||
alignment_period="60s",
|
||||
per_series_aligner="ALIGN_MEAN",
|
||||
cross_series_reducer="REDUCE_SUM",
|
||||
),
|
||||
],
|
||||
trigger=gcp.monitoring.AlertPolicyConditionConditionThresholdTriggerArgs(
|
||||
count=1,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -319,7 +218,7 @@ def create_alert_policies(
|
||||
auto_close="1800s",
|
||||
),
|
||||
documentation=gcp.monitoring.AlertPolicyDocumentationArgs(
|
||||
content="Karaoke backend health check (https://api.nomadkaraoke.com/api/health) is failing from multiple checker locations - the API is likely unreachable or erroring.\n\nImmediate actions:\n1. Check Cloud Run logs for crash reasons\n2. Verify recent deployments\n3. Check the Cloudflare edge (api.nomadkaraoke.com) and external dependencies (Modal, AudioShake)\n\nService URL: https://api.nomadkaraoke.com/api/health",
|
||||
content="Karaoke backend service appears to be down - no healthy Cloud Run instances detected.\n\nImmediate actions:\n1. Check Cloud Run logs for crash reasons\n2. Verify recent deployments\n3. Check external dependencies (Modal, AudioShake)\n\nService URL: https://api.nomadkaraoke.com/api/health",
|
||||
mime_type="text/markdown",
|
||||
),
|
||||
enabled=True,
|
||||
|
||||
@@ -886,28 +886,19 @@ class KaraokeFinalise:
|
||||
self.execute_command(ffmpeg_command, "Remuxing video with instrumental audio")
|
||||
|
||||
def convert_mov_to_mp4(self, input_file, output_file):
|
||||
"""Convert the source "With Vocals" video (MOV/MKV) to a standard, portable MP4.
|
||||
|
||||
Produces the "(With Vocals).mp4" sing-along deliverable — a leaf output (no
|
||||
later encode reads it). ``-preset veryfast`` roughly halves this stage (the
|
||||
longest finalization stage) with negligible quality impact for karaoke content;
|
||||
AAC 320k keeps the audio portable. yuv420p (playback compatibility) comes from
|
||||
``self.mp4_flags``, which already carries ``-pix_fmt yuv420p``. Kept in sync
|
||||
with LocalEncodingService.convert_mov_to_mp4 (whose MP4_FLAGS lacks pix_fmt, so
|
||||
that variant sets ``-pix_fmt yuv420p`` explicitly).
|
||||
"""
|
||||
# Hardware-accelerated version (pix_fmt yuv420p supplied via self.mp4_flags)
|
||||
"""Convert MOV file to MP4 format with hardware acceleration support"""
|
||||
# Hardware-accelerated version
|
||||
gpu_command = (
|
||||
f'{self.ffmpeg_base_command} {self.hwaccel_decode_flags} -i "{input_file}" '
|
||||
f'-c:v {self.video_encoder} {self.get_nvenc_quality_settings("high")} -c:a {self.aac_codec} -ar 48000 -b:a 320k {self.mp4_flags} "{output_file}"'
|
||||
f'-c:v {self.video_encoder} {self.get_nvenc_quality_settings("high")} -c:a {self.aac_codec} -ar 48000 {self.mp4_flags} "{output_file}"'
|
||||
)
|
||||
|
||||
|
||||
# Software fallback version
|
||||
cpu_command = (
|
||||
f'{self.ffmpeg_base_command} -i "{input_file}" '
|
||||
f'-c:v libx264 -preset veryfast -c:a {self.aac_codec} -ar 48000 -b:a 320k {self.mp4_flags} "{output_file}"'
|
||||
f'-c:v libx264 -c:a {self.aac_codec} -ar 48000 {self.mp4_flags} "{output_file}"'
|
||||
)
|
||||
|
||||
|
||||
self.execute_command_with_fallback(gpu_command, cpu_command, "Converting MOV video to MP4")
|
||||
|
||||
def encode_lossless_mp4(self, title_mov_file, karaoke_mp4_file, env_mov_input, ffmpeg_filter, output_file):
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "karaoke-gen"
|
||||
version = "0.196.4"
|
||||
version = "0.195.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"
|
||||
|
||||
@@ -138,11 +138,11 @@ def test_convert_mov_to_mp4_aac(mock_execute_fallback, finaliser_with_aac):
|
||||
|
||||
expected_gpu_cmd = (
|
||||
f'{finaliser_with_aac.ffmpeg_base_command} -i "{WITH_VOCALS_MOV}" '
|
||||
f'-c:v libx264 -preset p4 -tune hq -cq 18 -c:a aac -ar 48000 -b:a 320k {finaliser_with_aac.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
f'-c:v libx264 -preset p4 -tune hq -cq 18 -c:a aac -ar 48000 {finaliser_with_aac.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
)
|
||||
expected_cpu_cmd = (
|
||||
f'{finaliser_with_aac.ffmpeg_base_command} -i "{WITH_VOCALS_MOV}" '
|
||||
f'-c:v libx264 -preset veryfast -c:a aac -ar 48000 -b:a 320k {finaliser_with_aac.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
f'-c:v libx264 -c:a aac -ar 48000 {finaliser_with_aac.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
)
|
||||
mock_execute_fallback.assert_called_once_with(expected_gpu_cmd, expected_cpu_cmd, "Converting MOV video to MP4")
|
||||
|
||||
@@ -153,11 +153,11 @@ def test_convert_mov_to_mp4_aac_at(mock_execute_fallback, finaliser_with_aac_at)
|
||||
|
||||
expected_gpu_cmd = (
|
||||
f'{finaliser_with_aac_at.ffmpeg_base_command} -i "{WITH_VOCALS_MOV}" '
|
||||
f'-c:v libx264 -preset p4 -tune hq -cq 18 -c:a aac_at -ar 48000 -b:a 320k {finaliser_with_aac_at.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
f'-c:v libx264 -preset p4 -tune hq -cq 18 -c:a aac_at -ar 48000 {finaliser_with_aac_at.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
)
|
||||
expected_cpu_cmd = (
|
||||
f'{finaliser_with_aac_at.ffmpeg_base_command} -i "{WITH_VOCALS_MOV}" '
|
||||
f'-c:v libx264 -preset veryfast -c:a aac_at -ar 48000 -b:a 320k {finaliser_with_aac_at.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
f'-c:v libx264 -c:a aac_at -ar 48000 {finaliser_with_aac_at.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
)
|
||||
mock_execute_fallback.assert_called_once_with(expected_gpu_cmd, expected_cpu_cmd, "Converting MOV video to MP4")
|
||||
|
||||
@@ -398,11 +398,11 @@ def test_convert_mov_to_mp4_aac_nvenc(mock_execute_fallback, finaliser_with_nven
|
||||
|
||||
expected_gpu_cmd = (
|
||||
f'{finaliser_with_nvenc_aac.ffmpeg_base_command} {finaliser_with_nvenc_aac.hwaccel_decode_flags} -i "{WITH_VOCALS_MOV}" '
|
||||
f'-c:v h264_nvenc -preset p4 -tune hq -cq 18 -c:a aac -ar 48000 -b:a 320k {finaliser_with_nvenc_aac.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
f'-c:v h264_nvenc -preset p4 -tune hq -cq 18 -c:a aac {finaliser_with_nvenc_aac.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
)
|
||||
expected_cpu_cmd = (
|
||||
f'{finaliser_with_nvenc_aac.ffmpeg_base_command} -i "{WITH_VOCALS_MOV}" '
|
||||
f'-c:v libx264 -preset veryfast -c:a aac -ar 48000 -b:a 320k {finaliser_with_nvenc_aac.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
f'-c:v libx264 -c:a aac {finaliser_with_nvenc_aac.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
)
|
||||
mock_execute_fallback.assert_called_once_with(expected_gpu_cmd, expected_cpu_cmd, "Converting MOV video to MP4")
|
||||
|
||||
@@ -414,11 +414,11 @@ def test_convert_mov_to_mp4_aac_at_nvenc(mock_execute_fallback, finaliser_with_n
|
||||
|
||||
expected_gpu_cmd = (
|
||||
f'{finaliser_with_nvenc_aac_at.ffmpeg_base_command} {finaliser_with_nvenc_aac_at.hwaccel_decode_flags} -i "{WITH_VOCALS_MOV}" '
|
||||
f'-c:v h264_nvenc -preset p4 -tune hq -cq 18 -c:a aac_at -ar 48000 -b:a 320k {finaliser_with_nvenc_aac_at.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
f'-c:v h264_nvenc -preset p4 -tune hq -cq 18 -c:a aac_at {finaliser_with_nvenc_aac_at.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
)
|
||||
expected_cpu_cmd = (
|
||||
f'{finaliser_with_nvenc_aac_at.ffmpeg_base_command} -i "{WITH_VOCALS_MOV}" '
|
||||
f'-c:v libx264 -preset veryfast -c:a aac_at -ar 48000 -b:a 320k {finaliser_with_nvenc_aac_at.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
f'-c:v libx264 -c:a aac_at {finaliser_with_nvenc_aac_at.mp4_flags} "{OUTPUT_FILES["with_vocals_mp4"]}"'
|
||||
)
|
||||
mock_execute_fallback.assert_called_once_with(expected_gpu_cmd, expected_cpu_cmd, "Converting MOV video to MP4")
|
||||
|
||||
|
||||
Reference in new issue
Block a user