Fix plugin refactor review issues

This commit is contained in:
xli-oai
2026-04-30 01:48:25 -07:00
parent 818838178d
commit 65756a5ebd
8 changed files with 12 additions and 102 deletions
-19
View File
@@ -1201,25 +1201,6 @@ impl ConfigEditsBuilder {
self
}
pub fn set_plugin_enabled(mut self, plugin_id: &str, enabled: bool) -> Self {
self.edits.push(ConfigEdit::SetPath {
segments: vec![
"plugins".to_string(),
plugin_id.to_string(),
"enabled".to_string(),
],
value: value(enabled),
});
self
}
pub fn clear_plugin(mut self, plugin_id: &str) -> Self {
self.edits.push(ConfigEdit::ClearPath {
segments: vec!["plugins".to_string(), plugin_id.to_string()],
});
self
}
/// Enable or disable a feature flag by key under the `[features]` table.
///
/// Disabling a default-false feature clears the root-scoped key instead of
-33
View File
@@ -1313,39 +1313,6 @@ model_reasoning_effort = "high"
assert_eq!(contents, initial_expected);
}
#[test]
fn blocking_builder_sets_and_clears_plugin_config() {
let tmp = tempdir().expect("tmpdir");
let codex_home = tmp.path();
ConfigEditsBuilder::new(codex_home)
.set_plugin_enabled("sample@test", /*enabled*/ true)
.set_plugin_enabled("other@test", /*enabled*/ false)
.apply_blocking()
.expect("persist plugin config");
ConfigEditsBuilder::new(codex_home)
.clear_plugin("sample@test")
.apply_blocking()
.expect("clear plugin config");
let raw = std::fs::read_to_string(codex_home.join(CONFIG_TOML_FILE)).expect("read config");
let config: TomlValue = toml::from_str(&raw).expect("parse config");
let plugins = config
.get("plugins")
.and_then(TomlValue::as_table)
.expect("plugins table should exist");
assert!(!plugins.contains_key("sample@test"));
assert_eq!(
plugins
.get("other@test")
.and_then(TomlValue::as_table)
.and_then(|plugin| plugin.get("enabled"))
.and_then(TomlValue::as_bool),
Some(false)
);
}
#[tokio::test]
async fn blocking_set_asynchronous_helpers_available() {
let tmp = tempdir().expect("tmpdir");
@@ -1,5 +1,4 @@
use super::*;
use crate::config::edit::ConfigEditsBuilder;
use crate::plugins::test_support::load_plugins_config;
use crate::plugins::test_support::write_curated_plugin_sha;
use crate::plugins::test_support::write_openai_curated_marketplace;
@@ -49,11 +48,6 @@ async fn verified_plugin_suggestion_completed_requires_installed_plugin() {
})
.await
.expect("plugin should install");
ConfigEditsBuilder::new(codex_home.path())
.set_plugin_enabled("sample@openai-curated", /*enabled*/ true)
.apply()
.await
.expect("plugin config should persist");
let refreshed_config = load_plugins_config(codex_home.path()).await;
assert!(verified_plugin_suggestion_completed(