Skip to content

Fix silent loss of completed Extend results#132

Draft
Paul (nuclearspike) wants to merge 1 commit into
Lightricks:mainfrom
nuclearspike:codex/fix-extend-result-delivery
Draft

Fix silent loss of completed Extend results#132
Paul (nuclearspike) wants to merge 1 commit into
Lightricks:mainfrom
nuclearspike:codex/fix-extend-result-delivery

Conversation

@nuclearspike

Copy link
Copy Markdown

Summary

  • make completed Extend result persistence transactional
  • retain the generation recovery marker until the project asset write succeeds
  • surface persistence failures to the user while preserving the automatic retry path
  • fail explicitly when addAsset targets a project that no longer exists

Bug report

Extending a local video could finish successfully in the backend but produce no visible result and no failure notice in the UI.

The captured session showed:

  1. the Extend generation completed successfully
  2. the backend saved the output MP4
  3. Electron copied the MP4 into the project asset directory
  4. Electron generated both thumbnails
  5. no asset appeared in the project and no error was shown

Expected behavior: the completed video appears as a generated Extend asset. If the project write fails, the user receives an error and the completed generation remains recoverable.

Root cause

The Extend completion effect cleared its submission context and removed ltx-generation-recovery before awaiting the asset copy and project write. The asynchronous import also had no catch boundary.

That left a silent-loss window: a project storage failure after the video and thumbnails were created could strand a valid result while also removing the only recovery path. In addition, ProjectContext.addAsset returned a new asset even when mutateProject returned null, so a missing project looked like a successful write.

Fix

  • deduplicate in-flight persistence for a completed Extend result
  • wrap the full copy/write sequence in error handling
  • clear the submission context and recovery marker only after addAsset succeeds
  • keep the recovery marker on failure so the background watcher can retry
  • show a generation failure instead of silently dropping the result
  • throw from addAsset when the target project cannot be loaded

Validation

  • pnpm typecheck
  • pnpm build:frontend
  • pnpm backend:test — 567 passed
  • manual Electron success path using a deterministic Extend response and the real file-copy/thumbnail IPC:
    • Extend asset added with the expected generation metadata and duration
    • recovery marker removed after the project write
  • manual storage-failure injection:
    • precise persistence error logged
    • visible failure dialog shown
    • recovery marker retained for retry

The manual regression fixture and copied media were removed after validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant