Repository navigation
Add opt-in release pruning after switch - #2
Merged
Merged
Conversation
Keep current and the highest lower SemVer, including pre-releases, to stop release directories accumulating on small deployment disks. Prune only after a verified switch so staged uploads survive deploy, and leave automatic cleanup opt-in for shared consumers. Add a standalone dry-run task and exercise guarded shell deletion through the fake executor against temporary release trees. Document rollback, serialization and rollout requirements.
Separate the command-success marker with NUL boundaries so a directory whose name ends with the marker cannot disguise an incomplete listing. Cover the false-success case through the fake executor.
Push Cartel switches before stopping the old BEAM. Capture current on each host before replacing it and retain that exact release so an unused RC cannot displace the running release or rollback target. Keep the rolled-back-from release available for rolling forward too. Without switch context, prefer the highest lower stable release and fall back to a pre-release only when no stable exists. Preserve rollback targets on same-version retries, validate captured releases, and cover the updated policies in tests and documentation.
y86
marked this pull request as ready for review
November 3, 2026 20:46
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.
Push Cartel hosts have 16 GB disks at 85–93% utilization because every deploy retains another ~32 MB release. The 2026-11-01 inventory found 90 release directories on pushboy-1a, with about 2.68 GB removable. Add explicit retention so operators can reclaim that space and prevent further accumulation.
config :dicon, prune_on_switch: trueto capture each host's current release before replacing the symlink, then prune withexpected_current: new, keep_previous: old. Retain the exact previously selected release, whether stable, an RC, or newer than current after rollback. For example, switching1.7.5→1.7.6keeps1.7.5and deletes an unused1.7.6-rc4. This preserves the old running release and rollback target throughout Push Cartel's switch → stop → start sequence. Rolling back retains the release rolled back from, so rolling forward requires no redeploy.mix dicon.prune [--dry-run], with the existing--only/--skiphost filters and per-host retention/deletion output. Without switch context, keep current and the highest stable (non-pre-release) SemVer below it; fall back to the highest pre-release below current only when no lower stable exists. UseVersion.compare/2, with deterministic directory-name ordering for build-metadata ties. Delete all other version directories, including unused RCs and newer experiments; preserve non-version entries, files and symlinks.Serialize deploy, switch and prune on each host; there is no deployment lock. Standalone prune must not run between upload and switch. It has no switch history and can remove an RC or newer release retained by automatic pruning, so inspect its dry run and stop any process using a release it would delete first. A pruning error stops the task without undoing completed switches/deletions.
Cross-system impact: existing consumers retain their behavior until opting in. Rollout requires updating their dicon dependency and setting the new application config; several sibling repos currently constrain dicon to
~> 0.5. No service configuration, runtime protocol, database, or production host changes are included.Validation on w2 with Elixir 1.18.4 / OTP 27.3.4.16:
--warnings-as-errors: 35 tests, 0 failures. Cover the RC-on-disk switch, actual previous RC retention, rollback/roll-forward, stable-first standalone selection, pre-release fallback, first switch, retry, and capture failures.mix format --check-formatted,mix compile --warnings-as-errors,mix deps.unlock --check-unused, andgit diff --check: pass.7414456: 15 tests, 2 failures): tests expect empty connection options but existing deploy forwardsapps_env. Existing executor tests also emit charlist deprecation warnings on this runtime. These unrelated tests remain unchanged.mix deps.getcould not start because the checkout pins uninstalled Elixir 1.12.3 / OTP 23.3.4.20. With installed runtime versions selected via environment variables, dependency resolution succeeded and reported the existing retiredearmark 1.2.2. No dependency or tool-version changes.