codex: align tests with lenient config enums

Update test expectations after invalid enum values no longer fail whole config deserialization.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Ahmed Ibrahim
2026-05-05 04:32:32 +03:00
co-authored by Codex
parent 4007c4c1ec
commit 01c513fcaa
3 changed files with 14 additions and 14 deletions
@@ -455,7 +455,7 @@ async fn write_value_defaults_to_user_config_path() {
}
#[tokio::test]
async fn invalid_user_value_rejected_even_if_overridden_by_managed() {
async fn invalid_user_value_written_if_overridden_by_managed() {
let tmp = tempdir().expect("tempdir");
std::fs::write(tmp.path().join(CONFIG_TOML_FILE), "model = \"user\"").unwrap();
@@ -469,7 +469,7 @@ async fn invalid_user_value_rejected_even_if_overridden_by_managed() {
CloudRequirementsLoader::default(),
);
let error = service
let result = service
.write_value(ConfigValueWriteParams {
file_path: Some(tmp.path().join(CONFIG_TOML_FILE).display().to_string()),
key_path: "approval_policy".to_string(),
@@ -478,15 +478,15 @@ async fn invalid_user_value_rejected_even_if_overridden_by_managed() {
expected_version: None,
})
.await
.expect_err("should fail validation");
.expect("write succeeds because managed config still supplies a valid effective value");
assert_eq!(
error.write_error_code(),
Some(ConfigWriteErrorCode::ConfigValidationError)
);
assert_eq!(result.status, WriteStatus::OkOverridden);
let contents = std::fs::read_to_string(tmp.path().join(CONFIG_TOML_FILE)).expect("read config");
assert_eq!(contents.trim(), "model = \"user\"");
assert_eq!(
contents.trim(),
"model = \"user\"\napproval_policy = \"bogus\""
);
}
#[tokio::test]
+5 -5
View File
@@ -3446,7 +3446,7 @@ async fn managed_config_overrides_oauth_store_mode() -> anyhow::Result<()> {
assert_eq!(
cfg.mcp_oauth_credentials_store
.clone()
.and_then(|value| value.into_valid()),
.and_then(codex_config::Lenient::into_valid),
Some(OAuthCredentialsStoreMode::Keyring),
);
@@ -4573,7 +4573,7 @@ async fn set_model_updates_defaults() -> anyhow::Result<()> {
assert_eq!(
parsed
.model_reasoning_effort
.and_then(|value| value.into_valid()),
.and_then(codex_config::Lenient::into_valid),
Some(ReasoningEffort::High)
);
@@ -4609,7 +4609,7 @@ model = "gpt-4.1"
assert_eq!(
parsed
.model_reasoning_effort
.and_then(|value| value.into_valid()),
.and_then(codex_config::Lenient::into_valid),
Some(ReasoningEffort::High)
);
assert_eq!(
@@ -4645,7 +4645,7 @@ async fn set_model_updates_profile() -> anyhow::Result<()> {
profile
.model_reasoning_effort
.clone()
.and_then(|value| value.into_valid()),
.and_then(codex_config::Lenient::into_valid),
Some(ReasoningEffort::Medium)
);
@@ -4688,7 +4688,7 @@ model = "gpt-5.4"
dev_profile
.model_reasoning_effort
.clone()
.and_then(|value| value.into_valid()),
.and_then(codex_config::Lenient::into_valid),
Some(ReasoningEffort::Medium)
);
@@ -17,7 +17,7 @@ use tokio::io::AsyncWriteExt;
const TEST_TIMESTAMP: &str = "2025-01-01T00-00-00";
fn valid_lenient<T>(value: Option<Lenient<T>>) -> Option<T> {
value.and_then(|value| value.into_valid())
value.and_then(Lenient::into_valid)
}
async fn read_config_toml(codex_home: &Path) -> io::Result<ConfigToml> {