Skip to content

fix(ingestion): do not delete ingest files when chunk processing fails - #57

Merged
jamiepine merged 1 commit into
spacedriveapp:mainfrom
sookochoff:fix/ingest-do-not-delete-on-failure
Feb 19, 2026
Merged

fix(ingestion): do not delete ingest files when chunk processing fails#57
jamiepine merged 1 commit into
spacedriveapp:mainfrom
sookochoff:fix/ingest-do-not-delete-on-failure

Conversation

@sookochoff

Copy link
Copy Markdown
Contributor

Summary

Fixes a data-loss bug in ingestion where source files were deleted even when one or more chunks failed to process.

Root cause

tracked chunk failures via , and marked as , but still unconditionally:

  • deleted chunk progress (), and
  • deleted the source file from .

That made retries impossible and could lose user data when providers/API calls failed mid-ingestion.

Changes

  • Keep existing final status update ( vs )
  • If any chunk failed:
    • keep the source file in
    • keep chunk progress rows for resume
    • return early after logging a warning
  • Only on full success:
    • delete chunk progress
    • delete source file

Why this is safe

This preserves the intended resumable-ingestion behavior (already-completed chunks are skipped on restart/poll) and prevents data loss on transient provider failures.

Fixes #48

When any chunk fails (e.g. provider 401/429), keep the source file and
chunk progress rows so the next poll cycle can resume cleanly. Previously
the file was unconditionally deleted even on failure, causing data loss.

Adds two unit tests covering the failure and success flag paths.

Fixes spacedriveapp#48
@sookochoff
sookochoff force-pushed the fix/ingest-do-not-delete-on-failure branch from 666e6d5 to 561681c Compare February 19, 2026 15:38
@jamiepine
jamiepine merged commit 86295f8 into spacedriveapp:main Feb 19, 2026
rktmeister pushed a commit to rktmeister/spacebot that referenced this pull request Mar 11, 2026
…-delete-on-failure

fix(ingestion): do not delete ingest files when chunk processing fails
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.

Bug: Ingest files still get deleted even if ingestion fails

2 participants