fix(cli): register the trust command on the root (dropped in #162) - #328
Merged
Conversation
Program.CommandRegistration.cs built the command tree with BuildTrustCommand(jsonOpt) but the AddCommand block at the bottom never added it to the root, so `nexo trust ...` failed with "'trust' was not matched" (TreatUnmatchedTokensAsErrors). The registration line was lost in ae6c6bf (#162) when the file was split. Consequences of the gap: - README.md ("trust dashboard", "trust pack apply --id ...", "trust pause/resume") and docs/GettingStarted.md ("help should list trust") advertised a command that did not exist. - scripts/security-gate-tier-c.sh runs `trust boundary --format-json` and `trust dashboard --format-json` under `set -euo pipefail`, so `make security-gate-tier-c` and the Security Gate workflow's Tier C were guaranteed to fail. Fix: add root.AddCommand(trustCmd) beside the other AddCommand calls. All documented subcommands (dashboard, boundary, pause, resume, pack apply --id) already exist in Program.TrustCommands.cs; nothing new is invented. Guard: BuildRootCommand is now `internal` (Nexo.CLI already has InternalsVisibleTo Nexo.Tests.CLI) and RootCommandRegistrationTests asserts the root registers `trust` and that `trust` exposes the subcommands the docs and Tier C name. This catches the built-but-never-added failure mode without spawning the host. CI: security-gate.yml's pull_request path filter now includes Program.TrustCommands.cs and Program.CommandRegistration.cs so future edits to the trust wiring re-run the gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Production-readiness audit, H1. Full ledger: Nexo Readiness Ledger (shared separately).
What / why
Program.CommandRegistration.csbuilt the trust command tree (var trustCmd = BuildTrustCommand(jsonOpt);) but theAddCommandblock at the bottom never added it to the root, sonexo trust ...failed with'trust' was not matched(TreatUnmatchedTokensAsErrors). The registration line was lost in ae6c6bf (#162) when the file was split.Consequences of the gap:
trust dashboard,trust pack apply --id strict-enterprise,trust pause/trust resume) and docs/GettingStarted.md ("help should listtrust") advertised a command that did not exist.scripts/security-gate-tier-c.shrunstrust boundary --format-jsonandtrust dashboard --format-jsonunderset -euo pipefail, somake security-gate-tier-cand the Security Gate workflow's Tier C were guaranteed to fail.Changes
application/src/Nexo.CLI/Program.CommandRegistration.csroot.AddCommand(trustCmd);added beside the otherAddCommandcalls.BuildRootCommandis nowinternal(with a doc comment;Nexo.CLI.csprojalready hasInternalsVisibleTo Nexo.Tests.CLI) so the test project can assert the registered root commands without spawning the host.application/src/Nexo.Tests.CLI/Tests/Commands/RootCommandRegistrationTests.cs(new, xunit,Category=CLI)RootCommand_RegistersTrustCommand— root subcommands containtrust.TrustCommand_HasDocumentedSubcommands—trustexposesdashboard,boundary,pause,resume,pack, andpackexposesapply(the surface named by README, GettingStarted and Tier C)..github/workflows/security-gate.ymlpull_request.pathsnow includesapplication/src/Nexo.CLI/Program.TrustCommands.csandapplication/src/Nexo.CLI/Program.CommandRegistration.cs.No documented subcommand had to be invented:
Program.TrustCommands.csalready definesaudit,pause,resume,allow,deny,boundary,dashboard,pack {list,describe,apply --id}.Verification
dotnet build application/src/Nexo.Tests.CLI/Nexo.Tests.CLI.csproj— 0 warnings, 0 errors.dotnet Nexo.CLI.dll --help— liststrust Trust & Information Architecture: audit log and access boundary.dotnet Nexo.CLI.dll trust --help— shows audit, pause, resume, allow, deny, boundary, dashboard, pack.NEXO_ALLOW_MOCK=1 dotnet Nexo.CLI.dll trust boundary --format-jsonandtrust dashboard --format-json— both exit 0 (the exact Tier C invocations).dotnet test ... --filter FullyQualifiedName~RootCommandRegistrationTests— 2/2 passed (net8.0 withDOTNET_ROLL_FORWARD=Major; the test project single-targets net8.0, so-f net9.0does not apply).Not done / notes
🤖 Generated with Claude Code