You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ProjectCodeGenerator.generate_project creates a temporary project directory and
hands the path back to its caller. If scaffolding raises, the handler logs and
re-raises without removing the directory, so the path is never returned and the
directory has no owner.
Aspect
Detail
File
src/youtube_extension/backend/code_generator.py
Directory created
tempfile.mkdtemp(prefix="uvai_project_")
Handler
except Exception as e: logger.error(...); raise (L276-278)
The caller at backend/services/video_processing_service.py:380 reads generation_result["project_path"] at L390, so it never learns the path when the
call raises. There is no rmtree anywhere in that module.
This is deliberately not fixed in #1251. That PR restores cancellation
atomicity after moving scaffolding writes onto worker threads, and it covers the CancelledError path only. The generic-exception leak is older, is not caused by
that change, and touching the shared handler risks altering existing failure
expectations. Splitting it keeps the perf change reviewable.
Acceptance criteria
A scaffolding failure removes the directory generate_project created.
The original exception still propagates unchanged; cleanup never masks it.
A regression test forces a real failure (no mocks on the mechanism under test)
and asserts no uvai_project_* directory survives.
Proposed fix
Reuse the helpers introduced in #1251: on the exception path, await _discard_project_dir(project_path) before re-raising, guarded so a cleanup
failure cannot replace the original exception.
Problem
ProjectCodeGenerator.generate_projectcreates a temporary project directory andhands the path back to its caller. If scaffolding raises, the handler logs and
re-raises without removing the directory, so the path is never returned and the
directory has no owner.
src/youtube_extension/backend/code_generator.pytempfile.mkdtemp(prefix="uvai_project_")except Exception as e: logger.error(...); raise(L276-278)The caller at
backend/services/video_processing_service.py:380readsgeneration_result["project_path"]at L390, so it never learns the path when thecall raises. There is no
rmtreeanywhere in that module.Reachability evidence
Same endpoint verified in #1239 and #1250.
Scope note
This is deliberately not fixed in #1251. That PR restores cancellation
atomicity after moving scaffolding writes onto worker threads, and it covers the
CancelledErrorpath only. The generic-exception leak is older, is not caused bythat change, and touching the shared handler risks altering existing failure
expectations. Splitting it keeps the perf change reviewable.
Acceptance criteria
generate_projectcreated.the
_run_to_completion/_discard_project_dirhelpers added in perf: batch project scaffolding disk writes off the event loop #1251.and asserts no
uvai_project_*directory survives.Proposed fix
Reuse the helpers introduced in #1251: on the exception path,
await _discard_project_dir(project_path)before re-raising, guarded so a cleanupfailure cannot replace the original exception.