Skip to content

refactor: unify async synchronization with AsyncBand - #870

Merged
Xuanwo merged 2 commits into
apache:mainfrom
tisonkun:codex/azure-delegation-singleflight
Sep 8, 2026
Merged

Xuanwo merged 2 commits into
apache:mainfrom
tisonkun:codex/azure-delegation-singleflight

Conversation

@tisonkun

@tisonkun tisonkun commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Reqsign uses Tokio and futures synchronization alongside AsyncBand, while concurrent Azure SAS cache misses can issue identical user delegation key requests. Use AsyncBand consistently for async synchronization and coalesce those Azure key requests.

  • Replace the Google client-side CAB cache and refresh mutexes with asyncband::mutex::Mutex.
  • Replace Tokio semaphores in the Azure and Google concurrency tests, and futures oneshot channels in the core signer tests and WASM Reqwest response bridge.
  • Use Group::try_work for Azure user delegation keys, partitioned by account, endpoint, source-token fingerprint, service version, and requested key start and expiry. Retain the bounded cache and per-grant SAS validity checks; waiting callers can retry after a failed or cancelled key request.
  • Declare AsyncBand features at their use sites and remove the replaced Google futures and WASM futures-channel dependencies.

Testing

The full workspace suite includes Google client-side CAB refresh sharing, partition isolation, and cancellation tests. The four Azure coordination tests pass; three reproduce duplicate requests against the original implementation. The existing WASM HTTP test also passes under Node with wasm-bindgen-test-runner 0.2.128.

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-features --no-fail-fast (including doc tests)
  • cargo build --manifest-path reqsign/Cargo.toml --target wasm32-unknown-unknown --no-default-features --features default-context,aws,aws-v4a,azure,aliyun,tencent
  • cargo test --target wasm32-unknown-unknown -p reqsign-http-send-reqwest --test wasm
  • hawkeye check

Repository-wide scanning found no remaining direct uses of Tokio or futures synchronization primitives. Live cloud service tests were not run locally.

AI assisted with the implementation, tests, and PR draft.

@tisonkun tisonkun changed the title perf(azure-storage): coalesce user delegation key requests refactor: unify async synchronization with AsyncBand Sep 8, 2026
@tisonkun
tisonkun marked this pull request as ready for review September 8, 2026 08:35
@tisonkun
tisonkun requested review from Xuanwo and a lite review from Copilot September 8, 2026 08:35

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

This PR standardizes async synchronization on AsyncBand across the workspace and eliminates duplicate concurrent Azure user delegation key requests by coalescing identical cache-miss fetches via singleflight.

Changes:

  • Replace futures/Tokio sync primitives with asyncband equivalents (mutex, semaphore, oneshot) in Google CAB, core tests, WASM reqwest bridge, and Azure tests.
  • Add Azure singleflight coordination (Group::try_work) keyed by cache identity + requested key start/expiry to prevent duplicate delegation key fetches.
  • Update crate feature flags/dependencies to remove replaced futures/futures-channel usage and enable required AsyncBand features.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
services/google/src/credential_access_boundary/client_side.rs Switch CAB cache/refresh synchronization to asyncband::mutex::Mutex; update test gating to asyncband::semaphore::Semaphore.
services/google/Cargo.toml Add optional asyncband dependency and dev feature for semaphore; remove optional futures dependency for CAB feature.
services/azure-storage/src/user_delegation_sas.rs Add asyncband::singleflight::Group to coalesce delegation key requests; extend tests to cover coalescing, partitioning, retry behavior, and per-grant validation.
services/azure-storage/Cargo.toml Add asyncband dependency with singleflight + dev semaphore.
core/src/signer.rs Switch signer tests from futures::channel::oneshot to asyncband::oneshot.
core/Cargo.toml Add dev-dependency on asyncband with oneshot feature for tests.
context/http-send-reqwest/src/lib.rs Replace WASM bridge oneshot channel with asyncband::oneshot import.
context/http-send-reqwest/Cargo.toml Replace wasm32-only futures-channel dependency with wasm32-only asyncband oneshot feature.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread context/http-send-reqwest/src/lib.rs
Comment thread services/azure-storage/src/user_delegation_sas.rs
@Xuanwo
Xuanwo merged commit ad3ce5a into apache:main Sep 8, 2026
64 checks passed
@tisonkun
tisonkun deleted the codex/azure-delegation-singleflight branch September 8, 2026 11:59
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.

3 participants