Skip to content

feat: purge APT package configuration on uninstall - #32

Merged
khurrambhutto merged 3 commits into
mainfrom
feat/apt-uninstall-purge
Oct 31, 2026
Merged

khurrambhutto merged 3 commits into
mainfrom
feat/apt-uninstall-purge

Conversation

@khurrambhutto

@khurrambhutto khurrambhutto commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Normal APT uninstall now removes package configuration as well as the installed app. This also covers apps installed from local .deb files.

- apt remove -y <package>
+ apt-get -o APT::Get::AutomaticRemove=false purge -y -- <package>

Changes

  • Fix the hang when Scope is launched from a terminal: APT inherited terminal stdin in a background process group and stopped with SIGTTOU while restoring terminal modes. Close stdin for captured and streamed commands while preserving Polkit authentication and process-group cleanup.

  • Share purge arguments between simulation, the command preview, and apply. Recognize Purg actions in protected-package checks and transaction fingerprints, and reject an uninstall simulation that only removes the target.

  • Include package configuration, including obsolete conffiles, in removal estimates. The confirmation explains that personal settings and data remain.

  • Update README and agent instructions. Include the separately committed request to ignore generated brag-output/ files.

Testing

  • cargo fmt --all -- --check
  • cargo check
  • cargo test: 417 passed, 15 ignored
  • cargo clippy --all-targets --all-features --locked -- -D warnings
  • Separate isolated APT/dpkg experiments: 24 assertions passed using disposable packages, including configuration removal, retained HOME data, purge failure, and unrelated autoremove candidates. The fixtures used the new purge arguments; no host packages were changed.
  • Terminal regression tests: both timed out before the fix and pass after it. Each runs Scope's command runner under a controlling terminal. A separate disposable-package APT trace reproduced SIGTTOU; all 24 isolated checks pass with closed stdin.
  • Manual GUI uninstall against a host package

Before: uninstall retained package configuration, the simulation parser did not recognize Purg records, and APT could stop during execution when Scope inherited a launch terminal.
After: targeted Rust tests cover purge records, protected indirect purges, changed transaction effects and versions, configuration estimates, the preview command, and completion under terminal job control.

Safety

  • Targeted Rust tests added for safety-sensitive backend changes

Door: one-way. Confirmed APT uninstalls now delete package configuration through APT/dpkg.

Blast Radius: APT and shared command execution. Commands receive EOF on stdin; authentication remains with Polkit. Preview, single-use plans, apply-time simulation comparison, protection checks, and rescans remain in place. Autoremove is explicitly disabled. Home-directory data cleanup is outside this change.

@khurrambhutto
khurrambhutto merged commit ee68aa9 into main Oct 31, 2026
2 checks passed
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