chore: clarify web_search deprecation notices and consolidate tests (#11224)

follow up to #10406, clarify default-enablement of web_search.

also consolidate pseudo-redundant tests

Tests pass
This commit is contained in:
sayan-oai
2026-02-17 10:20:24 -08:00
committed by GitHub
parent 76283e6b4e
commit a1b8e34938
2 changed files with 34 additions and 65 deletions

View File

@@ -356,7 +356,8 @@ fn legacy_usage_notice(alias: &str, feature: Feature) -> (String, Option<String>
}
_ => alias,
};
let summary = format!("`{label}` is deprecated. Use `web_search` instead.");
let summary =
format!("`{label}` is deprecated because web search is enabled by default.");
(summary, Some(web_search_details().to_string()))
}
_ => {
@@ -374,7 +375,7 @@ fn legacy_usage_notice(alias: &str, feature: Feature) -> (String, Option<String>
}
fn web_search_details() -> &'static str {
"Set `web_search` to `\"live\"`, `\"cached\"`, or `\"disabled\"` at the top level (or under a profile) in config.toml."
"Set `web_search` to `\"live\"`, `\"cached\"`, or `\"disabled\"` at the top level (or under a profile) in config.toml if you want to override it."
}
/// Keys accepted in `[features]` tables.

View File

@@ -113,75 +113,43 @@ async fn emits_deprecation_notice_for_experimental_instructions_file() -> anyhow
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn emits_deprecation_notice_for_web_search_feature_flags() -> anyhow::Result<()> {
async fn emits_deprecation_notice_for_web_search_feature_flag_values() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
let server = start_mock_server().await;
for enabled in [true, false] {
let server = start_mock_server().await;
let mut builder = test_codex().with_config(|config| {
let mut entries = BTreeMap::new();
entries.insert("web_search_request".to_string(), true);
config.features.apply_map(&entries);
});
let mut builder = test_codex().with_config(move |config| {
let mut entries = BTreeMap::new();
entries.insert("web_search_request".to_string(), enabled);
config.features.apply_map(&entries);
});
let TestCodex { codex, .. } = builder.build(&server).await?;
let TestCodex { codex, .. } = builder.build(&server).await?;
let notice = wait_for_event_match(&codex, |event| match event {
EventMsg::DeprecationNotice(ev) if ev.summary.contains("[features].web_search_request") => {
Some(ev.clone())
}
_ => None,
})
.await;
let notice = wait_for_event_match(&codex, |event| match event {
EventMsg::DeprecationNotice(ev)
if ev.summary.contains("[features].web_search_request") =>
{
Some(ev.clone())
}
_ => None,
})
.await;
let DeprecationNoticeEvent { summary, details } = notice;
assert_eq!(
summary,
"`[features].web_search_request` is deprecated. Use `web_search` instead.".to_string(),
);
assert_eq!(
details.as_deref(),
Some(
"Set `web_search` to `\"live\"`, `\"cached\"`, or `\"disabled\"` at the top level (or under a profile) in config.toml."
),
);
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn emits_deprecation_notice_for_disabled_web_search_feature_flag() -> anyhow::Result<()> {
skip_if_no_network!(Ok(()));
let server = start_mock_server().await;
let mut builder = test_codex().with_config(|config| {
let mut entries = BTreeMap::new();
entries.insert("web_search_request".to_string(), false);
config.features.apply_map(&entries);
});
let TestCodex { codex, .. } = builder.build(&server).await?;
let notice = wait_for_event_match(&codex, |event| match event {
EventMsg::DeprecationNotice(ev) if ev.summary.contains("[features].web_search_request") => {
Some(ev.clone())
}
_ => None,
})
.await;
let DeprecationNoticeEvent { summary, details } = notice;
assert_eq!(
summary,
"`[features].web_search_request` is deprecated. Use `web_search` instead.".to_string(),
);
assert_eq!(
details.as_deref(),
Some(
"Set `web_search` to `\"live\"`, `\"cached\"`, or `\"disabled\"` at the top level (or under a profile) in config.toml."
),
);
let DeprecationNoticeEvent { summary, details } = notice;
assert_eq!(
summary,
"`[features].web_search_request` is deprecated because web search is enabled by default."
.to_string(),
);
assert_eq!(
details.as_deref(),
Some(
"Set `web_search` to `\"live\"`, `\"cached\"`, or `\"disabled\"` at the top level (or under a profile) in config.toml if you want to override it."
),
);
}
Ok(())
}