[PR #399] [CLOSED] fix(setup): drop a refused engine archive instead of reusing it #2622

Closed
opened 2026-11-04 02:01:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/399
Author: @alphastorm
Created: 10/1/2026
Status: ❌ Closed

Base: main ← Head: fix/397-refused-engine-archive


📝 Commits (1)

  • bafaf0a fix(setup): drop a refused engine archive instead of reusing it

📊 Changes

2 files changed (+34 additions, -5 deletions)

View changed files

📝 setup.py (+6 -4)
📝 tools/test_setup_pins.py (+28 -1)

📄 Description

Fixes #397.

When get_prebuilt refused a downloaded engine archive (older than MIN_ENGINE, or without code for the GPU), it kept engine/<asset> and its .done mark. download() trusts the mark, so every later run unpacked the same refused archive again instead of downloading. On the update path, "run this again in a few minutes to update it" could not work until the archive was deleted by hand.

Change

  • setup.py (get_prebuilt): the archive and its .done mark are deleted in a finally right after unpacking, so a refused or unreadable archive is not kept. The success path already deleted both; those two lines move into the finally.

Behavior changes

  • While a release's assets are still uploading, each update run downloads the latest release's archive again (107 MB for strata-windows-x64.zip at 0.1.31) before refusing it, instead of reusing the refused copy.
  • An archive refused for the GPU (setup compiles instead) no longer stays in engine/.
  • An archive that fails to unpack is deleted too, so the next run downloads it again instead of failing on the same file.

Tests (python -m unittest tools.test_setup_pins, no network)

  • Engine.test_an_archive_refused_as_too_old_is_not_reused and Engine.test_an_archive_refused_for_the_gpu_is_not_reused run get_prebuilt with the real download() over a --prebuilt folder that first holds a refused archive and then the right one. Both fail on 9259cad (the second run returns None) and pass with the change.
  • Every Python test module (serve/test_*.py, tools/test_*.py, 17 modules) gives the same result as on 9259cad apart from the two new tests: 219 tests, 7 skipped, with STRATA_GGUF_PY set for tools.test_iq_pack. This was on Python 3.13.15, macOS arm64. ruff and pyright report nothing new in the changed files.

Also checked

  • The update path over a local HTTP server standing in for GitHub (PREBUILT_URL and PREBUILT_TAG_URL patched, real download()), with an installed 0.1.30 engine and at first only a 0.1.30 archive under latest/. On 9259cad, after the 0.1.31 archive is published, the next two runs each send one HEAD, print "Strata engine already downloaded" and refuse the 0.1.30 archive again. With the change, the next run downloads and installs 0.1.31, and the run after that keeps it without a request.
  • An archive that is not a zip: both versions raise BadZipFile; on 9259cad the archive and its .done stay, with the change both are gone.

Not run: Windows, a GPU, or a real release download.

This change was part of #324, which 0.1.31 superseded.


🔄 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/399 **Author:** [@alphastorm](https://github.com/alphastorm) **Created:** 10/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/397-refused-engine-archive` --- ### 📝 Commits (1) - [`bafaf0a`](https://github.com/Niko1221/Strata/commit/bafaf0ac7c2c11c1e5616d9dbb9d8f11f0ce1bdc) fix(setup): drop a refused engine archive instead of reusing it ### 📊 Changes **2 files changed** (+34 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `setup.py` (+6 -4) 📝 `tools/test_setup_pins.py` (+28 -1) </details> ### 📄 Description Fixes #397. When `get_prebuilt` refused a downloaded engine archive (older than `MIN_ENGINE`, or without code for the GPU), it kept `engine/<asset>` and its `.done` mark. `download()` trusts the mark, so every later run unpacked the same refused archive again instead of downloading. On the update path, "run this again in a few minutes to update it" could not work until the archive was deleted by hand. **Change** - `setup.py` (`get_prebuilt`): the archive and its `.done` mark are deleted in a `finally` right after unpacking, so a refused or unreadable archive is not kept. The success path already deleted both; those two lines move into the `finally`. **Behavior changes** - While a release's assets are still uploading, each update run downloads the latest release's archive again (107 MB for `strata-windows-x64.zip` at 0.1.31) before refusing it, instead of reusing the refused copy. - An archive refused for the GPU (setup compiles instead) no longer stays in `engine/`. - An archive that fails to unpack is deleted too, so the next run downloads it again instead of failing on the same file. **Tests** (`python -m unittest tools.test_setup_pins`, no network) - `Engine.test_an_archive_refused_as_too_old_is_not_reused` and `Engine.test_an_archive_refused_for_the_gpu_is_not_reused` run `get_prebuilt` with the real `download()` over a `--prebuilt` folder that first holds a refused archive and then the right one. Both fail on `9259cad` (the second run returns `None`) and pass with the change. - Every Python test module (`serve/test_*.py`, `tools/test_*.py`, 17 modules) gives the same result as on `9259cad` apart from the two new tests: 219 tests, 7 skipped, with `STRATA_GGUF_PY` set for `tools.test_iq_pack`. This was on Python 3.13.15, macOS arm64. ruff and pyright report nothing new in the changed files. **Also checked** - The update path over a local HTTP server standing in for GitHub (`PREBUILT_URL` and `PREBUILT_TAG_URL` patched, real `download()`), with an installed 0.1.30 engine and at first only a 0.1.30 archive under `latest/`. On `9259cad`, after the 0.1.31 archive is published, the next two runs each send one `HEAD`, print "Strata engine already downloaded" and refuse the 0.1.30 archive again. With the change, the next run downloads and installs 0.1.31, and the run after that keeps it without a request. - An archive that is not a zip: both versions raise `BadZipFile`; on `9259cad` the archive and its `.done` stay, with the change both are gone. Not run: Windows, a GPU, or a real release download. This change was part of #324, which 0.1.31 superseded. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:01:49 +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#2622
No description provided.