Xuanwo opened a new pull request, #9272:
URL: https://github.com/apache/opendal/pull/9272

   # Which issue does this PR close?
   
   Refs #9182.
   
   # Rationale for this change
   
   #9182 tracks verified per-write checksums across services. Live Storage v2 
gRPC controls against authenticated `storage.googleapis.com:443` confirmed that 
`WriteObject` verifies full-object CRC32C before commit on single-request and 
resumable uploads, rejects a one-bit mismatch with `INVALID_ARGUMENT`, and 
returns the committed object's CRC32C on both `WriteObject` and 
`QueryWriteStatus`.
   
   This PR enables full-object CRC32C write verification for authenticated 
writes to the default `gcs-grpc` endpoint.
   
   # What changes are included in this PR?
   
   - **Protobuf subset 
(`core/services/gcs-grpc/proto/google/storage/v2/storage.proto`, 
`src/generated/google.storage.v2.rs`)**: Add `ObjectChecksums` (`optional 
fixed32 crc32c`), `WriteObjectRequest.object_checksums`, and 
`Object.checksums`, validated against the pinned upstream googleapis descriptor.
   - **Capability scope and docs (`core/services/gcs-grpc/src/backend.rs`, 
`src/docs.md`, `dev/src/generate/capabilities_docs.rs`, 
`website/data/capabilities.json`)**: Advertise 
`Capability::write_with_checksum` only for authenticated writes 
(`!skip_signature`) to the default `https://storage.googleapis.com:443` 
endpoint, document checksum behavior and ambiguity limits, and regenerate the 
capability catalog.
   - **Full-object CRC32C writes, receipt validation, and ambiguity handling 
(`core/services/gcs-grpc/src/writer.rs`, `core/services/gcs-grpc/Cargo.toml`)**:
     - Support `WriteChecksum::Any`, `WriteChecksum::Fast`, 
`WriteChecksum::Algo(ChecksumAlgo::Crc32c)`, and `WriteChecksum::Expected` with 
a 4-byte CRC32C digest. Reject non-CRC32C algorithms and append with 
`Unsupported`, and malformed CRC32C digests with `ConfigInvalid`, before I/O.
     - Accumulate CRC32C over logically accepted bytes (avoiding double-hashing 
on partial-write retries) and send `object_checksums.crc32c` on the 
`finish_write = true` message for single-request and resumable uploads, 
including empty objects, empty final resumable requests, and multi-message 
single-request writes.
     - Validate returned committed-object receipts (object name, bucket 
resource, positive generation, byte size, and matching CRC32C) before 
populating `Metadata::checksum()`. A missing or inconsistent receipt returns 
non-temporary `Unexpected`, and the object may already be visible.
     - Map recognized `INVALID_ARGUMENT` checksum rejections (`object crc32c 
mismatch ... server computed ... client provided ...`) to non-temporary 
`ChecksumMismatch`.
     - On resumable close retry, query `QueryWriteStatus` for the upload ID to 
verify a committed receipt or continue finalization. On single-request 
checksummed writes, mark finalization failed before the RPC and make RPC errors 
non-temporary so an ambiguous close cannot replay publication without an upload 
ID to query.
   - **Verification**:
     - **Actual GCS (`https://storage.googleapis.com:443`, authenticated)**: 
Direct Storage v2 gRPC controls verified full-object CRC32C commit and 
one-bit-mismatch `INVALID_ARGUMENT` rejection (with zero versions created) 
across single, resumable, single-empty, and resumable-empty-final writes, and 
verified `QueryWriteStatus` returning finalized object metadata with CRC32C for 
completed resumable sessions. Public `Operator` verification on `28a354e779` 
verified `Any`, `Fast`, `Algo(Crc32c)`, `Expected(Crc32c)`, and ordinary writes 
across single and resumable modes (including empty objects, empty final 
resumable requests, and >2 MiB multi-message single writes). Incorrect 
`Expected` digests returned non-temporary `ChecksumMismatch`, left zero 
versions on failed creations, and preserved the exact previous generation and 
original bytes on failed overwrites (confirmed via public gRPC reads and 
independent JSON API version enumeration and generation-pinned downloads).
     - **Scripted in-process gRPC tests 
(`core/services/gcs-grpc/src/mock_tests.rs`)**: Cover partial-write 
continuation at an acknowledged offset, empty-final retry, recovery from a lost 
final response via `QueryWriteStatus`, receipt validation failures, and 
non-replay on ambiguous single-request close. Network loss itself is covered by 
scripted in-process gRPC tests rather than live fault injection; live GCS 
recovery evidence covers `QueryWriteStatus` on completed resumable sessions.
   
   # Are there any user-facing changes?
   
   Authenticated writes to the default `gcs-grpc` endpoint 
(`https://storage.googleapis.com:443`) now advertise 
`Capability::write_with_checksum: true` and support full-object CRC32C for 
`Any`, `Fast`, `Algo(Crc32c)`, and `Expected` with CRC32C on single-request and 
resumable uploads, returning the verified CRC32C in `Metadata::checksum()`. 
Custom or unauthenticated endpoints keep `write_with_checksum: false`. 
Unsupported algorithms return `Unsupported`, malformed digests return 
`ConfigInvalid`, recognized mismatches return non-temporary `ChecksumMismatch`, 
and unconfirmed receipts or ambiguous single-request closes return 
non-temporary errors. Updated `core/services/gcs-grpc/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 GCS gRPC write checksum verification for 
#9182, ran live native Storage v2 gRPC feasibility probes against 
`storage.googleapis.com:443`, and coordinated implementation, review, and 
publication.
   - **Harness** `pi` via T3 Code · **Model** `magpie/codex/gpt-6.2-sol` · 
**Effort** `max` · **Role** Implemented full-object CRC32C write verification, 
protobuf subset update, receipt validation, docs, capability catalog update, 
and in-process gRPC tests (`28a354e779`), and ran the live GCS baseline, 
protocol, and public `Operator` verification.
   - **Harness** `pi` via T3 Code · **Model** `magpie/codex/gpt-6.2-sol` · 
**Effort** `high` · **Role** Independently reviewed signed commit `28a354e779` 
and its live GCS and in-process test evidence.
   - **Harness** `pi` via T3 Code · **Model** `magpie/agy-cli/gemini-4-neon` · 
**Effort** `high` · **Role** Verified the commit signature, merge state, 
evidence, and PR metadata, published this branch, and drafted this PR 
description. Assumptions/unknowns affecting review: capability is limited to 
authenticated `https://storage.googleapis.com:443` because custom or emulated 
endpoints were not verified; lost-response network failures were exercised in 
scripted in-process gRPC tests while live GCS verification covered 
`QueryWriteStatus` on completed resumable sessions; live GCS checksum rejection 
relies on `INVALID_ARGUMENT` message matching because GCS returned no 
structured gRPC status details.
   


-- 
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]

Reply via email to