Repository navigation
refactor!: isolate Signer::with_context cache and pass Context to default_signer - #974
Merged
Merged
Conversation
Explain that replacing a signer's Context clears its credential cache, and document that with_request_signer retains the shared cache.
PsiACE
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two breaking API refinements around
Contextownership and lifecycle inreqsign-coreand thereqsignfacade:Isolate and clear credential cache on
Signer::with_context(core/src/signer.rs):Signer::with_contextnow creates a new isolated empty credential cache (Arc::new(Mutex::new(None))), matchingGranter::with_contextandSigner::with_credential_provider.ContextcarriesEnv,FileRead,CommandExecute, andHttpSend, replacing it can change the resolved identity; sharing the previous cache risked reusing stale credentials or writing refreshed credentials back into the originalSigner.with_request_signer/with_credential_granter) continues to share the credential cache.Pass
Contextexplicitly to facadedefault_signerand remove thedefault-contextfeature gate (reqsign/src/*.rs):reqsign::<service>::default_signernow acceptsctx: Contextas its first parameter (aws::default_signer(ctx, service, region),aws::v4a::default_signer(ctx, service, region_set),azure::default_signer(ctx),google::default_signer(ctx, service),aliyun::default_signer(ctx, bucket),huaweicloud::default_signer(ctx, bucket),openstack::default_signer(ctx),oracle::default_signer(ctx),tencent::default_signer(ctx),volcengine::default_signer(ctx, region)).DefaultSigneranddefault_signerare now available whenever the corresponding service feature is enabled, without requiringdefault-context(including WASM and custom runtime builds).Context(and its HTTP client / connection pool) across multiple signers and granters instead of implicitly constructing a newreqwest::Clientperdefault_signercall.Migration
Before:
After:
Callers who relied on
Signer::with_contextreusing the previous cached credential should either configureContextbefore constructingSigneror expect the replacementSignerto load fresh credentials under the newContext.Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --no-fail-fastcargo test -p reqsign --no-default-features --features fullcargo test --doc --all-features --workspacecargo test --doc -p reqsign --no-default-features --features fullRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace --all-featuresRUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p reqsign --no-default-features --features fullcargo check -p reqsign --examples --all-featurescargo check -p reqsign-core --target wasm32-unknown-unknowncargo build --manifest-path reqsign/Cargo.toml --target wasm32-unknown-unknown --no-default-features --features=aws,aws-v4a,azure,aliyun,tencentcargo build --manifest-path reqsign/Cargo.toml --target wasm32-unknown-unknown --no-default-features --features=default-context,aws,aws-v4a,azure,aliyun,tencentnode website/scripts/validate-providers.mjshawkeye check