Skip to content

fix: make progressive batch send cleanup unconditional#1099

Merged
ferhatelmas merged 1 commit into
masterfrom
ferhat/progressive-clear
May 12, 2026
Merged

fix: make progressive batch send cleanup unconditional#1099
ferhatelmas merged 1 commit into
masterfrom
ferhat/progressive-clear

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Failure to send progressive batch can prevent cleanup.

What is the new behavior?

Make cleanup unconditional while marking completed as retryable again. It updates the shape of batch to make progress.

Additional context

Add any other context or screenshots.

Copilot AI review requested due to automatic review settings May 11, 2026 13:52
@ferhatelmas ferhatelmas requested a review from a team as a code owner May 11, 2026 13:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes progressive migration scheduling so that a failure to enqueue a batch (RunMigrationsOnTenants.batchSend) no longer prevents queue cleanup/reordering. Instead, enqueue failures are handled inside the batch handler: tenants that would have been marked completed are made retryable again, cleanup always runs, and the failure is logged.

Changes:

  • Wrap RunMigrationsOnTenants.batchSend in a try/catch to keep the flush/drain flow non-fatal and make cleanup unconditional.
  • On batchSend failure, move would-be-completed tenants into the retryable set and log the enqueue error.
  • Update/add tests to reflect the new behavior (flush resolves, correct logging, and correct queue reordering on enqueue failure).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/internal/database/migrations/progressive.ts Catch batchSend failures, re-queue tenants appropriately, and ensure cleanup/reordering runs regardless of enqueue success.
src/internal/database/migrations/progressive.test.ts Adjust expectations to the new non-throwing behavior and add coverage for ordering/dropping behavior when batchSend fails.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link
Copy Markdown

coveralls commented May 11, 2026

Coverage Report for CI Build 25678144436

Coverage decreased (-0.03%) to 74.261%

Details

  • Coverage decreased (-0.03%) from the base build.
  • Patch coverage: 6 of 6 lines across 1 file are fully covered (100%).
  • 3 coverage regressions across 2 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

3 previously-covered lines in 2 files lost coverage.

File Lines Losing Coverage Coverage
src/internal/database/tenant.ts 2 81.76%
src/internal/database/migrations/progressive.ts 1 73.55%

Coverage Stats

Coverage Status
Relevant Lines: 10289
Covered Lines: 8049
Line Coverage: 78.23%
Relevant Branches: 5943
Covered Branches: 4005
Branch Coverage: 67.39%
Branches in Coverage %: Yes
Coverage Strength: 410.87 hits per line

💛 - Coveralls

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@ferhatelmas ferhatelmas force-pushed the ferhat/progressive-clear branch from 4c65bd0 to af84eb1 Compare May 11, 2026 14:59
@ferhatelmas ferhatelmas merged commit 9811219 into master May 12, 2026
18 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/progressive-clear branch May 12, 2026 08:03
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.

4 participants