mirror of
https://github.com/openai/codex.git
synced 2026-05-21 11:42:55 +00:00
Rename `no_memories_if_mcp_or_web_search` → `disable_on_external_context` with backward compatibility While doing so, we add a key alias system on our layer merging system. What we try to avoid is a case where a company managed config use an old name while the user has a new name in it's local config (which would make the deserialization fail)
35 lines
883 B
Rust
35 lines
883 B
Rust
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn origins_use_canonical_key_aliases() {
|
|
let layer = ConfigLayerEntry::new(
|
|
ConfigLayerSource::SessionFlags,
|
|
toml::from_str(
|
|
r#"
|
|
[memories]
|
|
no_memories_if_mcp_or_web_search = true
|
|
"#,
|
|
)
|
|
.expect("config TOML should parse"),
|
|
);
|
|
let metadata = layer.metadata();
|
|
let stack = ConfigLayerStack::new(
|
|
vec![layer],
|
|
ConfigRequirements::default(),
|
|
ConfigRequirementsToml::default(),
|
|
)
|
|
.expect("single layer stack should be valid");
|
|
|
|
let origins = stack.origins();
|
|
|
|
assert_eq!(
|
|
origins.get("memories.disable_on_external_context"),
|
|
Some(&metadata)
|
|
);
|
|
assert!(
|
|
!origins.contains_key("memories.no_memories_if_mcp_or_web_search"),
|
|
"legacy key should be canonicalized before origin recording"
|
|
);
|
|
}
|