[PR #990] [MERGED] horizon-server: delete old releases after an update #2967

Closed
opened 2026-11-02 16:00:29 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/990
Author: @ludovic111
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @ludovic111

Base: main ← Head: feat/server-prune-releases


📝 Commits (1)

  • ee3e874 horizon-server: delete old releases after an update

📊 Changes

4 files changed (+194 additions, -6 deletions)

View changed files

📝 crates/horizon-server/src/config.rs (+20 -0)
📝 crates/horizon-server/src/supervisor.rs (+41 -4)
📝 crates/horizon-server/src/update.rs (+125 -0)
📝 docs/server.md (+8 -2)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

horizon-server kept every release it had unpacked in <dir>/releases/, so every update made the install bigger. Now, once an update has succeeded, it deletes the old releases. These stay:

  • the release current points at (the one in use);
  • the release previous names, which rollback needs;
  • the release the running horizon-server itself came from;
  • the updates.keep newest of the others. This is a new server.toml setting, 1 by default:
    [updates]
    keep = 1                     # other releases kept by updates, besides the one in use and the one rollback goes to
    

When pruning runs:

  • Running server: when the supervisor sees the new game up. Its "Now on … (was …): the game is up" log line, status and the panel then also say what was deleted.
  • Stopped server: after update switches it, and the CLI prints the same.

If current points nowhere, nothing is deleted. These are never touched:

  • .<tag>.unpacking, an update in progress;
  • plain files.

A release that can't be deleted is reported and left for the next update. That happens on Windows when a program still runs from it. Releases are sorted by tag number, and hand-installed archives count as the oldest.

Why

Brief server-host-11, task 3: keep the current and previous releases plus a configurable count, prune after a successful update, and never remove what current or the rollback points to.

Tested

New unit tests:

  • update::tests::pruning_keeps_current_previous_and_the_newest_others. It covers six releases, with previous on the oldest after a rollback, a hidden .unpacking folder, a stray file, keep 1 then 0, and a missing current.
  • supervisor::tests::a_game_that_comes_up_ends_the_update_and_prunes_old_releases. It switches v1 → v3 with keep = 0: v2 is deleted, v1 stays for rollback, and the update message names what went.

Self-check

  • cargo fmt --all -- --check: clean.
  • cargo clippy -p horizon-server --all-targets -- -D warnings: clean.
  • cargo test -p horizon-server: 39 passed.
  • tools/parity.py --changed origin/main: 0 of 323 harnesses depend on these files.

Nothing needs Ludovic.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/990 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/server-prune-releases` --- ### 📝 Commits (1) - [`ee3e874`](https://github.com/horizon-rust/horizon/commit/ee3e874eb89097fa887d0cb64d8700e7bf85b02a) horizon-server: delete old releases after an update ### 📊 Changes **4 files changed** (+194 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-server/src/config.rs` (+20 -0) 📝 `crates/horizon-server/src/supervisor.rs` (+41 -4) 📝 `crates/horizon-server/src/update.rs` (+125 -0) 📝 `docs/server.md` (+8 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `horizon-server` kept every release it had unpacked in `<dir>/releases/`, so every update made the install bigger. Now, once an update has succeeded, it deletes the old releases. These stay: - the release `current` points at (the one in use); - the release `previous` names, which `rollback` needs; - the release the running `horizon-server` itself came from; - the `updates.keep` newest of the others. This is a new `server.toml` setting, 1 by default: ```toml [updates] keep = 1 # other releases kept by updates, besides the one in use and the one rollback goes to ``` When pruning runs: - **Running server:** when the supervisor sees the new game up. Its "Now on … (was …): the game is up" log line, `status` and the panel then also say what was deleted. - **Stopped server:** after `update` switches it, and the CLI prints the same. If `current` points nowhere, nothing is deleted. These are never touched: - `.<tag>.unpacking`, an update in progress; - plain files. A release that can't be deleted is reported and left for the next update. That happens on Windows when a program still runs from it. Releases are sorted by tag number, and hand-installed archives count as the oldest. ## Why Brief server-host-11, task 3: keep the current and previous releases plus a configurable count, prune after a successful update, and never remove what `current` or the rollback points to. ## Tested New unit tests: - `update::tests::pruning_keeps_current_previous_and_the_newest_others`. It covers six releases, with `previous` on the oldest after a rollback, a hidden `.unpacking` folder, a stray file, `keep` 1 then 0, and a missing `current`. - `supervisor::tests::a_game_that_comes_up_ends_the_update_and_prunes_old_releases`. It switches v1 → v3 with `keep = 0`: v2 is deleted, v1 stays for rollback, and the update message names what went. ## Self-check - `cargo fmt --all -- --check`: clean. - `cargo clippy -p horizon-server --all-targets -- -D warnings`: clean. - `cargo test -p horizon-server`: 39 passed. - `tools/parity.py --changed origin/main`: 0 of 323 harnesses depend on these files. Nothing needs Ludovic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 16:00:29 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2967
No description provided.