[PR #1265] [CLOSED] Add the engine updater: verify, stage, all-or-nothing swap, rollback #3345

Closed
opened 2026-11-07 14:40:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1265
Author: @demetree
Created: 10/6/2026
Status: ❌ Closed

Base: main ← Head: update-core


📝 Commits (1)

  • 530bfbe Add the engine updater: verify, stage, all-or-nothing swap, rollback

📊 Changes

6 files changed (+2683 additions, -0 deletions)

View changed files

📝 docs/DETAILS.md (+38 -0)
📝 docs/INSTALL.md (+20 -0)
📝 serve/server.py (+116 -0)
➕ serve/test_update.py (+1061 -0)
➕ serve/test_update_http.py (+501 -0)
➕ serve/update.py (+947 -0)

📄 Description

#1162 split in two so each half is reviewable on its own

The combined PR was +3005 lines across 9 files. The safety-critical engine mechanism and its tests belong to a
maintainer who wants to read the security model; the UI card is separable and thin. They are stacked - PR
"UI" is based on the "core" branch and lands after it - and they share the API routes in server.py, which
is the one place they legitimately depend on each other.

PR A - the engine updater, serve/ server-side, with the two checker scripts and the docs

What it is: a new serve/update.py, the /api/update/check|apply|state routes in serve/server.py, the
four step labels enforced against the server responses (no drift), the two test files, and the documentation
of what the update does and how it was measured.

Why it is this shape, one paragraph:

The engine is replaced in place, so the design's whole job is to never leave a mixture of two engines
behind it. Nothing on disk changes until every check has passed (the archive's SHA-256 from the releases
API, its own members' CRC and path checks, the version inside, whether this GPU has code in it, and the
staged binary run with --help in the engine's own environment). Only then is the installed engine copied
to engine/.previous - the same place, same generation, setup.py keeps - and swapped, all or nothing,
under the service's own lock. A failure restores the backup and removes anything the new engine added,
because restoring alone leaves the mixture. Measured live on the v0.1.40.1 release on this machine: 18 s
end to end, the official CUDA 13 build was refused for this GPU, and a same-length different-content file
was refused and deleted.

Tests: serve/test_update.py 143 checks, serve/test_update_http.py 51 over real HTTP handlers, no network.
pytest serve 473 passed, 8 skipped.

PR B - the card (base: update-core)

Adds the Update the engine card to the About tab, wired to the routes PR A provides. Each step carries
its own status and note from the server, and the done note names the engine version the install reported
back, not the release tag - the two are not always the same, and a hotfix release such as v0.1.40.1 ships the
v0.1.40 engine. Verified end to end in a browser against the live v0.1.40.1 release. Two live UI bugs were
found and fixed while doing that: a missed bare() strip on one writer that read vv0.1.40.1, and /metrics
polling overwriting the server's tag with BUILD.json's engine version, which could re-offer an update that
had already finished.

The base is update-core because PR B calls its routes; once PR A merges, GitHub will offer to rebase and
the diff shrinks to just the three web files. Nothing outside serve/web/ is touched.


🔄 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/Niko1221/Strata/pull/1265 **Author:** [@demetree](https://github.com/demetree) **Created:** 10/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `update-core` --- ### 📝 Commits (1) - [`530bfbe`](https://github.com/Niko1221/Strata/commit/530bfbec76d7b58411b643541776fca52253b696) Add the engine updater: verify, stage, all-or-nothing swap, rollback ### 📊 Changes **6 files changed** (+2683 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+38 -0) 📝 `docs/INSTALL.md` (+20 -0) 📝 `serve/server.py` (+116 -0) ➕ `serve/test_update.py` (+1061 -0) ➕ `serve/test_update_http.py` (+501 -0) ➕ `serve/update.py` (+947 -0) </details> ### 📄 Description #1162 split in two so each half is reviewable on its own The combined PR was +3005 lines across 9 files. The safety-critical engine mechanism and its tests belong to a maintainer who wants to read the security model; the UI card is separable and thin. They are stacked - PR "UI" is based on the "core" branch and lands after it - and they share the API routes in `server.py`, which is the one place they legitimately depend on each other. **PR A - the engine updater, `serve/` server-side, with the two checker scripts and the docs** What it is: a new `serve/update.py`, the `/api/update/check|apply|state` routes in `serve/server.py`, the four step labels enforced against the server responses (no drift), the two test files, and the documentation of what the update does and how it was measured. Why it is this shape, one paragraph: > The engine is replaced in place, so the design's whole job is to never leave a mixture of two engines > behind it. Nothing on disk changes until every check has passed (the archive's SHA-256 from the releases > API, its own members' CRC and path checks, the version inside, whether this GPU has code in it, and the > staged binary run with `--help` in the engine's own environment). Only then is the installed engine copied > to `engine/.previous` - the same place, same generation, setup.py keeps - and swapped, all or nothing, > under the service's own lock. A failure restores the backup *and removes anything the new engine added*, > because restoring alone leaves the mixture. Measured live on the v0.1.40.1 release on this machine: 18 s > end to end, the official CUDA 13 build was refused for this GPU, and a same-length different-content file > was refused and deleted. Tests: `serve/test_update.py` 143 checks, `serve/test_update_http.py` 51 over real HTTP handlers, no network. `pytest serve` 473 passed, 8 skipped. **PR B - the card** (base: `update-core`) Adds the **Update the engine** card to the About tab, wired to the routes PR A provides. Each step carries its own status and note from the server, and the `done` note names the engine version the install reported back, not the release tag - the two are not always the same, and a hotfix release such as v0.1.40.1 ships the v0.1.40 engine. Verified end to end in a browser against the live v0.1.40.1 release. Two live UI bugs were found and fixed while doing that: a missed `bare()` strip on one writer that read `vv0.1.40.1`, and `/metrics` polling overwriting the server's tag with BUILD.json's engine version, which could re-offer an update that had already finished. The base is `update-core` because PR B calls its routes; once PR A merges, GitHub will offer to rebase and the diff shrinks to just the three web files. Nothing outside `serve/web/` is touched. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:40:50 +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
Niko1221/Strata#3345
No description provided.