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

   # Which issue does this PR close?
   
   Part of apache/reqsign#685. This B2 migration builds on #9271 and targets 
main at `4228f3bcae`.
   
   # Rationale for this change
   
   B2 currently sets the account authorization header in each Native API 
request builder. Delegating that step to Reqsign gives these requests one 
signing path. OpenDAL keeps the account exchange because switching to Reqsign's 
account provider would extend the existing 20-hour cache lifetime.
   
   # What changes are included in this PR?
   
   - OpenDAL exchanges the explicit application key ID and key with a 
Basic-authenticated GET to the v4 `b2_authorize_account` endpoint. Operator 
clones share the 20-hour cache across HTTP transport changes. The next exchange 
uses the transport of the operation that triggers it.
   - Each account-authorized Native API call selects its API or download URL 
from the same credential it passes to the `reqsign-b2` 1.0.0 request signer. 
This includes the calls that obtain dedicated tokens. File uploads and part 
uploads use their respective upload tokens, and presigned downloads use a 
prefix-scoped download token.
   
   The private independent review covered `f22c998241`. The B2 service files in 
`0fef1dbf7d` are identical to those reviewed.
   
   We ran the same public `Operator` operations offline on `4228f3bcae` and 
`0fef1dbf7d` with synthetic credentials and scripted HTTP responses. All 71 
normalized records matched in order, including 48 HTTP requests and two 
presigned results (a download GET and an upload POST). The comparison also 
covered error handling, retry and credential caching. The two live B2 checks 
ran on `746d66adaf`: reading a missing object and listing a missing directory.
   
   On `0fef1dbf7d`, the B2 crate passed 22 unit tests, 7 integration tests and 
2 doctests. Clippy and formatting checks passed. The `services-b2` feature 
compiled natively with default features enabled and disabled, and with default 
features disabled on Rust 1.95 and on `wasm32-unknown-unknown`. Wasm 
verification covered compilation only.
   
   # Are there any user-facing changes?
   
   If the v4 exchange returns HTTP 200 with an empty account token, API URL, or 
download URL, signing can now return a permanent `Unexpected` error before 
OpenDAL sends the storage request. The parent could attempt the request with 
the incomplete credential. Both versions store the returned authorization state 
and require a nonempty token for a cache hit. If the token contains characters 
invalid in an HTTP header, the error remains permanent and its diagnostic 
changes from `building http request` to `signing http request`.
   
   # Breaking changes
   
   # AI Usage Statement
   
   - Pi ran `magpie/codex/gpt-6.2-sol` with `max` effort for implementation, 
the parent and candidate replay, and candidate verification.
   - Pi ran `magpie/codex/gpt-6.2-astra` with `high` effort for design and 
writing.
   - Pi ran `magpie/devin/swe-2-1` with no explicit effort setting for 
independent review of `f22c998241`.
   


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