Repository navigation
Conversation
|
Refreshed this PR against current
Focused suites, headless static coverage, and an isolated real-CLI/systemd failure/retry smoke passed, including real child supervision and timeout cases. The aggregate suite was run but is not green: the VS Code CLI assertion and three shell suites fail identically on pristine upstream in this environment. Exact failures and the base revision are recorded in the updated PR description; no unrelated tests were changed or suppressed. I also reviewed #11470, which addresses the same external-state cleanup need. The contracts differ on Would maintainers prefer this failure-blocking pre-remove contract, the uninstall contract in #11470, or an aligned subset? I'd be happy to coordinate on one supported approach rather than introduce parallel lifecycle APIs. Aperture's marketplace review target remains frozen; this update does not claim its listing blocker is resolved. |
|
Verification follow-up: The repairs are isolated commits: Important qualification: the passwordless lifecycle contract depends on still-open omacom/omarchy-pkgs#257. The green run used current package master The prior four aggregate failures are resolved under those documented prerequisites; no failure was skipped or suppressed to obtain this result. Aperture remains frozen. |
|
This is a meaningful design addition (plugins running their own code at removal), so I think it needs a maintainer call before detailed review. A couple of notes to help with that:
|
Keep the change scoped to plugin cleanup, validation, documentation, and regression coverage. Transfer inherited environment through a private pipe and require normal zero-exit completion in addition to successful cgroup supervision.
1d361a7 to
abb5af7
Compare
|
Thanks @jandrusk — I’ve narrowed the PR to the generic pre-removal cleanup feature, its documentation, and regression coverage.
An adversarial review also identified two executor issues, now addressed:
Aperture has since been accepted into the marketplace, so this proposal is no longer a prerequisite for its listing. @dhh @ryanrhughes: would you prefer this failure-blocking |
Why
Plugins can own registrations or other state outside their checkout. Removing the checkout first leaves that state behind and can remove the executable needed to clean it up.
Add one optional manifest declaration,
hooks.preRemove, so a plugin can finish its own cleanup before Omarchy removes it. Once declared, successful cleanup is required for removal; there is no bypass flag.Usage
{ "hooks": { "preRemove": "bin/cleanup" } }Interactive removal asks separately for permission to run cleanup and confirmation to remove the plugin.
--yesskips ordinary removal confirmation, not authorization to execute the hook. After reviewing the current executable, scripts can authorize both explicitly:omarchy plugin validate <folder>validates the declaration without executing plugin code.Behavior
.., control characters, and symlinks in the hook path; the installed plugin directory may itself link to a development checkout.okacknowledgment when disabling an enabled plugin. A rejected request or lost connection retains the checkout; cleanup may already have completed and runs again on retry.Execution
The hook runs directly as an executable, respecting its shebang rather than being sourced or forced through Bash. It receives no arguments, uses the physical checkout as its working directory, inherits the caller's environment and privileges, and reads standard input from
/dev/null. Omarchy does not invokesudo.A transient systemd user service supervises the hook and its inherited cgroup, including remaining children after the hook leader exits. The runtime limit is 60 seconds, followed by a 5-second stop grace period. Execution requires a reachable systemd user manager; validation does not.
The caller's environment travels through a private pipe to an Omarchy-owned Python runner, not through command-line arguments or unit properties. The runner supplies the hook with standard input at EOF and writes a private completion receipt only after a normal zero exit. Removal requires both that receipt and successful supervised service completion; systemd's treatment of some signal deaths as successful is not sufficient. The helper removes its temporary completion record on exit.
This is unsandboxed plugin code. Snapshot checks are not atomic protection against hostile concurrent edits, and process supervision is not a sandbox. Hooks must clean up only their own state, wait for their work, and return zero only when cleanup is complete.
Scope
One pre-removal hook, shared validation/execution helper, private-environment runner, CLI integration, documentation, and regression coverage. No install/update hooks, activation ledger, package-management framework, or changes to individual plugins.
The diff is limited to generic plugin cleanup. It does not include VS Code test repairs, kernel fixture repairs, passwordless-sudo prerequisite documentation, or dependencies on Aperture, OMP, or a particular development environment.
Verification
This revision is based on
quattroat492b8837deea69663c7a5418871f07ed075a9686.Context