mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Warn for structured feature toggles (#27076)
## Summary
Startup warnings for under-development features only recognized bare
boolean toggles like `features.foo = true`. An upcoming feature will use
table-format config, so `features.foo = { enabled = true, ... }` needs
to count as an explicit opt-in too.
This updates the warning predicate to recognize structured tables with
`enabled = true`, while leaving tables without that field unwarned.
## Testing
- `just fmt`
- `just test -p codex-features
unstable_warning_event_mentions_enabled_structured_under_development_feature`
This commit is contained in:
committed by
GitHub
Unverified
parent
56c97e3b5c
commit
4d1702586a
@@ -712,3 +712,34 @@ fn unstable_warning_event_only_mentions_enabled_under_development_features() {
|
||||
assert!(!message.contains("personality"));
|
||||
assert!(message.contains("/tmp/config.toml"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unstable_warning_event_mentions_enabled_structured_under_development_feature() {
|
||||
let configured_features: Table = toml::from_str(
|
||||
r#"
|
||||
multi_agent_v2 = { enabled = true, tool_namespace = "agents" }
|
||||
code_mode = true
|
||||
"#,
|
||||
)
|
||||
.expect("features table should deserialize");
|
||||
|
||||
let mut features = Features::with_defaults();
|
||||
features.enable(Feature::MultiAgentV2);
|
||||
features.enable(Feature::CodeMode);
|
||||
|
||||
let warning = unstable_features_warning_event(
|
||||
Some(&configured_features),
|
||||
/*suppress_unstable_features_warning*/ false,
|
||||
&features,
|
||||
"/tmp/config.toml",
|
||||
)
|
||||
.expect("warning event");
|
||||
|
||||
let EventMsg::Warning(WarningEvent { message }) = warning.msg else {
|
||||
panic!("expected warning event");
|
||||
};
|
||||
assert_eq!(
|
||||
"Under-development features enabled: code_mode, multi_agent_v2. Under-development features are incomplete and may behave unpredictably. To suppress this warning, set `suppress_unstable_features_warning = true` in /tmp/config.toml.".to_string(),
|
||||
message
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user