Preserve plugin lifecycle JSON in G007 CLI output

Constraint: G007 worker integrations made plugin command JSON degraded-aware but omitted the structured plugin/load-failure arrays expected by inventory contracts.\nRejected: Drop lifecycle arrays from tests | G007 requires plugin lifecycle state to stay machine-readable across plugin surfaces.\nConfidence: high\nScope-risk: narrow\nDirective: Keep  carrying plugin entries, lifecycle state, and load failures even when config loading degrades.\nTested: cargo fmt --manifest-path rust/Cargo.toml --all -- --check; cargo check --manifest-path rust/Cargo.toml -p runtime -p tools -p rusty-claude-cli -p commands -p plugins; cargo test --manifest-path rust/Cargo.toml -p rusty-claude-cli --test output_format_contract plugins_json_surfaces_lifecycle_contract_when_plugin_is_installed -- --nocapture; cargo test --manifest-path rust/Cargo.toml -p rusty-claude-cli --test output_format_contract inventory_commands_emit_structured_json_when_requested -- --nocapture; git diff --check\nNot-tested: full workspace suite\n\nCo-authored-by: OmX <omx@oh-my-codex.dev>
This commit is contained in:
bellman
2026-05-15 09:56:46 +09:00
parent db91a235e9
commit c522dc970f
2 changed files with 27 additions and 5 deletions

View File

@@ -189,10 +189,13 @@ fn inventory_commands_emit_structured_json_when_requested() {
"plugins target should be null when no plugin is targeted"
);
assert_eq!(plugins["status"], "ok");
assert!(plugins["plugins"]
.as_array()
.expect("plugins array")
.is_empty());
let plugin_entries = plugins["plugins"].as_array().expect("plugins array");
assert!(
plugin_entries.iter().all(|plugin| plugin["id"].is_string()
&& plugin["lifecycle_state"].is_string()
&& plugin["lifecycle"].is_object()),
"plugins JSON entries should carry lifecycle contract fields"
);
assert!(plugins["load_failures"]
.as_array()
.expect("plugin load failures array")