Skip to content

fix: report accurate progress statistics on export batch failure#326

Open
YunchuWang wants to merge 1 commit into
mainfrom
copilot-finds/bug/fix-batch-failure-progress-stats
Open

fix: report accurate progress statistics on export batch failure#326
YunchuWang wants to merge 1 commit into
mainfrom
copilot-finds/bug/fix-batch-failure-progress-stats

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Fixes #213.

The export job orchestrator reported zero progress statistics when a batch failed. This ensures accurate progress counts are reported on batch failure.


Opens the existing fix branch copilot-finds/bug/fix-batch-failure-progress-stats as a PR (automated triage of active [copilot-finds] issues that had a ready fix branch but no open PR).

… batch failure

When a batch of export activities fails after exhausting all retry attempts,
the orchestrator commits a checkpoint with scannedInstances=0 and
exportedInstances=0. This discards the actual work done: the number of
instances that were scanned and the number that were successfully exported
before the batch was marked as failed.

The entity accumulates these counters via addition, so reporting 0 means
the job's progress statistics undercount the real work, giving operators
inaccurate progress data.

Fix: Use the actual scannedCount and batchResult.exportedCount values in
the failure-path checkpoint, matching the success-path behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 16:39
instanceIds: ["inst-1", "inst-2", "inst-3", "inst-4", "inst-5"],
nextCheckpoint: { lastInstanceKey: "inst-5" },
};
stepResult = await gen.next(pageResult);
}

// Resume the generator (receives the array of results from whenAll)
stepResult = await gen.next(attempt1Results);
const timerCalls = getCallsByType(ctx._calls, "createTimer");
expect(timerCalls.length).toBeGreaterThanOrEqual(1);
timerCalls[timerCalls.length - 1].task!.complete(undefined);
stepResult = await gen.next(undefined);
for (let i = 0; i < newExportCalls2.length; i++) {
newExportCalls2[i].task!.complete(attempt2Results[i]);
}
stepResult = await gen.next(attempt2Results);
// Step 7: Backoff timer for retry attempt 3
const timerCalls2 = getCallsByType(ctx._calls, "createTimer");
timerCalls2[timerCalls2.length - 1].task!.complete(undefined);
stepResult = await gen.next(undefined);
for (let i = 0; i < newExportCalls3.length; i++) {
newExportCalls3[i].task!.complete(attempt3Results[i]);
}
stepResult = await gen.next(attempt3Results);

Copilot AI 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.

Pull request overview

This PR fixes progress reporting for the export job orchestrator in @microsoft/durabletask-js-export-history so that, when an export batch ultimately fails after retries, the checkpoint records the actual scanned/exported counts instead of hardcoded zeros (addressing Issue #213).

Changes:

  • Update failure-path checkpoint commits to use scannedCount and batchResult.exportedCount.
  • Add orchestrator-level Jest coverage to validate progress statistics in success and failure scenarios (including partial success before final failure).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/durabletask-js-export-history/src/orchestrators/export-job-orchestrator.ts Fixes failure-path checkpoint to persist accurate scanned/exported progress counts.
packages/durabletask-js-export-history/test/export-job-orchestrator.spec.ts Adds tests that assert correct checkpoint progress reporting for batch success and batch failure after retries.

Comment on lines +18 to +20
import { EntityInstanceId } from "@microsoft/durabletask-js";
import { CompletableTask } from "../../durabletask-js/src/task/completable-task";

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.

[copilot-finds] Bug: Export job orchestrator reports zero progress statistics on batch failure

3 participants