Skip to content

fix(cleanup): preserve log rows when file deletion fails - #7869

Merged
TheodoreSpeaks merged 1 commit into
stagingfrom
fix/cleanup-preserve-failed-file-logs
Sep 15, 2026
Merged

TheodoreSpeaks merged 1 commit into
stagingfrom
fix/cleanup-preserve-failed-file-logs

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve the current log batch when bounded cleanup encounters a storage or file-metadata deletion failure. Check inside onBatch before the log DELETE, so a later manual run can retry the retained rows.
  • Follow-up to feat(cleanup): add per-type row limits to existing jobs #7842. Keep selected rows charged against the existing budget and stop before processing another log. The production change moves one check.

Type of Change

  • Bug fix

Testing

  • Added regressions using the real batch-delete helper with mocked storage and database calls: thrown storage errors, partial storage failures, metadata errors, subsequent manual retries, and successful deletion order. All three failure cases reproduce on the previous code.
  • 14 focused tests passed; application type-check, lint, 46 repository audits, block-registry audit, and docs-manifest check passed.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 15, 2026 11:41pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the cleanup failure check now prevents log-row deletion when associated file cleanup fails.

Summary

This PR changes bounded workflow-log cleanup so file and metadata deletion failures abort the batch before database log rows are deleted, preserving those rows for a later retry.

  • Moves the failure check into the batch callback immediately after each log’s file cleanup.
  • Adds regression coverage for storage exceptions, partial storage failures, metadata failures, successful ordering, and subsequent retries.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Select bounded log batch] --> B[Delete files and metadata for log]
  B --> C{Any deletion failed?}
  C -->|Yes| D[Abort batch and retain all selected log rows]
  D --> E[Retry during a later cleanup run]
  C -->|No| F{More logs in batch?}
  F -->|Yes| B
  F -->|No| G[Delete log rows from database]
Loading

Reviews (2) · Last reviewed commit: "fix(cleanup): preserve log rows when fil..."

Comment thread apps/sim/background/cleanup-logs-files.test.ts
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@TheodoreSpeaks I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@TheodoreSpeaks
TheodoreSpeaks merged commit 1e7c3dc into staging Sep 15, 2026
33 checks passed
@TheodoreSpeaks
TheodoreSpeaks deleted the fix/cleanup-preserve-failed-file-logs branch September 15, 2026 23:59

This branch was previously deployed

1 inactive deployment
Preview fe1ab9c3 Deployed Sep 15, 2026 by vercel[bot]
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