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:
@@ -1281,7 +1281,13 @@ pub fn unstable_features_warning_event(
|
||||
let mut under_development_feature_keys = Vec::new();
|
||||
if let Some(table) = effective_features {
|
||||
for (key, value) in table {
|
||||
if value.as_bool() != Some(true) {
|
||||
let is_enabled = value.as_bool() == Some(true)
|
||||
|| value
|
||||
.as_table()
|
||||
.and_then(|table| table.get("enabled"))
|
||||
.and_then(toml::Value::as_bool)
|
||||
== Some(true);
|
||||
if !is_enabled {
|
||||
continue;
|
||||
}
|
||||
let Some(spec) = FEATURES.iter().find(|spec| spec.key == key.as_str()) else {
|
||||
@@ -1300,6 +1306,7 @@ pub fn unstable_features_warning_event(
|
||||
return None;
|
||||
}
|
||||
|
||||
under_development_feature_keys.sort();
|
||||
let under_development_feature_keys = under_development_feature_keys.join(", ");
|
||||
let message = format!(
|
||||
"Under-development features enabled: {under_development_feature_keys}. Under-development features are incomplete and may behave unpredictably. To suppress this warning, set `suppress_unstable_features_warning = true` in {config_path}."
|
||||
|
||||
Reference in New Issue
Block a user