Skip to content

Conversation

landonxjames
Copy link
Contributor

@landonxjames landonxjames commented Jul 18, 2025

Motivation and Context

Initial setup for tracking credential/identity resolution based features.

Description

The biggest change here is the addition of a new aws-features crate containing the sdk_features module that used to live in aws-runtime. This was done so that the AwsSdkFeature type could be referenced in the aws-credential-types crate without causing a circular dependency.

Initially I was just going to pass along the types without downcasting, but they would have had to be downcast eventually, since in the Credentials typemap they are Vec<AwsSdkFeature> but to add them to a Layer we need to extract the individual AwsSdkFeatures from the Vec. This could either happen in aws-credential-types where From<Credentials> for Identity is implemented or in aws-smithy-runtime in the orchestrator where the Identity is resolved. Since these credentials types are AWS specific it seemed to make more sense to keep it in aws/rust-runtime.

Other changes:

  • Add a typemap to Credentials (and manually implement the previously derived traits for it) to carry the feature information
  • Update the From<Credentials> for Identity implementation to extract the AwsSdkFeatures and pass them in a Layer to the Identity's typemap.
  • Update resolve_identity in the orchestrator to extract the FrozenLayer from Identity and insert it in the ConfigBag so that the UserAgentInterceptor can extract it later.

Testing

Added new tests around Credentials equality and the updated From<Credentials> for Identity implementation.

Note on failing semver test: Failing because the UnwindSafe traits are no longer auto implemented for Credentials

--- failure auto_trait_impl_removed: auto trait no longer implemented ---

Description:
A public type has stopped implementing one or more auto traits. This can break downstream code that depends on the traits being implemented.
        ref: https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.41.0/src/lints/auto_trait_impl_removed.ron

Failed in:
  type Credentials is no longer UnwindSafe, in /home/build/workspace/smithy-rs/aws-sdk/sdk/aws-credential-types/src/credentials_impl.rs:29
  type Credentials is no longer RefUnwindSafe, in /home/build/workspace/smithy-rs/aws-sdk/sdk/aws-credential-types/src/credentials_impl.rs:29Cloning base

This is due to us adding a HashMap<TypeId, TypeErasedBox> to Credentials. We could likely wrap this in an Arc<Mutex<>> to keep it mutable and get back the unwind safety, but that doesn't feel like it justifies the added complexity. Open to debate on this one though.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@landonxjames landonxjames marked this pull request as ready for review July 18, 2025 21:02
@landonxjames landonxjames requested review from a team as code owners July 18, 2025 21:02
Copy link
Contributor

@ysaito1001 ysaito1001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks clearer to hoist AWS SDK features to a upstream crate altogether, as opposed to special casing credentials-related features with AwsSdkCredentialsFeatures defined in aws-credential-types.

Great start!

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

builder.set_expiration(expiry);
builder.build().expect("set required fields")

if let Some(features) = val.get_property::<Vec<AwsSdkFeature>>().cloned() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it doesn't matter where this lives if aws-credential-types has to know about it. Alternatively could just make a new AwsCredentialFeature enum inside aws-credential-types and implement BusinessMetric conversions for that in aws-runtime. Would mean we don't need a new crate for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, after thinking about the point of having a repository-like crate, I've started learning towards this idea of defining AwsCredentialFeature in aws-credential-types...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like we are leaning towards a separate enum. I still prefer only having two feature enums (AWS and Smithy) since it seems cleaner, but don't know that that preference is strong enough to justify a new crate. Will make the change today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to an AwsCredentialFeature enum and removed the aws-features crate in 6bcea29

Copy link
Contributor

@aajtodd aajtodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, brought up one possible suggestion to avoid a new crate but otherwise looks fine.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Comment on lines 165 to 166
// Extract the FrozenLayer placed in the Identity property bag by the From<Credentials> impl.
// This layer contains AwsSdkFeatures for the user agent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for adding comments, but since this is in generic smithy runtime and Identity's frozen layer could be used for something else, so either I'd remove the comments or make them more abstract, so they're not tied specifically to AwsSdkFeatures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, made comment more generic in b785a6e

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@landonxjames landonxjames merged commit 3965ea8 into feature/credential-features Jul 24, 2025
44 of 45 checks passed
@landonxjames landonxjames deleted the landonxjames/credentials-feature-id branch July 24, 2025 15:57
landonxjames added a commit that referenced this pull request Jul 30, 2025
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
Continuing the work in
#4224, adding user-agent
feature tracking for Credential Providers.

## Description
<!--- Describe your changes in detail -->
Added `AwsCredentialFeatures` properties for each implementor of
`ProvideCredentials` in `aws-config`.

## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Added integration tests for each of the supported Credential Providers.
This required exposing some previously `pub(crate)` utility functions as
`pub` under a `test-util` feature flag.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
landonxjames added a commit that referenced this pull request Jul 30, 2025
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
Merging the feature branch containing work from the below two PRs:
* #4238
* #4224


## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] For changes to the AWS SDK, generated SDK code, or SDK runtime
crates, I have created a changelog entry Markdown file in the
`.changelog` directory, specifying "aws-sdk-rust" in the `applies_to`
key.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

---------

Co-authored-by: AWS SDK Rust Bot <[email protected]>
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