Skip to content

fix: only swallow not-found export deletion errors#312

Open
YunchuWang wants to merge 1 commit into
microsoft:mainfrom
YunchuWang:copilot-finds/bug/fix-delete-bare-catch-swallows-errors
Open

fix: only swallow not-found export deletion errors#312
YunchuWang wants to merge 1 commit into
microsoft:mainfrom
YunchuWang:copilot-finds/bug/fix-delete-bare-catch-swallows-errors

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

  • Treat gRPC NOT_FOUND as the idempotent delete case.
  • Re-throw authentication, network, and other unexpected deletion errors.
  • Add focused export history client coverage.

Fixes #212

Testing

  • npm test -w @microsoft/durabletask-js-export-history -- --runTestsByPath test/export-history-client-delete.spec.ts
  • npm run build -w @microsoft/durabletask-js-export-history

Replace bare catch {} that silently swallowed all errors (including
network failures, auth errors, and timeouts) with a targeted catch
that only swallows gRPC NOT_FOUND errors. All other errors are now
re-thrown so callers can handle or report them.

Add isNotFoundError() helper using duck typing to check gRPC status
code without requiring a direct @grpc/grpc-js dependency.

Add comprehensive unit tests for the delete() error handling path.

Fixes microsoft#212

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 17, 2026 16:40

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 error handling in the export-history package’s ExportHistoryJobClient.delete() so it only treats gRPC NOT_FOUND as the idempotent delete case and rethrows unexpected cleanup failures, improving correctness and operational visibility.

Changes:

  • Update delete() to swallow only gRPC NOT_FOUND errors during orchestration cleanup and rethrow all other errors.
  • Add a local isNotFoundError() helper (duck-typed) to avoid introducing a direct @grpc/grpc-js dependency.
  • Add targeted Jest coverage for delete/cleanup error scenarios (NOT_FOUND vs network/auth/timeout/other).

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/client/export-history-client.ts Restricts delete cleanup error swallowing to gRPC NOT_FOUND via a local helper and rethrows other failures.
packages/durabletask-js-export-history/test/export-history-client-delete.spec.ts Adds focused unit tests validating delete() behavior for NOT_FOUND vs unexpected gRPC/timeout/plain errors.

Comment on lines +42 to +45
const TEST_STORAGE_OPTIONS: ExportHistoryStorageOptions = {
connectionString: "DefaultEndpointsProtocol=https;AccountName=test;AccountKey=key;EndpointSuffix=core.windows.net",
containerName: "test-container",
};
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: ExportHistoryJobClient.delete() bare catch swallows network and auth errors

3 participants