refactor(tools): extraer worker de upscale - #133
Conversation
|
@cursor review |
PR Review — Loreframe StudioRisk: low Automated review from Findings
Changed files
CONTRIBUTING checklist
Posted by the repo PR review workflow. Re-runs on each push to the PR. |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 27e5432. Configure here.
Code healthQuality score: 49.2/100Higher is better. The score is a trend dashboard; the independent ratchet below remains the CI gate.
Change vs PR base: +0.2 points.
Markdown, JSON catalogs and tests are out of this table. Only Most complex functions
Trend vs baseline
Warnings
Ratchet passed. |
|
@cursor review after complexity split |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Image upscale fails on start
- Removed the extra job=None argument so the image-path lambda no longer forwards job twice into update_job.
Or push these changes by commenting:
@cursor push a1f397b3f8
Preview (a1f397b3f8)
diff --git a/app/services/tools_upscale.py b/app/services/tools_upscale.py
--- a/app/services/tools_upscale.py
+++ b/app/services/tools_upscale.py
@@ -98,7 +98,7 @@
def _upscale_image_job(
*, source_path, out_dir, source_filename, method, params, wgp, abort, progress, update_job
):
- if not update_job(job=None, message="Upscaling image...", phase="Upscaling", progress=5):
+ if not update_job(message="Upscaling image...", phase="Upscaling", progress=5):
return None, None
final_path = wgp.get_available_filename(
out_dir, source_filename, "_upscaled", force_extension=".png"You can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 82a71cb. Configure here.
| def _upscale_image_job( | ||
| *, source_path, out_dir, source_filename, method, params, wgp, abort, progress, update_job | ||
| ): | ||
| if not update_job(job=None, message="Upscaling image...", phase="Upscaling", progress=5): |
There was a problem hiding this comment.
Image upscale fails on start
High Severity
_upscale_image_job calls update_job with job=None, but the image path already binds the real job in a lambda. That forwards job twice into the lifecycle helper, so still-image upscales raise TypeError immediately and never start processing.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 82a71cb. Configure here.
The image helper already receives a lambda that binds the live job. Passing job=None forwarded the argument twice into update_job and raised TypeError before any still-image processing started. Co-authored-by: THEINAOG <IAnMove@users.noreply.github.com>



Qué cambia
app/services/tools_upscale.py._launch_runtime.pyy conserva la resolución de fuentes, coordinación GPU, progreso, cancelación, sidecars y lifecycle._launch_runtime, FastAPI ni inicializa WanGP.Qué no cambia
wgp.py, modelos vendor, generación real ni configuración de Pinokio.Validación local
PYTHON=app/env/bin/python bash scripts/validate_local.shorigin/main, 605 tests UI, lint, build y 7 E2E simulados.py_compileOK.Note
Medium Risk
Large refactor of GPU upscale job orchestration with behavior preserved mostly by copy-paste; any wiring mistake in the injected
runtimemap or error-path differences (e.g. missing source now raisesFileNotFoundError) could affect production upscale jobs.Overview
Moves the full Tools upscale implementation (image still path, FlashVSR chunked video, Lanczos, audio remux, sidecars, cancel/progress) out of
_launch_runtime.pyinto newapp/services/tools_upscale.py, with shared constants (TOOL_UPSCALE_METHODS,TOOL_SOURCE_EXTENSIONS) living in the service._launch_runtime.pykeeps the HTTP contract: it re-exports those constants for validation, turns_upscale_tool_imageand_run_tool_upscaleinto thin facades that calltools_upscale.upscale_image/run_tool_upscale, and passes aruntimemap (jobs,wgp, GPU slot, lifecycle helpers, chunked FlashVSR, path resolution, sidecar writer). The service is meant to be testable without importing the launch bootstrap or FastAPI.Tests now AST-check
run_tool_upscaleand helpers in the service module, assert the launch worker only delegates torun_tool_upscale, and extend job-lifecycle wiring to count lifecycle hooks via the injectedruntimekeys.Reviewed by Cursor Bugbot for commit 82a71cb. Configure here.