Skip to content

fix(core): omit unreported delete counts from errors - #9223

Merged
Xuanwo merged 1 commit into
mainfrom
xuanwo/publish-reviewed-error-context-fix
Nov 27, 2026
Merged

Xuanwo merged 1 commit into
mainfrom
xuanwo/publish-reviewed-error-context-fix

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Nov 26, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #9198.

Rationale for this change

ErrorContextWrapper<T: oio::Delete> attached .with_context("deleted", self.processed.to_string()) on both delete() and close() errors (core/core/src/layers/error_context.rs), while never incrementing self.processed. As a result, every delete or close error received a bogus deleted: 0 entry. Because Error::with_context appends (key, value) pairs without overwriting existing keys, ErrorContextWrapper also appended a conflicting second deleted: 0 when an underlying deleter reported its own deleted count.

Incrementing self.processed on oio::Delete::delete success would still be misleading: under the oio::Delete contract (core/core/src/raw/oio/delete/api.rs), a successful delete() return only means the deleter accepted the request—deleters may buffer requests for batch deletion, so accepted requests are not durable deletion progress. Omitting the wrapper-injected deleted field leaves progress reporting to the underlying deleter while preserving Operation::Delete, service, path (on delete()), and all lower-level diagnostics.

What changes are included in this PR?

  • core/core/src/layers/error_context.rs: Remove .with_context("deleted", self.processed.to_string()) from ErrorContextWrapper<T: oio::Delete>::delete and close, and remove the corresponding deleted bullet from ErrorContextLayer rustdoc.
  • Unit tests (core/core/src/layers/error_context.rs):
    • test_delete_error_omits_unreported_count: verifies delete() errors omit deleted while preserving error kind, message, Operation::Delete, service, path, and inner context (request_id).
    • test_delete_close_error_preserves_reported_count: verifies close() errors preserve error kind, temporary status, message, source, Operation::Delete, service, inner path, called: batch_delete, and a single inner deleted: 1 without appending deleted: 0.

Verification scope

  • Before fix (75966ba464). Both regression tests failed when applied to the baseline. delete() appended deleted: 0, and close() appended a duplicate deleted: 0 alongside inner deleted: 1.
  • Candidate (86b538bc94): All 531 opendal-core unit tests, opendal-core clippy (--all-targets --all-features -- -D warnings), and core/ formatting (cargo fmt --all -- --check) passed.
  • Independent review. The reviewer checked the signed 86b538bc94 and applied its error_context.rs to a separate local checkout at 31b4558934. Both regressions and the 372-test opendal-core suite passed in that checkout.
  • Scope. The regression tests exercise ErrorContextWrapper in process. The reported deleted: 1 comes from the test deleter.

Are there any user-facing changes?

ErrorContextLayer no longer appends the always-zero deleted context entry on delete() and close() errors and removes deleted from ErrorContextLayer rustdoc. Operation::Delete, service, path (on delete()), and lower-level error diagnostics (including any deleted count reported by an underlying deleter) are preserved.

This is a compatible diagnostic fix in opendal-core for the core release package.

Breaking changes

AI Usage Statement

  • Harness: pi (via T3), Model: magpie/codex/gpt-6.2-astra, Effort: high, Role: Triaged fix(core): ErrorContextWrapper<oio::Delete> never increments deleted count #9198 against oio::Delete and ErrorContextLayer, coordinated independent review, and verified commit 86b538bc94 along with the before/after test logs.
  • Harness: pi (via T3), Model: magpie/codex/gpt-6.2-sol, Effort: max, Role: Authored 86b538bc94 (core/core/src/layers/error_context.rs), added the delete() and close() regression unit tests, and ran before/after opendal-core unit tests, clippy, and formatting checks on the candidate. Verified integration with current main and published the signed commit.
  • Harness: pi (via T3), Model: magpie/devin/swe-2-1, Effort: max, Role: Independently reviewed 86b538bc94 and its regression test scope, and exercised the candidate error_context.rs on a separate local checkout (not an exact-head test run).
  • Harness: pi (via T3), Model: magpie/agy-cli/gemini-4-neon, Effort: high, Role: Drafted the PR title and body from 86b538bc94 and the local verification logs.

A deleter may buffer requests before deletion. Leave progress reporting to the underlying deleter and preserve the error context it returns.

Refs #9198
@Xuanwo Xuanwo added core releases-note/fix The PR fixes a bug or has a title that begins with "fix" labels Nov 26, 2026
@github-actions github-actions Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 26, 2026
@Xuanwo
Xuanwo requested a review from PsiACE November 27, 2026 00:00
@Xuanwo
Xuanwo merged commit 1a716b0 into main Nov 27, 2026
120 of 121 checks passed
@Xuanwo
Xuanwo deleted the xuanwo/publish-reviewed-error-context-fix branch November 27, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core releases-note/fix The PR fixes a bug or has a title that begins with "fix" size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(core): ErrorContextWrapper<oio::Delete> never increments deleted count

2 participants