mirror of
https://github.com/openai/codex.git
synced 2026-10-22 17:58:46 +00:00
Group Bedrock API key entry with other AWS sign-in methods (#56023)
## What changed When AWS profiles or environment credentials are detected, move manual Bedrock API key entry under “Other AWS sign-in methods” and update its description to include API keys. Keep API key entry directly available when no credentials are detected. ## Testing Update onboarding method assertions and rendering snapshots to cover the grouped options and API key entry in the other sign-in methods menu. GitOrigin-RevId: 992ecf7a2e3ac9f2f0eef2ef6534cf9beb88ea8e
This commit is contained in:
@@ -153,25 +153,18 @@ impl BedrockState {
|
||||
if !self.environment_credentials.is_empty() {
|
||||
methods.push(BedrockMethod::Environment);
|
||||
}
|
||||
methods.extend([BedrockMethod::OtherMethods, BedrockMethod::ApiKey]);
|
||||
methods.push(BedrockMethod::OtherMethods);
|
||||
return methods;
|
||||
}
|
||||
if detected && !self.environment_credentials.is_empty() {
|
||||
return vec![
|
||||
BedrockMethod::Environment,
|
||||
BedrockMethod::OtherMethods,
|
||||
BedrockMethod::ApiKey,
|
||||
];
|
||||
return vec![BedrockMethod::Environment, BedrockMethod::OtherMethods];
|
||||
}
|
||||
let mut methods = vec![
|
||||
vec![
|
||||
BedrockMethod::ManualProfile,
|
||||
BedrockMethod::AccessKeys,
|
||||
BedrockMethod::EnvironmentInstructions,
|
||||
];
|
||||
if detected {
|
||||
methods.push(BedrockMethod::ApiKey);
|
||||
}
|
||||
methods
|
||||
BedrockMethod::ApiKey,
|
||||
]
|
||||
}
|
||||
|
||||
pub(super) fn is_text_entry_active(&self) -> bool {
|
||||
@@ -635,7 +628,7 @@ impl BedrockState {
|
||||
if matches!(self.view, BedrockView::EnvironmentInstructions) {
|
||||
""
|
||||
} else {
|
||||
"Use another profile, access keys, or environment variables"
|
||||
"Use another profile, access keys, environment variables, or a Bedrock API key"
|
||||
}
|
||||
.to_string(),
|
||||
),
|
||||
|
||||
@@ -83,7 +83,7 @@ fn render_visible_at(state: &BedrockState, area: Rect) -> String {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
fn discovery_prioritizes_profiles_and_groups_other_sign_in_methods() {
|
||||
let discovering = BedrockState::discovering(RequestId::Integer(1));
|
||||
insta::assert_snapshot!(render_visible(&discovering), @r###"
|
||||
> Set up Amazon Bedrock
|
||||
@@ -126,7 +126,6 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
BedrockMethod::Profile(0),
|
||||
BedrockMethod::Environment,
|
||||
BedrockMethod::OtherMethods,
|
||||
BedrockMethod::ApiKey,
|
||||
],
|
||||
),
|
||||
(
|
||||
@@ -143,17 +142,12 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
BedrockMethod::Profile(1),
|
||||
BedrockMethod::Environment,
|
||||
BedrockMethod::OtherMethods,
|
||||
BedrockMethod::ApiKey,
|
||||
],
|
||||
),
|
||||
(
|
||||
Vec::new(),
|
||||
vec![environment],
|
||||
vec![
|
||||
BedrockMethod::Environment,
|
||||
BedrockMethod::OtherMethods,
|
||||
BedrockMethod::ApiKey,
|
||||
],
|
||||
vec![BedrockMethod::Environment, BedrockMethod::OtherMethods],
|
||||
),
|
||||
(
|
||||
Vec::new(),
|
||||
@@ -186,7 +180,6 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
BedrockMethod::Profile(0),
|
||||
BedrockMethod::Environment,
|
||||
BedrockMethod::OtherMethods,
|
||||
BedrockMethod::ApiKey,
|
||||
]
|
||||
);
|
||||
insta::assert_snapshot!(render_visible(&profile_and_bearer), @r###"
|
||||
@@ -202,10 +195,8 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
Use your existing Amazon Bedrock API key
|
||||
|
||||
3. Other AWS sign-in methods
|
||||
Use another profile, access keys, or environment variables
|
||||
|
||||
4. Bedrock API key
|
||||
Enter a Bedrock API key
|
||||
Use another profile, access keys, environment variables, or a
|
||||
Bedrock API key
|
||||
|
||||
|
||||
Press enter to continue
|
||||
@@ -218,6 +209,7 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
BedrockMethod::ManualProfile,
|
||||
BedrockMethod::AccessKeys,
|
||||
BedrockMethod::EnvironmentInstructions,
|
||||
BedrockMethod::ApiKey,
|
||||
]
|
||||
);
|
||||
insta::assert_snapshot!(render_visible(&profile_and_bearer), @r"
|
||||
@@ -234,6 +226,9 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
3. Environment variables
|
||||
Configure AWS credentials in your environment, then return here
|
||||
|
||||
4. Bedrock API key
|
||||
Enter a Bedrock API key
|
||||
|
||||
|
||||
Press enter to continue
|
||||
Press esc to go back
|
||||
@@ -253,10 +248,8 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
Use your existing AWS credentials
|
||||
|
||||
2. Other AWS sign-in methods
|
||||
Use another profile, access keys, or environment variables
|
||||
|
||||
3. Bedrock API key
|
||||
Enter a Bedrock API key
|
||||
Use another profile, access keys, environment variables, or a
|
||||
Bedrock API key
|
||||
|
||||
|
||||
Press enter to continue
|
||||
@@ -288,10 +281,8 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
us-west-2
|
||||
|
||||
3. Other AWS sign-in methods
|
||||
Use another profile, access keys, or environment variables
|
||||
|
||||
4. Bedrock API key
|
||||
Enter a Bedrock API key
|
||||
Use another profile, access keys, environment variables, or a
|
||||
Bedrock API key
|
||||
|
||||
|
||||
Press enter to continue
|
||||
@@ -314,8 +305,6 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
|
||||
2. Other AWS sign-in methods
|
||||
|
||||
3. Bedrock API key
|
||||
|
||||
|
||||
Press enter to continue
|
||||
Press esc to go back
|
||||
@@ -365,7 +354,7 @@ fn discovery_prioritizes_profiles_and_keeps_bedrock_api_key_last() {
|
||||
.flat_map(|row| (area.left()..area.right()).map(move |column| (column, row)))
|
||||
.map(|position| buffer[position].symbol())
|
||||
.collect::<String>();
|
||||
assert!(visible.contains("Bedrock API key"));
|
||||
assert!(visible.contains("Other AWS sign-in methods"));
|
||||
assert!(visible.contains("Press enter to continue"));
|
||||
assert!(visible.contains("Press esc to go back"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user