refactor(uninstall): adopt the shared elevation gate#545
Closed
githubrobbi wants to merge 1 commit into
Closed
Conversation
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>
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 free
to 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.
What
Migrate
uffs --uninstallonto the sharedcommands::elevationgate thatuffs --updatealready uses, so both flows share one implementation of "surface admin-only work up front, decide once." Behavior-preserving (the tracked follow-up from #544).offer_inflow_elevation: uninstall passestrue(Windows 3-way elevate/continue/abort,action = "removal"); update passesfalse(binary continue/abort).GateWordingregainsaction;ElevationChoiceregainsElevateLater(wasElevateAtRemoval).RemovalPlanimplementsElevatablePlan(inherentrequires_elevation/drop_elevation_requiredmoved into the trait impl forsame_name_method;render_elevation_neededdelegates torender::print_elevation_gate).uninstall/mod.rsdrops ~90 lines.Validation
147 uffs-cli tests green; native +
x86_64-pc-windows-msvcclippy + rustdoc clean.