Skip to content

fix(uninstall): correct the dry-run footer and stop answering --force with --force-dev-binaries - #916

Merged
jussielo-amd merged 12 commits into
mainfrom
issue-788-uninstall-footer-force-help
Nov 9, 2026
Merged

jussielo-amd merged 12 commits into
mainfrom
issue-788-uninstall-footer-force-help

Conversation

@jussielo-amd

@jussielo-amd jussielo-amd commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A dry run of rocm uninstall ended with "Choose Review uninstall to approve removal.", a control the command line does not have, and it printed that line even when there was nothing to remove. A person at a terminal now gets "run it again without --dry-run" when there is something to remove, and nothing when there is not. Output that is captured (the dashboard's /uninstall and the daemon's rocm_command tool run the dry run as a subprocess) names no next step, since the real step belongs to whatever drives it. The assistant's uninstall preview shares the renderer and has no flag to offer, so it says removal needs approval. The three wordings come from one audience value, chosen from whether stdin and stdout are both terminals, so a run with either one redirected counts as captured.

A mistyped --force was answered with "a similar argument exists: --force-dev-binaries", which removes the binaries of a development build, and so were near misses of it. clap ranks every declared flag by name, so --force is now declared, hidden, and refused with a pointer to --yes before anything is planned. Near misses such as --forc land on it instead of the destructive flag, and a typo of the whole flag is still met with that flag. rocm uninstall --help now ends with examples that start with a dry run.

Fixes #788.

Tests

Scenarios uninstall-07 to uninstall-12 cover the footer at a terminal (run again as it says, answering the prompt, and assert the folder is gone), outside a terminal, with an empty plan, the --force cases, the help examples, and the assistant's preview (uninstall-12 calls the hidden rocm mcp-call entry point without a model and without --allow-mutation, and checks the preview lists the config folder, says removal needs approval, and removes nothing). The terminal scenarios use a pseudo-terminal and run on the Linux lane; the others are not OS-gated and run on the mock lane on every PR. Unit tests cover the footer wording per audience, and I checked that each new test and scenario goes red when the behavior it covers is broken.

The scenario numbers overlap with draft PR #569, which also adds scenarios to uninstall.feature, so one of the two will need renumbering when the other lands.

Run locally: cargo xtask e2e -- -n "uninstall-" (12 of 12), the rocm unit tests, clippy with -D warnings for rocm and e2e-cucumber, and cargo fmt --check. Not run: the full workspace gate, the pre-push hooks, Windows (the pseudo-terminal scenarios are Linux-only), and clippy for rocm-dash-tui and rocmd, which this change does not edit. CI is the authoritative check for the rest.

…moval

`rocm uninstall` started the client file logger before it planned, and the logger creates `<data folder>/logs`. On a machine ROCm CLI had never touched, `rocm uninstall --dry-run` therefore created the data folder and then reported it as the one thing to remove, so a dry run was not free of side effects and an empty machine looked installed. It happened with the default folders and with ROCM_CLI_DATA_DIR set alike.

The `uninstall` command now skips the file logger. Other commands still log as before. Scenario uninstall-06 runs a dry run on a machine with none of the folders and asserts both that the plan says there is nothing to remove and that no folder exists afterwards; a unit test pins which invocations skip the logger.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
… with --force-dev-binaries

A dry run ended with "Choose Review uninstall to approve removal.", a control the command line does not have, and it printed that even when there was nothing to remove. A person at a terminal now gets "run it again without --dry-run" when there is something to remove, and nothing when there is not. Output that is captured (the dashboard's /uninstall and the daemon's rocm_command tool run the dry run as a subprocess) names no next step, since the real step belongs to whatever drives it. The assistant's preview has no flag to offer, so it says removal needs approval. The three wordings come from one audience value, chosen from whether the command has a terminal, rather than from strings that can drift.

A mistyped --force was answered with "a similar argument exists: --force-dev-binaries", which removes the binaries of a development build, and so were near misses of it. clap ranks every declared flag by name, so --force is now declared, hidden, and refused with a pointer to --yes before anything is planned; near misses land on it instead of on the destructive flag, and a typo of the whole flag is still met with that flag.

rocm uninstall --help now ends with examples that start with a dry run.

Scenarios uninstall-07 to uninstall-11 cover the footer at a terminal (run again as it says, answering the prompt), outside one, with an empty plan, the --force cases, and the help examples. Every uninstall step now refuses to run without --keep-binaries.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd
jussielo-amd added this pull request to stack #917 November 5, 2026 13:06
The step that finds the `EXAMPLES:` block in `rocm uninstall --help` used `map(..).unwrap_or_else(..)`, which the workspace's pedantic lints reject, so the clippy job and both Windows build jobs failed to compile the e2e harness. `map_or_else` keeps the same panic message and behavior.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
Base automatically changed from issue-791-uninstall-dry-run-no-side-effects to main November 6, 2026 14:05
@jussielo-amd
jussielo-amd requested a balanced review from Copilot November 6, 2026 14:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The source-file citation at docs/testing.md:967 uses a backticked path instead of a relative Markdown link, preventing documentation link checks from detecting a moved or deleted test file.

1 open issue
What changed in this PR

Improves rocm uninstall guidance by tailoring dry-run output to its audience, redirecting mistaken --force usage toward --yes, and adding help examples. Builds on #907’s dry-run logging safeguard.

Changes:

  • Adds audience-specific dry-run footers and omits next-step guidance for empty plans or captured output.
  • Rejects --force and steers near-miss suggestions away from --force-dev-binaries.
  • Adds regression scenarios, unit tests, and documentation for uninstall behavior.
File Description
tests/​e2e-cucumber/​tests/​e2e/​uninstall_steps.rs Adds terminal, footer, flag-refusal, and help checks.
tests/​e2e-cucumber/​features/​uninstall.feature Adds scenarios covering dry-run safety and guidance.
README.md Explains dry-run output and confirmation options.
docs/​testing.md Documents regression coverage and execution lanes.
docs/​manual-testing.md Adds manual checks for footers, flags, and help.
apps/​rocm/​src/​uninstall.rs Selects the plan audience from terminal availability.
apps/​rocm/​src/​uninstall_plan.rs Implements and tests audience-specific footers.
apps/​rocm/​src/​main.rs Adds help examples, hidden --force rejection, and logging gating.
apps/​rocm/​src/​logging.rs Skips file logging for direct uninstall invocations.
apps/​rocm/​src/​deletion_properties.rs Updates rendering tests to specify captured output.

Review effort: Balanced

Comment thread docs/testing.md Outdated
is not answered with `--force-dev-binaries` (`uninstall-10`); the help starts
its examples with a dry run (`uninstall-11`). The assistant's uninstall preview
ends differently, since it has no flag to offer: it says removal needs approval,
which `lifecycle_read_mutate_split_is_honest` in `apps/rocm/src/chat.rs` backs.

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.

Fixed in f8e3150. The citation is now a relative Markdown link to the file, so the documentation link check covers it. It was also stale: the test it names moved from chat.rs to tool_policy.rs on main, so I corrected the file name there and in the two code comments in uninstall_plan.rs that pointed at it. I found no other source-file citation added by this PR, and the repository's link check (cargo xtask lychee) passes locally.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>

#907, which this branch was stacked on, has merged, and main has since moved the clap command tree and its tests from main.rs into cli.rs and refactored the uninstall confirmation. The resolution keeps main's layout and re-applies this branch's own change on top of it: the hidden `--force` field and the `after_help` examples of `Uninstall`, and the two unit tests that parse the command, now live in cli.rs; the dispatch arm and `reject_uninstall_force` stay in main.rs; and uninstall.rs imports `interactive_terminal` again, because the plan's audience is chosen from it and main's refactor had dropped the import. What remains of the branch against main is only the footer, `--force` and help-examples change.
…a link, from the file it now lives in

The testing guide named the test `lifecycle_read_mutate_split_is_honest` with a bare backticked path, which no link check can see go stale, and the path was already stale: the test moved from chat.rs to tool_policy.rs, so the guide and the two code comments that point at it named the wrong file. The guide now cites tool_policy.rs as a relative Markdown link, which the documentation link check resolves, and the comments name the file the test is in.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd
jussielo-amd marked this pull request as ready for review November 6, 2026 15:30
@jussielo-amd
jussielo-amd requested a review from a team as a code owner November 6, 2026 15:30

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I went through the diff against #788 and the changes match the issue: the footer is correct for the CLI and absent on an empty plan, --force and its near misses no longer suggest --force-dev-binaries, and the help examples lead with the dry run. The docs and tests are updated alongside. I found nothing that breaks behavior, but there are a few things I'd tidy before merge, two as inline comments:

  • The scenario pins clap's exact "unexpected argument" wording, so a clap upgrade could fail it with no behavior change.
  • reject_uninstall_force is a new domain helper in main.rs; it would sit more naturally next to the uninstall code.
  • The assistant footer "Removal needs your approval." is backed by a unit test in tool_policy.rs rather than a scenario. That is acceptable given the cited test, just noting it.

Two questions for the author: the dashboard /uninstall used to show the old "Choose Review uninstall" line and now shows no footer, so does it supply its own next step? And the hidden dummy --force relies on clap not suggesting hidden arguments (the unit test guards this); is that coupling acceptable?

I didn't build or run this locally; CI was still pending on build-and-test, clippy, Windows and coverage when I looked.

);
assert!(
stderr.contains("unexpected argument '--forc' found"),
"expected the unknown-argument error on stderr:\n{stderr}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This pins clap's exact wording for the unknown-argument error. Exit code 2 plus the absence of --force-dev-binaries already carry the point; consider matching only unexpected argument so a clap upgrade doesn't break the scenario.

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.

Done in cf80f3d: the step now matches only unexpected argument, so a clap upgrade that rewords the message no longer breaks the scenario. It still fails on exit code 2 and if --force-dev-binaries is suggested again. Turning the refusal off and bringing the destructive suggestion back both fail it.

Comment thread apps/rocm/src/main.rs Outdated
/// such as `--forc` gets that same suggestion. Declared, those guesses land here
/// instead, before anything is planned or removed.
fn reject_uninstall_force(force: bool) -> Result<()> {
if force {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This refusal helper adds domain logic to main.rs; it could live beside uninstall in uninstall.rs instead.

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.

Moved in e058730 to uninstall.rs as reject_force, called from the dispatch arm as uninstall::reject_force. It is in uninstall.rs rather than uninstall_plan.rs because the plan module holds the shared plan types that storage.rs reuses, and this is argument handling for the uninstall command alone. The architecture note names it in its new place.

…ss scenario

The scenario asserted clap's exact wording for the unknown-argument error, including the argument it echoes. The exit code 2 and the absence of `--force-dev-binaries` already carry the point, so the step now matches only `unexpected argument`, and a clap upgrade that rewords the message no longer breaks the scenario while it still fails if the destructive flag is suggested again.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
…e uninstall command

`reject_uninstall_force` was domain logic in main.rs. It now lives in uninstall.rs, which owns `uninstall()`, as `reject_force`; the dispatch arm in main.rs calls it through the qualified `uninstall::reject_force` and the unit tests in cli.rs import it from there. uninstall.rs rather than uninstall_plan.rs, because the plan module holds the shared plan types and file-removal helpers that storage.rs reuses, while this is argument handling for the `uninstall` command alone. The architecture note for uninstall.rs names it.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
…uggestions change

The hidden `--force` works because clap's candidates for a near miss are every declared long name, hidden or not, so `--forc` is steered to `--force` and its refusal instead of to `--force-dev-binaries`. If a clap upgrade stopped suggesting hidden arguments, `--forc` would be answered with the destructive flag again. The guard test already failed on the destructive suggestion; it now also requires the near misses to name `--force`, and the two checks together do not depend on clap's wording around the suggestion.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. The tidy-ups are in cf80f3d, e058730 and 370bba7; answers to the rest:

  • The assistant's "Removal needs your approval." line is backed by lifecycle_read_mutate_split_is_honest in tool_policy.rs, and uninstall_plan.rs points at it, so I left it as a unit test and did not add a scenario.
  • Dashboard /uninstall: it runs rocm uninstall --dry-run as a captured subprocess, so no footer is shown, and the dashboard adds no next step of its own. The old "Choose Review uninstall" line named a control that does not exist anywhere in the repository, so no correct pointer was lost. A dashboard user does still get no hint that /uninstall --apply is the next step; a one-line hint in the slash handler would fix that, and I left it out of this change.
  • Hidden --force: it relies on clap including hidden arguments in its suggestions, not excluding them. On the built binary, rocm uninstall --forc prints "a similar argument exists: '--force'", and clap 4.6.7 builds its candidates from every long name with no filter for hidden arguments. If a clap upgrade stopped doing that, --forc would get --force-dev-binaries again. The guard test (370bba7) now requires that the near misses name --force and never contain the destructive flag, whatever wording clap uses, and the scenario fails on the destructive suggestion too.

main moved (the chat.rs split and other refactors) and the architecture notes for the therock, tool_policy and update_cmd modules changed there while this branch edited the entry for uninstall.rs. The resolution keeps main's wording for every entry and carries over only this change's entry for uninstall.rs.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>

@r0x0r r0x0r left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving this. It does what #788 asked on all three counts, and the destructive-path reasoning is the part I spent the most time on and came away happy with: the refusal fires in main.rs:951 before AppPaths::discover ever runs, there is a single dispatch site, and I could not find anywhere else the hidden --force could be quietly accepted.

A few things worth calling out as good rather than merely adequate:

  • uninstall-07 does not just assert the footer's wording, it executes the promise: rerun, answer the [y/N] prompt, then check the folder is actually gone. That is the message-plus-state pairing AGENTS.md asks for.
  • The near-miss guard is the best part. Asserting that --force is present and force-dev-binaries is absent means a future clap that stops suggesting hidden args fails the test, instead of silently handing the destructive suggestion back to users.
  • assert_keeps_binaries gating every run at the single entry point is the right place for it.
  • Docs are all there: README, --help, testing.md, manual-testing.md and architecture.md.

CI is fully green, 37 checks passing including clippy, Windows and every E2E lane. The one skip is skillscope, which does not apply here.

One design choice I would like you to confirm rather than change: the silence for Captured. A piped dry run now names no next step at all. The literally truthful captured instruction would be "again without --dry-run and with --yes", since a non-terminal rerun gets refused. Saying nothing is defensible, since the caller owns the next step and we cannot know what it is, but I would rather hear it was deliberate than assume it.

Two nits inline, neither blocking. And as you already noted yourself, the new scenario numbers collide with the draft in #569, so whichever lands second will need renumbering.

Self::Captured => None,
// The assistant's own uninstall is an approval action; see
// `lifecycle_read_mutate_split_is_honest` in `tool_policy.rs`.
Self::Assistant => Some("Nothing was removed. Removal needs your approval."),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This footer is user-visible output with no Gherkin scenario behind it, and the PR body does not say why.

PlanAudience::Assistant emits "Nothing was removed. Removal needs your approval." through render_uninstall_dry_run into chat/mcp_bridge.rs:604, and the only thing holding it is the unit test at lines 648-665 of this file. AGENTS.md section 3 wants a scenario for observable output and is explicit that a unit test does not discharge that requirement; the documented escape is to state the reason in the PR body, which was not taken here.

The rocm mcp-call entry point is hidden, but it is already driven model-free elsewhere in the suite (planner_steps.rs:251 and automations_steps.rs:485 both do it), so a scenario here is practical rather than a research project.

Either add one mcp-call scenario, or add a sentence to the PR body. Not blocking.

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.

Agreed, and fixed in 8bd3b67: scenario uninstall-12 drives the assistant's rocm_command tool for an uninstall dry run through the hidden rocm mcp-call, without a model and without --allow-mutation. It asserts that the preview lists the config folder, says "Nothing was removed. Removal needs your approval." without offering a flag, and leaves the user's files in the config folder. I checked that it goes red when the assistant's footer is removed, and it runs on the mock lane on every PR. It adds one more id to the range that overlaps with #569.

On the review's question about the silence for a captured run: it is deliberate. A caller that captures the output owns the next step and the command cannot know what it is, so naming one, even the literal "again without --dry-run and with --yes", would address the wrong reader. The doc comment on PlanAudience::Captured and the PR text record that, and uninstall-08 pins the silence together with the state: the plan is listed, no step is offered, and nothing is removed.

Comment thread docs/architecture.md Outdated
- [`tool_policy.rs`](../apps/rocm/src/tool_policy.rs) — the chat assistant's tool-call policy: which `rocm` commands and bridge tools a model may request, which run immediately and which need the user's approval first. It owns `ChatRocmCommandAction` (read-only, or approval with the titles the approval prompt shows) and `ChatToolApprovalRequest`, the validators (`validate_chat_tool_call`, the `validate_chat_*_tool_call` family, `validate_required_chat_string`, `validate_optional_chat_integer`, `reject_control_characters_in_tool_arguments` (which refuses a model-supplied tool name or argument carrying a terminal control character, for every tool except `rocm_command`, whose argv `normalized_chat_rocm_command_args` screens entry by entry), `validate_serve_command_safety`, the four rules a model-proposed `serve` must satisfy (no public bind, no CPU device, a loopback host, `--managed` without `--foreground`), and `validate_chat_rocm_command_safety`, which applies them to a `serve` argv and also refuses a system install folder (`chat_install_prefix_is_system`)), the classifiers (`chat_rocm_command_action`, `chat_rocm_command_action_from_args`, `chat_install_driver_action`, `canonicalize_chat_rocm_command`, `normalized_chat_rocm_command_args`, `chat_tool_call_is_read_only`), `chat_tool_approval_request`, and the readers that turn a tool call into its argv and one-line command (`rocm_chat_tool_requested_args`, `rocm_chat_tool_requested_command`, with `push_optional_json_cli_arg` and `json_string`). It moved verbatim from `chat.rs` with the tests that exercise only these items. It depends on [`rocm_argv.rs`](../apps/rocm/src/rocm_argv.rs), `providers::ChatToolCall`, `service_launch::is_loopback_host`, `services_text::validate_service_id`, `shell_quote::has_terminal_control_character`, `therock::RuntimeVersionSelector` and `driver_install::host_install_driver_only_reports`, none of which imports `chat`, so `freeform_planner.rs` calls `validate_serve_command_safety` and `validate_chat_rocm_command_safety` here instead of through `chat`, and keeps no copy of the serve rules. `chat.rs`'s child modules call into it and `chat.rs` re-exports `validate_chat_tool_call`, `chat_tool_call_is_read_only` and `chat_tool_approval_request` (read by `dash_seam.rs`), and `ChatRocmCommandAction`, `chat_install_driver_action`, `chat_rocm_command_action_from_args` and `rocm_chat_tool_requested_args`, which only other modules' tests read as `crate::chat::<item>` (`driver_plan.rs`, `system_packages.rs`).
- [`uninstall.rs`](../apps/rocm/src/uninstall.rs) — mechanical relocation, owns types: `uninstall()`, plus the installer `PATH` undo and running-executable deletion. The shared plan type and its file-removal helpers live in [`uninstall_plan.rs`](../apps/rocm/src/uninstall_plan.rs) below instead, because [`storage.rs`](../apps/rocm/src/storage.rs) reuses them too. The two modules depend on each other: `uninstall_plan.rs` reads this module's `pub(crate)` `PathEdit`, `PATH_EDIT_RECORD`, `plan_path_edits`, `plan_is_empty`, `removal_count` and `render_extra_plan`.
- [`uninstall.rs`](../apps/rocm/src/uninstall.rs) — mechanical relocation, owns types: `uninstall()`, the refusal of the hidden `--force` (`reject_force`, which `main.rs` calls from the `uninstall` dispatch arm), plus the installer `PATH` undo and running-executable deletion. The shared plan type and its file-removal helpers live in [`uninstall_plan.rs`](../apps/rocm/src/uninstall_plan.rs) below instead, because [`storage.rs`](../apps/rocm/src/storage.rs) reuses them too. The two modules depend on each other: `uninstall_plan.rs` reads this module's `pub(crate)` `PathEdit`, `PATH_EDIT_RECORD`, `plan_path_edits`, `plan_is_empty`, `removal_count` and `render_extra_plan`.
- [`uninstall_plan.rs`](../apps/rocm/src/uninstall_plan.rs) — mechanical relocation, shares crate-visible types (Phase 6f, ROCMAI-212): the uninstall-plan types (`UninstallOptions`, `UninstallPlan`, `UninstallPlanEntry`), building the plan (`build_uninstall_plan`, `plan_installed_binaries`, and the installed-binary/shared-cache discovery helpers behind them), rendering it (`render_uninstall_dry_run`, `render_uninstall_plan`), the `[y/N]` confirmation prompt (`confirm_uninstall`), and the filesystem removal primitive both [`uninstall.rs`](../apps/rocm/src/uninstall.rs) and [`storage.rs`](../apps/rocm/src/storage.rs) call to carry a plan out (`remove_path`, and the entry-resolution helpers behind it). Kept separate from `uninstall.rs` rather than folded into it, since `uninstall.rs`'s own doc comment and name both describe `uninstall()`'s exclusive logic (the installer `PATH` undo and running-executable deletion), while this module's plan/render/removal helpers are shared with `storage.rs`. `main.rs` (`UninstallOptions`), `uninstall.rs`, `storage.rs`, `runtimes_cmd.rs`, `chat/mcp_bridge.rs`, and [`deletion_properties.rs`](../apps/rocm/src/deletion_properties.rs) (Unix-only property tests) each import the subset of these `pub(crate)` types and helpers they need; see this module's own doc comment for which symbol each one uses.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PlanAudience is missing from both symbol inventories: this line (the uninstall_plan.rs entry) and the module doc comment at apps/rocm/src/uninstall_plan.rs lines 22-40, which this diff does not show.

Both places enumerate the types the module owns and exactly which symbols each consumer imports. Neither lists PlanAudience, which is now imported by uninstall.rs:24 and by deletion_properties.rs (the uninstall_case property, line 676). The sibling uninstall.rs entry on the line just above was updated for reject_force, so the convention is plainly still live.

AGENTS.md section 6 puts keeping an entry's description true on the author. Not blocking.

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.

Fixed in 5e7eecb: PlanAudience is now in the module doc comment of uninstall_plan.rs and in its entry in docs/architecture.md, together with its importers: uninstall.rs, which picks it from interactive_terminal, and the uninstall_case property in deletion_properties.rs, which renders as Captured. Both also say that chat/mcp_bridge.rs reaches the assistant audience through render_uninstall_dry_run and does not import the type. cargo xtask check-architecture-doc and the link check pass.

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. The dry-run footer, the --force refusal, and the scenario coverage match what #788 asks for, and CI is green on the current head. One non-blocking doc nit inline.

Comment thread apps/rocm/src/uninstall_plan.rs Outdated

impl PlanAudience {
/// The audience for `rocm uninstall` itself, from whether the process has a
/// terminal on both streams.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nit: the doc says "a terminal on both streams", but interactive_terminal() checks stdin and stdout. With stdin redirected at a terminal (rocm uninstall --dry-run < /dev/null) the audience is Captured and no footer is printed. Suggest "stdin and stdout are terminals" (and optionally mention stdin in the README wording).

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.

Fixed in ea66537: interactive_terminal() checks stdin and stdout, as you say, so a dry run with either one redirected, --dry-run < /dev/null at a terminal for one, is answered as a captured run and prints no footer. The doc comment on PlanAudience::for_command now says so, and the README, manual-testing.md, testing.md and the comment above uninstall-08 name both streams instead of speaking of output. The PR text is updated the same way.

…terminals

`interactive_terminal()` checks stdin and stdout, so a dry run with either one redirected, for example `rocm uninstall --dry-run < /dev/null` at a terminal, is answered for a captured caller and prints no footer. The doc comment on `PlanAudience::for_command` said "a terminal on both streams", and the README, manual-testing.md, testing.md and the comment above uninstall-08 spoke of output that is not read at a terminal. They now name both streams.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
`PlanAudience` is imported by `uninstall.rs`, which picks it from `interactive_terminal`, and by the `uninstall_case` property in `deletion_properties.rs`, which renders as `Captured`; `chat/mcp_bridge.rs` reaches the `Assistant` audience through `render_uninstall_dry_run` and does not import it. The module doc comment and the `uninstall_plan.rs` entry in docs/architecture.md listed the types the module owns and each consumer's imports, and named neither the type nor those two importers.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
The footer "Nothing was removed. Removal needs your approval." reaches users through the assistant's `rocm_command` tool and was held only by a unit test. Scenario uninstall-12 drives the hidden `rocm mcp-call` entry point without a model, asserts the preview lists the config folder and says removal needs approval without offering a flag, and checks that the folder still holds the user's files. The call is made without `--allow-mutation`, and the isolated environment the other uninstall steps use is now one helper they share.

Signed-off-by: Jussi Elo <jussi.elo@amd.com>
@jussielo-amd
jussielo-amd added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 951d2cb Nov 9, 2026
36 of 37 checks passed
@jussielo-amd
jussielo-amd deleted the issue-788-uninstall-footer-force-help branch November 9, 2026 16:18

@nowycondro nowycondro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖 Automated review · review-code · head 8bd3b676d383

Review — needs work

Full review of the whole change (11 files, +787/-46). Implements all three fixes issue #788 asks for (dry-run footer wording by audience, the --force mis-suggestion, and --help examples) and its own "Fixes #788" claim holds — the diff matches the issue on all three points, and the PR description's claims about scope match the diff with no overclaim found.

Blocking

  • docs/testing.md cites the wrong test for the assistant footer, and omits the scenario this very commit added — docs/testing.md:1224-1226 (added by this diff)
    The sentence says the assistant preview's "removal needs approval" line "...which lifecycle_read_mutate_split_is_honest in tool_policy.rs backs." Read directly: lifecycle_read_mutate_split_is_honest (apps/rocm/src/tool_policy.rs:2047) only asserts that uninstall --dry-run is classified read-only in a read/mutate verb list — it never touches the literal footer string. The test that actually pins that exact string is assistant_dry_run_footer_names_no_command in apps/rocm/src/uninstall_plan.rs:661 (output.ends_with("\nNothing was removed. Removal needs your approval.\n")), and the new e2e scenario exercising the same path end-to-end through the real rocm mcp-call entry point is uninstall-12 (tests/e2e-cucumber/features/uninstall.feature:152, added by this exact commit, "test(uninstall): pin the assistant's uninstall preview with a scenario"). Neither is named in the doc paragraph, even though every other new scenario (uninstall-07 through uninstall-11) is cited by number in the same sentence group. This is the project's own documented requirement (AGENTS.md §5: keep docs/testing.md in sync with behavior changes in the same commit) applied to the exact claim this commit was written to pin — a maintainer or future editor of tool_policy.rs's classifier would reasonably believe that file is what guards this message's wording, when it is not.
    Confidence 85 · mechanical · Fix: point the sentence at assistant_dry_run_footer_names_no_command (and/or uninstall-12) instead of, or in addition to, lifecycle_read_mutate_split_is_honest.

Non-blocking

  • New run_uninstall_at_terminal duplicates the isolated-env setup instead of reusing the new isolated_env() helper — tests/e2e-cucumber/tests/e2e/uninstall_steps.rs:497-512 vs. uninstall_steps.rs:82-89
    Both functions are new in this diff. isolated_env(world) builds the same HOME/UV_CACHE_DIR/HF_HOME triple that run_uninstall_at_terminal re-derives inline a few hundred lines later, even though the commit's own message describes the isolation setup as "now one helper they share." Functionally identical today (verified by reading both), so no behavioral defect, but it is the kind of duplication the helper was introduced specifically to avoid, and the two will drift if either path's isolation needs change.
    Confidence 75 · mechanical · Fix: have run_uninstall_at_terminal call isolated_env(world) and append its own ROCM_CLI_CONFIG_DIR entry.

Decisions for the author

  • Hidden --force relies on clap's suggestion-ranking preferring an exact (if hidden) name over --force-dev-binaries — tradeoff
    This is an internal clap behavior (hidden args still rank for "did you mean"), not a documented contract, so a future clap upgrade could in principle stop suggesting hidden flags and silently hand the destructive suggestion back to users. The author has already mitigated this well: cli.rs carries a dedicated regression test asserting rendered.contains("--force") && !rendered.contains("force-dev-binaries"), which would fail loudly (not silently) if that clap behavior ever changes. Worth the author's explicit confirmation that this coupling is accepted, since it is a dependency on an implementation detail rather than a documented API.

Positive signals

  • PlanAudience::for_command is built on the existing interactive_terminal() predicate (stdin and stdout both ttys) rather than a new ad hoc check, so the "run it again" footer's implicit promise that a rerun hits the same confirmation path stays consistent with what a rerun actually does.
  • The "Captured" classification is robustly guaranteed, not just assumed: both of the two cited indirect callers — the daemon's rocm_command MCP tool and the dash-TUI's /uninstall slash command — route through rocm_core::run_with_timeout, which hardcodes stdin(Stdio::null())/stdout(Stdio::piped()) (crates/rocm-core/src/process.rs:1076-1081), so neither can ever be misclassified as Terminal. The assistant's in-process preview (chat/mcp_bridge.rs) sidesteps tty detection entirely by passing PlanAudience::Assistant directly. Traced all three call paths; none can print the wrong footer.
  • reject_force is the single, exhaustively-wired gate: confirmed by full-repo search that there is exactly one call site building Command::Uninstall and exactly one caller of uninstall(), with the rejection running before any plan is built or AppPaths::discover runs.

Deployment notes

None.

What this covered

Read completely at head 8bd3b676d3838c13a5ce5d302275ff707da3dcc3 (base 1ab8f7f83f6cc3e083d8823d89fdfc1a49b99b96): all 11 changed files (README.md; apps/rocm/src/{cli.rs,main.rs,uninstall.rs,uninstall_plan.rs,deletion_properties.rs}; docs/{architecture.md,manual-testing.md,testing.md}; tests/e2e-cucumber/{features/uninstall.feature,tests/e2e/uninstall_steps.rs}), via three independent fan-out passes grouped by coupling (core Rust logic; e2e tests; docs), each working from a local non-checked-out clone (git show/git diff, no git checkout). Extended into surrounding/caller code for the design-review pass: apps/rocm/src/chat/mcp_bridge.rs, apps/rocm/src/tool_policy.rs, apps/rocmd/src/{mcp.rs,mcp_argv.rs,common.rs}, crates/rocm-core/src/{command_capture.rs,process.rs}, crates/rocm-dash-tui/src/agent/tools.rs. Agent-instruction adherence (this repo's AGENTS.md) was checked as part of each pass rather than as a separate one.

CI: all 36 check runs for this head were success or correctly-skipped (Skill checks (skillscope), inapplicable here) at the time of this review, except two hardware-lane E2E jobs (MI300X, W7900) shown queued from an older workflow run — not evidence of a failure, just unresolved at read time; no failing check was observed.

Did not run: "history" (deep git log/git blame across this repo's full history) — only the two specific commits (base, head) were fetched, so no pre-existing-bug context beyond the diff itself was available. "Prior changes" (whether earlier review comments on these same files recurred here) — not retrievable without reading this PR's own review thread, which the blind-review method excludes.

Not reconciled against this PR's own review thread: the mandatory pre-review duplicate-review check (reading get_reviews) necessarily exposed this reviewer to the existing human reviews' text (from r0x0r and juhovainio) before findings were produced. No finding above was derived from that text — both were reached independently by the fan-out workers and verified first-hand against the code (the clap-suggestion tradeoff and the "Captured" design question were both raised by this review's own Worker A before being cross-checked against what was already visible in the thread) — but full blind independence from that incidental exposure cannot be certified, and this report has not otherwise been reconciled against anything said in that thread.


Not a human review. This is an automated code review; please verify findings independently before acting on them.

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.

uninstall: --dry-run footer, --force tip and help text point users the wrong way

5 participants