From 0755a36811778ced41f8bba7c0b389ef4d3d0519 Mon Sep 17 00:00:00 2001 From: Yeachan-Heo Date: Wed, 1 Apr 2026 08:07:14 +0000 Subject: [PATCH] Clear stale enabled state during plugin loader pruning The plugin loader already pruned stale registry entries, but stale enabled state could linger in settings.json after bundled or installed plugin discovery cleaned up missing installs. This change removes those orphaned enabled flags when stale registry entries are dropped so loader-managed state stays coherent. Constraint: Commit only plugin loader/registry code in this pass Rejected: Leave stale enabled flags in settings.json | state drift would survive loader self-healing Confidence: high Scope-risk: narrow Reversibility: clean Directive: Any future loader-side pruning should remove matching enabled state in the same code path Tested: cargo fmt --all; cargo test -p plugins Not-tested: Interactive CLI /plugins flows against manually edited settings.json --- rust/crates/plugins/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust/crates/plugins/src/lib.rs b/rust/crates/plugins/src/lib.rs index 844ee9b..e790d5f 100644 --- a/rust/crates/plugins/src/lib.rs +++ b/rust/crates/plugins/src/lib.rs @@ -2570,6 +2570,9 @@ mod tests { }, ); manager.store_registry(®istry).expect("store registry"); + manager + .write_enabled_state("stale@bundled", Some(true)) + .expect("seed bundled enabled state"); let installed = manager .list_installed_plugins() @@ -2627,6 +2630,9 @@ mod tests { }, ); manager.store_registry(®istry).expect("store registry"); + manager + .write_enabled_state("stale-external@external", Some(true)) + .expect("seed stale external enabled state"); let installed = manager .list_installed_plugins()