mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
fix(tenant): second Dropbox pass keeps the tenant track-code prefix (v0.273.2) (#1159)
## Summary Found by verifying a real Vocal Star portal job in prod after #1158 (job `0976cc34`, code `E2E4635623`). The delivery folder had **both** `E2E4635623 - Artist - Title (…)` and plain `Artist - Title (…)` copies of every file. The cause: `video_worker._handle_native_distribution` re-uploads the folder after the orchestrator (adding `stems/` and `lyrics/`, with `skip_unchanged`) without the tenant filename prefix. It now passes `filename_prefix=tenant_track_code_prefix(job)`, so both passes write the same names. The unchanged-skip then also matches, so files aren't uploaded twice. ## Testing - New test: the post-orchestrator pass passes the tenant prefix. - Backend: 6069 passed (emulator tests excluded locally). - Local CodeRabbit with `--fresh`: no findings. - Will re-verify with a real prod job after deploy by listing the Dropbox folder. @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Gp5fBmsmWJxgkEHb4JfhXR Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
621077474e
commit
182b4eace4
3 files changed
+28
-1
No files matched your search
@@ -1331,6 +1331,28 @@ class TestLegacyDiscordAndBrandCode:
|
||||
assert result["brand_code"] == "NOMAD-1234"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_native_distribution_second_pass_keeps_tenant_prefix(self):
|
||||
"""The post-orchestrator Dropbox pass must use the same "<CODE> - " names, or
|
||||
it adds an unprefixed copy of every file next to the prefixed ones."""
|
||||
from backend.workers import video_worker
|
||||
|
||||
job = _job(review_token=None, state_data={})
|
||||
job.keep_brand_code = "VS6588"
|
||||
job.tenant_id = "vocalstar"
|
||||
result = {"brand_code": None}
|
||||
dist = SimpleNamespace(dropbox_path="/T/Tracks-VocalStar", brand_prefix="VSTAR", gdrive_folder_id=None,
|
||||
enable_youtube_upload=False)
|
||||
dropbox = MagicMock(is_configured=True)
|
||||
with patch("backend.services.job_defaults_service.get_effective_distribution_for_job", return_value=dist), \
|
||||
patch("backend.services.dropbox_service.get_dropbox_service", return_value=dropbox):
|
||||
await video_worker._handle_native_distribution(
|
||||
job_id="job123", job=job, job_log=MagicMock(), job_manager=MagicMock(),
|
||||
temp_dir="/tmp/x", result=result, storage=None,
|
||||
)
|
||||
assert dropbox.upload_folder.call_args.kwargs["filename_prefix"] == "VS6588 - "
|
||||
|
||||
|
||||
# --- R2#9: admin delete-outputs uses the shared helpers ---------------------------------
|
||||
|
||||
class TestDeleteOutputsSharedHelpers:
|
||||
|
||||
@@ -1308,10 +1308,15 @@ async def _handle_native_distribution(
|
||||
# The orchestrator already uploaded this folder minus stems/ and
|
||||
# lyrics/ (prepared just above) — only send what's new or changed
|
||||
# instead of re-uploading every file a second time.
|
||||
from backend.workers.video_worker_orchestrator import tenant_track_code_prefix
|
||||
|
||||
dropbox.upload_folder(
|
||||
temp_dir, remote_folder,
|
||||
exclude_suffixes=dropbox_skip_suffixes_for(dropbox_path),
|
||||
skip_unchanged=True,
|
||||
# Same names as the orchestrator's pass (tenant "<CODE> - " prefix),
|
||||
# or this pass would add an unprefixed copy of every file.
|
||||
filename_prefix=tenant_track_code_prefix(job),
|
||||
)
|
||||
|
||||
# Create sharing link
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "karaoke-gen"
|
||||
version = "0.273.1"
|
||||
version = "0.273.2"
|
||||
description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens."
|
||||
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
|
||||
license = "MIT"
|
||||
|
||||
Reference in new issue
Block a user