fix(TASK-046): honor the --mcp-list inspection contract without a vault

Pure --mcp-list never reads secrets (only --mcp-add does), yet the mcp
action path always ran strict Vault::init, so a virgin environment with
no password file exited 1 instead of printing the empty listing. Route
the mcp_inspect path through the established Vault::init_lenient
constructor; get/remove/add stay on the strict init.

Make tests/inspection_flags.rs hermetic against host state: every
spawned binary gets a fresh fake HOME (and USERPROFILE) so a real
~/.coyote_password can't mask virgin-environment regressions, scrubs
IS_SANDBOX/COYOTE_PROVIDER/COYOTE_PLATFORM outside the sandbox-mode
tests, and pins CWD so workspace mcp.json discovery can't leak in.
New tests pin both sides of the boundary: the lenient list path (empty
and configured, never bootstrapping a password file) and the strict
vault gate for get/remove/add.
This commit is contained in:
Dark-Alex-17 committed 2026-09-16 23:09:59 -06:00
1 parent 879cf8e097
commit c2e30c12a6
2 files changed
+195 -2

No files matched your search

+9 -1
View File
@@ -259,7 +259,15 @@ async fn main() -> Result<()> {
} else {
AppConfig::from_config(cfg)?
};
let vault = Vault::init(&app_config)?;
// Listing servers reads no secrets, so an unconfigured vault (no
// Listing servers reads no secrets, so an unconfigured vault (no
// password file) must not block the readout; every other MCP flag
// (get/remove/add) stays on the strict init.
let vault = if mcp_inspect {
Vault::init_lenient(&app_config)
} else {
Vault::init(&app_config)?
};
mcp::manage::handle(&cli, &vault)?;