Skip to content

enhancement: clarify trust status reasons and help - #2648

Merged
codeforester merged 2 commits into
mainfrom
enhancement/2646-20261101-enhancement-clarify-changed-workspace-trust-status-reasons
Nov 2, 2026
Merged

codeforester merged 2 commits into
mainfrom
enhancement/2646-20261101-enhancement-clarify-changed-workspace-trust-status-reasons

Conversation

@codeforester

@codeforester codeforester commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Keep changed workspace trust reasons explicit about stale approval in narrow terminals.
  • Clarify basectl trust parent and leaf help, including workspace discovery versus project resolution.
  • Align the command reference, trust guide, and bundled AI context with the help text.

Issues

Closes #2646
Closes #2647

Validation

  • ./bin/base-test: full Python suite (1,845 passed) and Bats suite (1,074 passed).
  • Focused trust Python tests: 54 passed, 18 subtests passed.
  • Focused help.bats after the final wording assertion: 27 passed.
  • shellcheck -s bash cli/bash/commands/basectl/subcommands/trust.sh
  • git diff --check

Demo Impact

No demo changes; this updates trust command output and help.

Docs Impact

Updated the command reference, manifest-command trust guide, and changelog.

AI Context Impact

Updated .ai-context/COMMANDS.md to match the command behavior and help.

Notes

This PR closes both issues as a documented multi-issue exception: both are small fixes to the same trust CLI surface and share the help, docs, changelog, and regression-test changes. Landing them together avoids overlapping edits to the same help text. Both issues and this PR are assigned to v1.11.0, and #2642 is blocked by both issues.

@codeforester
codeforester requested a review from a team as a code owner November 1, 2026 17:55

@codeforester codeforester left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of #2648 (head a45a2d1, base 6fdc5a0)

Verdict: correct and safe to merge once the section-order question below is settled; no blocking defects. All CI checks are green. I did not run the suites locally; I read the full diff and checked it against main.

What I verified

  • The new reason labels work as the issue asked. Approval stale: manifest is 24 characters and Approval stale: test reqs is 25. At width 60 with a 40-character project name the PROJECT column shrinks to 24 and both labels survive intact, so the new test exercises the real renderer path. Only the display strings changed; reason codes, JSON/YAML/CSV/TSV and trust decisions are untouched.
  • The help text is accurate: the workspace-root fallback (--workspace, then workspace.root, then the parent of BASE_HOME), "scan" only for status discovery, "resolve the project" for allow/revoke/require, and no third copy of the trust-scope text (it points to basectl trust status <project>).
  • Python help now uses two shared constants, and the internal require subcommand got the resolution wording. This was one of my earlier notes on #2647.
  • The old exact-line pins in help.bats were updated, and the CHANGELOG entry is present.

Please look at (inline comments carry the details)

  1. Help section order breaks the repo convention. All four help pages now put Purpose: before Usage:. 17 other basectl subcommand files use Usage then Purpose, and #2647 asked only to move the parent summary ahead of Usage. Moving the three leaves goes beyond the issue and makes trust the odd one out.
  2. Two spellings of the same fallback. BASE_HOME's parent (status leaf and Python help) versus the parent of BASE_HOME (parent, allow, revoke, docs). The tests pin both forms, so the split is now locked in.
  3. The "does not say scan" assertions are close to vacuous. They check that the old exact string Workspace directory to scan is absent, but the replacement text is different. A regression to "Workspace to scan" would pass. The Python parametrized test has no absence check at all.
  4. Ten new full-line grep -Fqx pins on wrapped prose in .ai-context/COMMANDS.md. Any re-wrap breaks them. The new help test already shows a better pattern (join and squeeze whitespace, then match a phrase).
  5. Nits: Approval stale is new vocabulary. The detailed output and the shared blocked_command_summary say "manifest command or declared test requirements contract changed". It fits the length budget, so I'm fine with it, but docs/manifest-command-trust.md could define it in one sentence. In the parent help, "instead of using its positional argument" is ambiguous, because "its" has three possible commands.

Housekeeping: neither #2646, #2647 nor this PR has a milestone. If this is meant to land before #2642 (v1.11.0, due 2026-11-07), set it there and add the blocked-by link so the ordering stated in the Notes is enforced.

case "$trust_command" in
status)
cat <<'EOF'
Purpose:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convention: Purpose: now comes before Usage: here and in the allow and revoke leaves (lines 62 and 83) and in the parent (line 8). The other 17 basectl subcommand files that have a Purpose section put Usage: first (for example ci.sh, doctor.sh, gh_issue.sh). #2647 only asked to move the parent summary ahead of Usage. I'd keep Usage first in the three leaves, and for the parent either keep the issue's requested order or accept it as a parent-only exception. Update the new help test accordingly if you move them (it does not depend on order today, since it flattens the text).

--workspace <path> Workspace directory to scan.
--project <name> Select a project explicitly instead of using [project].
--workspace <path> Workspace to scan for command-bearing projects.
Defaults to workspace.root, then BASE_HOME's parent.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wording split: this line and the Python help say BASE_HOME's parent, while the parent help (line 25), allow (73), revoke (93), .ai-context/COMMANDS.md and docs/command-reference.md say the parent of BASE_HOME. Pick one phrasing. the parent of BASE_HOME reads better, but then Python _STATUS_WORKSPACE_HELP / _PROJECT_WORKSPACE_HELP and both pinned assertions in help.bats (status leaf and trust --help) and test_command_error_paths.py change too.

Options:
--project <name> Select a project explicitly, including one named help.
--workspace <path> Workspace directory to scan.
--project <name> Select a project explicitly instead of using

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: in the parent usage, instead of using its positional argument has no clear antecedent, because the block lists three commands. instead of the positional <project> argument would be unambiguous, and it matches what the leaves say.

help_text="$(tr '\n' ' ' <<<"$output" | tr -s ' ')"
[[ "$help_text" == *"Record local approval for the current manifest command contract"* ]]
[[ "$help_text" == *"Workspace used to resolve the project"* ]]
[[ "$help_text" != *"Workspace directory to scan"* ]]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This absence check only catches the exact old string Workspace directory to scan. The new help says Workspace used to resolve the project, so a regression to Workspace to scan or Workspace directory to scan for ... (note the latter still contains the old string, but the former does not) would pass. Assert [[ "$help_text" != *scan* ]] for the allow and revoke leaves; neither leaf has a legitimate use of the word. The same gap exists in test_trust_python_help_describes_workspace_resolution: it only asserts the positive phrase, so add assert "scan" not in help_text for require, allow and revoke.

grep -Fqx -- "- \`basectl trust status [project]\` - inspect one project's manifest command" "$commands_file"
grep -Fqx -- "- \`basectl trust <allow|revoke> <project>\` - add or remove local approval for" "$commands_file"
grep -Fqx -- "- \`basectl trust status [project]\` - read-only inspection of local trust. With" "$commands_file"
grep -Fqx -- " no project, show a compact, blocked-first summary of discovered" "$commands_file"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ten full-line grep -Fqx pins make the wrapped prose in .ai-context/COMMANDS.md a test contract, so any reflow fails the suite. The new help test above already has a sturdier idiom: tr '\n' ' ' | tr -s ' ' and then match a phrase. Use that on the trust section (or on the whole file) and assert the key phrases: read-only inspection, compact, blocked-first summary, workspace.root, allow records, revoke removes.

tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture[str],
) -> None:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth a one-line comment here explaining the budget: at width 60 the 25-character label leaves zero slack (24 + 7 + 25 + 2 gaps of 2 = 60). That is a good thing, since it makes the test fail if the label grows, but a future editor will not know the width and the 40-character name are chosen on purpose.

@codeforester codeforester added this to the v1.11.0 milestone Nov 2, 2026
@codeforester

Copy link
Copy Markdown
Collaborator Author

Final review (head cd8a0b4): looks good, ready to merge

I read the incremental diff (a45a2d1..cd8a0b4) against my six inline comments and re-checked the PR metadata.

No further changes requested. One note for #2642: its new reason codes should follow the Approval stale: ... phrasing and the 24-25 character budget the narrow-terminal test now enforces.

@codeforester
codeforester merged commit d676e25 into main Nov 2, 2026
25 checks passed
@codeforester
codeforester deleted the enhancement/2646-20261101-enhancement-clarify-changed-workspace-trust-status-reasons branch November 2, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enhancement: clarify basectl trust help text enhancement: clarify changed workspace trust status reasons

1 participant