mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #634] [CLOSED] strata_pack.py build: refuse an output directory that already holds a pack, naming the file #2732
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2732
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/634
Author: @Avicennasis
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:fix/pack-occupied-output📝 Commits (1)
60ec6e7strata_pack.py build: refuse an output directory that already holds a pack, naming the file📊 Changes
2 files changed (+77 additions, -2 deletions)
View changed files
📝
tools/strata_pack.py(+21 -0)📝
tools/test_shards.py(+56 -2)📄 Description
One fail-closed change on the packer, with a test that runs without a model or a GPU.
strata_pack.py build: an occupied--outis refused before anything is writtenbuild()didout_dir.mkdir(parents=True, exist_ok=True)(tools/strata_pack.py:207) and then wroteexperts.bin(:229, throughpack_layer.build, which opens it"wb"),dense.bin,embd.binandmanifest.jsonover whatever the directory held, with nothing said. A--outpointed at a finished pack - this tool's, oriq_pack.py's, whosedense.binandexperts.binshare names with this tool's - was overwritten in place, and a build that stopped partway left the oldmanifest.jsondescribing the new, half-written files.Now a
manifest.json,index.txtornative_experts.txtin--outstopsbuildbefore it opens the GGUF or writes a byte, naming the directory and the file, and returns 1 like the other refusals inbuild:Those three are the files the engine reads a pack's identity from (
src/core/expert_source.cpp:2289, the fingerprint), so "holds a pack" means the same thing to the tool and to the engine.experts.binon its own does not count:buildwritesmanifest.jsonlast, soexperts.binwithout it is a build that did not finish, and it is rebuilt as before. An empty or absent directory proceeds as today. There is no resume to keep -pack_layer.buildhas no sidecar and rewritesexperts.binfrom the start - so none was invented. (The same rule in Swiftlet #41 and Colibri41b4544: the manifest-equivalent is refused, and only an explicit install sidecar resumes.)Where this meets setup:
setup.py:3503re-runsbuildwhenindex.txtorexperts.binis missing from the pack directory. An interrupted conversion (nomanifest.jsonyet) is rebuilt as before. A directory with a finished pack and noindex.txt(pack_index.pyinterrupted afterbuildfinished), or withexperts.bindeleted by hand, now stops setup at this message instead of rewriting the directory; deleting it and running setup again is the way through, and is what the rewrite did to it anyway.setup.pyis not touched.Test:
tools/test_shards.py(python -m unittest tools.test_shards), with the GGUF reader replaced by a sentinel so "went on into the build" is observable without the model's shards: each of the three markers is refused with the path and the file named and the directory's contents untouched; an empty and an absent directory go on into the build;experts.binwithoutmanifest.jsongoes on too.What I ran, and where
Linux x86_64 (Ubuntu 24.04, AMD Ryzen 7 5800X - no AVX-512, no NVIDIA GPU), Python 3.12.3. Nothing under
src/is touched, so nothing was built.python -m unittest tools.test_shards: 10 tests OK (the 7 from #92 plus 3). Againstmain'stools/strata_pack.pywith the same test file: 3 errors - every marker subtest, because the build goes on into the GGUF (the sentinel raises) instead of returning 1.python -m unittest tools.test_calibrate: 14 OK.git diff --checkclean.Branch is on
99f3dbd(0.1.38); happy to rebase if it has moved by the time you look.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.