Xuanwo opened a new pull request, #9246: URL: https://github.com/apache/opendal/pull/9246
# Which issue does this PR close? Part of #9182. # Rationale for this change Alibaba Cloud OSS computes an unsigned decimal CRC64-ECMA (CRC-64/XZ, added to `opendal-core` in #9240 as `ChecksumAlgo::Crc64Ecma`) for uploaded objects and parts and returns it in the `x-oss-hash-crc64ecma` response header. Supporting `WriteChecksum::Any` and `WriteChecksum::Fast` lets callers opt into native end-to-end write checksum verification on OSS under RFC-9166 without buffering whole payloads. Because OSS returns this checksum as a response receipt after receiving a single PUT or completing a multipart upload rather than enforcing a caller-supplied pre-commit whole-object digest, OSS supports only `Any` and `Fast` and rejects `Algo` and `Expected` before I/O. # What changes are included in this PR? - Scope `Capability::write_with_checksum` in `OssBuilder` to signed (`!skip_signature`), `https://` requests targeting standard OSS regional endpoints (`oss-<region>.aliyuncs.com`, with optional `:443`, under virtual-host or path addressing). Custom endpoints, CNAME addressing, `http://` endpoints, and `skip_signature` report `write_with_checksum: false`. Describe `oss_can_checksum` in `dev/src/generate/capabilities_docs.rs` and regenerate `website/data/capabilities.json`. - Validate checksum intents synchronously before I/O in `OssWriter::new` and `OssBackend::presign`: accept `WriteChecksum::Any` and `WriteChecksum::Fast` on non-append writes when `write_with_checksum` is enabled, and return `Unsupported` for `WriteChecksum::Algo`, `WriteChecksum::Expected`, checksum intents on append or presigned writes, and checksum intents when `write_with_checksum` is `false`. - Verify single-PUT writes (`write_once`) by computing CRC-64/XZ over the uploaded buffer with `crc-fast`, checking the single ASCII-digit `x-oss-hash-crc64ecma` header on `200 OK` / `201 Created`, and populating `Metadata::checksum()` with `ChecksumAlgo::Crc64Ecma` while retaining ETag, Content-MD5, and version metadata. - Verify multipart writes by checking each `UploadPart` `x-oss-hash-crc64ecma` receipt before accepting its ETag: missing or invalid receipts return non-temporary `Unexpected`, while mismatched receipts return temporary `ChecksumMismatch` so the staged part can be retried before completion. Combine verified part CRCs and byte lengths in manifest order via `checksum_combine(CrcAlgorithm::Crc64Xz, ...)` and verify the `CompleteMultipartUpload` receipt. - Enforce post-publication non-replay on checked terminal writes in `OssWriter::finish_write` (refactoring `OssCore::oss_complete_multipart_upload_request` to return `Request<Buffer>` and updating `OssMultipartCopy` to sign and send it): once `PutObject` (`200`/`201`) or `CompleteMultipartUpload` (`200`) receives an accepted status, `final_response_received` is set before reading the response body. A response-body read failure or missing/invalid/mismatched receipt returns a non-temporary `Unexpected` error noting that the object may already be visible, subsequent calls on the same writer fail permanently instead of replaying the final write, and `abort_part` treats `404 NotFound` as `Ok(())` when `final_response_received` is set. - Update `core/services/oss/src/docs.md`, add `crc-fast` to `core/services/oss/Cargo.toml`, update `core/Cargo.lock` and `bindings/ruby/Cargo.lock`, add unit tests for endpoint capability scoping (`backend.rs`) and post-200 lost response body non-replay (`writer.rs`), and register `test_oss_writer_with_fast_checksum` in `core/tests/behavior/async_write.rs`. Managed Alibaba Cloud OSS verification against a regional HTTPS fixture covered: - On signed commit `1e5bb2bb71`: repository behavior tests `test_write_with_any_checksum`, `test_oss_writer_with_fast_checksum` (concurrent unequal multipart parts, final `Crc64Ecma` digest, and readback), and `test_copy_with_chunk`, plus capability catalog regeneration and locked core/Ruby dependency resolution. - On the byte-identical OSS service implementation (`92cdbcec73`): empty `Any` PUT, 9-byte `Fast` PUT, plain write without checksum, out-of-order multipart upload with single part-1 retry on a locally perturbed receipt and ordered `[1, 2]` completion, client-side post-200 receipt/body failure perturbations under `RetryLayer` confirming non-temporary `Unexpected`, single terminal request, and `abort_part` 404 handling, pre-publication malformed-part abort preserving the prior object and closing the upload, zero-I/O `Unsupported` rejections for `Algo`, `Expected`, append, and presign, and zero leftover objects or uploads after cleanup. Fixture limits: the managed OSS fixture bucket was unversioned (live metadata checks verified preservation of headers OSS returned rather than multi-version behavior), receipt/body failure perturbations after HTTP 200 were injected client-side on real OSS 200 responses and in local unit tests, and the non-replay guarantee starts once OpenDAL receives the accepted HTTP status. Live testing covered static unencoded payloads at one standard regional HTTPS OSS endpoint (`oss-*.aliyuncs.com`), not custom, CNAME, or `http://` endpoints. # Are there any user-facing changes? `services::Oss` advertises `write_with_checksum: true` for signed requests to standard OSS regional HTTPS endpoints (`oss-<region>.aliyuncs.com`, virtual-host or path addressing) and supports `WriteChecksum::Any` and `WriteChecksum::Fast` on non-append writes, returning `ChecksumAlgo::Crc64Ecma` in `Metadata::checksum()`. Custom domains, CNAME addressing, `http://` endpoints, and `skip_signature` keep `write_with_checksum: false`. `WriteChecksum::Algo`, `WriteChecksum::Expected`, and checksum intents on append or presigned writes return `Unsupported` before I/O. For checked single-PUT and multipart completion requests, OSS returns the checksum receipt after publishing the object: if the response body fails to read or the final receipt is missing, invalid, or mismatched after an accepted HTTP status, OpenDAL returns a non-temporary `Unexpected` error, the object may already be visible, and subsequent calls on the same writer will not replay the final request. Updated `core/services/oss/src/docs.md` and `website/data/capabilities.json`. # Breaking changes # AI Usage Statement - **Harness** `pi` via T3 Code · **Model** `magpie/codex/gpt-6.2-astra` · **Effort** `high` · **Role** Scoped native OSS `Any`/`Fast` write checksum verification for #9182, coordinated implementation, integration, independent review, and publication, and verified resolution of the `async_write.rs` test-registration conflict. - **Harness** `pi` via T3 Code · **Model** `magpie/codex/gpt-6.2-sol` · **Effort** `max` · **Role** Implemented OSS CRC64-ECMA receipt verification, endpoint/capability scoping, unit and behavior tests, docs, and catalog/lockfile updates; integrated the signed candidate onto `main`; and ran managed Alibaba Cloud OSS fixture validation and catalog/lockfile checks. - **Harness** `pi` via T3 Code · **Model** `magpie/codex/gpt-6.2-sol` · **Effort** `high` · **Role** Independently reviewed the OSS service implementation and live validation evidence on candidate `92cdbcec73`, verified its GPG signature, and identified the `core/tests/behavior/async_write.rs` test-registration merge conflict with #9241. - **Harness** `pi` via T3 Code · **Model** `magpie/agy-cli/gemini-4-neon` · **Effort** `high` · **Role** Verified the integrated signed candidate `1e5bb2bb71`, checked duplicates and GitHub Actions queue state, and drafted and published this PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
