Repair MCP diagnostics and gateway lifecycle

This commit is contained in:
HumbleTurtle
2026-08-01 03:50:28 -03:00
parent ffd31cf568
commit bfda22f59b
16 changed files with 663 additions and 110 deletions
+22 -14
View File
@@ -7,7 +7,7 @@ import sys
def load_module():
script_path = pathlib.Path(__file__).resolve().parents[1] / "scripts" / "nap_install.py"
script_path = pathlib.Path(__file__).resolve().parents[1] / "resources" / "scripts" / "nap_install.py"
spec = importlib.util.spec_from_file_location("nap_install", script_path)
module = importlib.util.module_from_spec(spec)
assert spec and spec.loader
@@ -25,10 +25,14 @@ def run():
assert calls == []
assert mod.handle_gateway(["vault", "--help"]) == 0
assert calls[-1] == ("gateway", ["vault", "--help"])
assert calls == []
assert mod.handle_gateway(["vault", "list"]) == 0
assert calls[-1] == ("gateway", ["vault", "list"])
try:
mod.handle_gateway(["vault", "list"])
except RuntimeError as exc:
assert "gateway vault status" in str(exc)
else:
raise AssertionError("removed gateway vault list alias must not route")
assert mod.handle_gateway(["vault", "rotate-secret", "--kind", "memory"]) == 0
assert calls[-1] == ("gateway", ["vault", "rotate-secret", "--kind", "memory"])
@@ -39,18 +43,22 @@ def run():
assert "nap gateway vault process" in str(exc), str(exc)
else:
raise AssertionError("deprecated gateway process shortcut must not route")
assert mod.main(["nap", "chat", "secret", "setup"]) == 0
assert calls[-1] == ("chat", ["secret", "setup"])
try:
mod.main(["nap", "chat", "secret", "setup"])
except RuntimeError as exc:
assert "MCP chat-secret tools" in str(exc)
else:
raise AssertionError("removed chat compatibility command must not route")
try:
mod.handle_gateway(["config"])
except RuntimeError as exc:
assert "unknown gateway subcommand" in str(exc)
assert "unknown gateway command" in str(exc)
else:
raise AssertionError("gateway config alias must not route")
try:
mod.handle_gateway(["vault-setup", "list"])
except RuntimeError as exc:
assert "unknown gateway subcommand" in str(exc)
assert "unknown gateway command" in str(exc)
else:
raise AssertionError("deprecated gateway vault-setup alias must not route")
@@ -75,12 +83,12 @@ def run():
assert "unknown" in str(exc), (argv, str(exc))
else:
raise AssertionError(f"deprecated route must not be accepted at install level: {argv}")
# nap project bootstrap is now a deprecated alias handled by the MCP server
# (the install side forwards it; the MCP side raises with a clear error message).
forwarded = []
mod.run_wrapper = lambda command, args: forwarded.append((command, args)) or 0
mod.main(["nap", "project", "bootstrap"])
assert forwarded == [("project", ["bootstrap"])], forwarded
try:
mod.main(["nap", "project", "bootstrap"])
except RuntimeError as exc:
assert "unknown project command" in str(exc)
else:
raise AssertionError("deprecated project bootstrap alias must not route")
print("ok: nap installer gateway route smoke passed")