Skip to content

refactor(uninstall): adopt the shared elevation gate#545

Closed
githubrobbi wants to merge 1 commit into
mainfrom
refactor/uninstall-shared-elevation-gate
Closed

refactor(uninstall): adopt the shared elevation gate#545
githubrobbi wants to merge 1 commit into
mainfrom
refactor/uninstall-shared-elevation-gate

Conversation

@githubrobbi

@githubrobbi githubrobbi commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

What

Migrate uffs --uninstall onto the shared commands::elevation gate that uffs --update already uses, so both flows share one implementation of "surface admin-only work up front, decide once." Behavior-preserving (the tracked follow-up from #544).

  • Shared gate gains offer_inflow_elevation: uninstall passes true (Windows 3-way elevate/continue/abort, action = "removal"); update passes false (binary continue/abort). GateWording regains action; ElevationChoice regains ElevateLater (was ElevateAtRemoval).
  • RemovalPlan implements ElevatablePlan (inherent requires_elevation/drop_elevation_required moved into the trait impl for same_name_method; render_elevation_needed delegates to render::print_elevation_gate).
  • Delete uninstall's local gate machinery; thin wrapper delegates to the shared gate. uninstall/mod.rs drops ~90 lines.

Validation

147 uffs-cli tests green; native + x86_64-pc-windows-msvc clippy + rustdoc clean.

Migrate `uffs --uninstall` onto the shared `commands::elevation` gate that
`uffs --update` already uses, so both flows share one implementation of
"surface admin-only work up front, decide once". Behavior-preserving.

- Extend the shared gate with `offer_inflow_elevation`: uninstall passes
  `true` (it has a one-shot elevated helper → Windows 3-way elevate/continue/
  abort, `action = "removal"`); update passes `false` (no in-flow UAC → binary
  continue/abort). `GateWording` regains `action`; `ElevationChoice` regains
  `ElevateLater` (was uninstall's `ElevateAtRemoval`).
- `RemovalPlan` now implements `ElevatablePlan` (its inherent
  `requires_elevation` / `drop_elevation_required` moved into the trait impl to
  satisfy `same_name_method`; `render_elevation_needed` delegates to
  `render::print_elevation_gate`). Call sites import the trait.
- Delete uninstall's local `ElevationChoice` + `elevation_gate` +
  `platform_elevation_choice` (both cfg); the thin wrapper delegates to the
  shared gate. uninstall/mod.rs drops ~90 lines.

147 uffs-cli tests green (incl. the 12 uninstall plan tests on the now-trait
methods); native + windows-msvc clippy + rustdoc clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@githubrobbi githubrobbi marked this pull request as draft July 8, 2026 19:59
@githubrobbi githubrobbi closed this Jul 8, 2026
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.

1 participant