Repository navigation
ci: add the missing writer for the release-asset cache transport - #5541
Merged
Merged
Conversation
ci.toml says the six app-build families that left the Actions cache in Phase A of #1801 can come back "outside this budget" via the release-asset transport (#782). Only half of that existed: ci/fetch_libs_asset.py reads a pinned asset from obs-rust/obs-studio-libs releases and verifies its sha256, and nothing in the repo could write one. Add ci/precache.py with the two verbs that close the loop: push FAMILY PLATFORM IDENTITY DIR pack, digest, upload blob + manifest pull FAMILY PLATFORM DIR read the manifest, then fetch the blob The manifest exists because fetch() deliberately requires a sha256 while a cache moves on every master push: the consumer downloads a few hundred bytes of JSON, reads the digest, and then goes through the same verified path the Qt and FFmpeg bundles already use. One reader for every big verified archive. Packing is reproducible: members are sorted and ownership is zeroed, so re-pushing an unchanged cache produces the identical digest and the upload is a no-op. mtimes are deliberately preserved -- cargo and zccache compare them, and normalising them would publish a cache that looks valid and silently rebuilds everything. Nothing calls it yet. Wiring a family is a behaviour change (which lane writes, which lane restores, what happens on a miss) and belongs in its own review.
Two gate failures on the first push: - RUF100 flagged `# noqa: E402` as unused, because ruff.toml enables only C901 and RUF100 -- E402 is not on, so the directive suppressed nothing. - ci/test_no_sys_path_edits.py refused the `sys.path.insert`: `uv run ci/precache.py` already puts ci/ on sys.path, so the sibling import works by name, and the test's whole point is that a module should say where it comes from rather than mutate the search path. The test now imports `precache` by name like the other ci/ tests import their siblings.
Three defects found while proving the transport end to end against the real `obs-rust/obs-studio-libs` release: - `push` assumed the `ci-cache` release already existed, but nothing creates it -- and `gh release upload` fails outright when it is missing, so the first cache of a family could never be published. It is now created on first use as a prerelease with `--latest=false`, so it never takes the libs repository's "Latest" slot from the dependency releases. - `pull` took `sorted(glob)[-1]`, i.e. the lexicographically largest manifest. Identities embed toolchain and soldr versions (`rustc1.98.1` sorts before `rustc1.101.0`), so that restores an older cache as soon as two versions coexist. It now takes the newest release-asset timestamp, and `--identity` pins an exact one. Nothing published exits NO_CACHE (3) so a caller can tell a miss from a restore. - `pull` extracted straight into the destination, leaving `fetch_libs_asset`'s `.asset-sha256` marker inside the cache tree; worse, that marker makes the next pull into the same directory skip as a hit, so a newer identity would silently never land. Extraction is staged and merged without the stamp. Also fixed the documented CLI order (FAMILY PLATFORM IDENTITY DIR) to match the parser. Verified against the live store: pushed a 114-entry probe tree to `ci-cache`, pulled it back and compared -- 65/65 files byte-identical, no stamp left behind. 15 unit tests pass.
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.
The Actions cache is the only cross-job store today and
ci.tomlbounds it at10 GB with default-branch-only writes, so the six app-build families left it in
Phase A of #1801 ("the release-asset transport (#782) can bring them back
outside this budget"). Nothing implemented that transport:
fetch_libs_asset.pycould only read a pinned release asset, and nothing here could write one.
This adds the writer, the reader that discovers the pin, and the fixes found by
running both halves against the real store.
The store
ci/precache.pypublishes to one rolling prerelease,ci-cache, inobs-rust/obs-studio-libs:The manifest exists because
fetch_libs_asset.fetchdeliberately requires asha256 while a cache changes on every master push: the consumer reads the small
manifest, then fetches the blob through the same verified path Qt and FFmpeg
already use.
Verified end to end, live
pushcreated the store release and uploaded a 114-entry probe(
cache-probe-linux-x64-smoketest-20261123, 347,450 B) —https://github.com/obs-rust/obs-studio-libs/releases/tag/ci-cache
pullfetched the manifest, verified the digest, extracted, and compared:65/65 files byte-identical to the source tree, with no stray files.
merge).
Defects this fixes (all found by that run)
gh release uploadfails when therelease does not exist, and nothing creates
ci-cache.pushnow creates itas a prerelease with
--latest=false, so it never takes the libs repo's"Latest" slot from the dependency releases.
pulltooksorted(glob)[-1]— thelexicographically largest manifest — while identities embed toolchain and
soldr versions (
rustc1.98.1sorts beforerustc1.101.0). It now takes thenewest release-asset timestamp;
--identitypins an exact one; nothingpublished exits
NO_CACHE(3) so a caller can distinguish a miss from arestore.
straight into the destination, leaving
fetch_libs_asset's.asset-sha256marker inside the cache tree. That marker is also fetch's "already
downloaded" shortcut, so the next pull into the same directory would skip
as a hit and a newer identity would never land. Extraction is now staged and
merged without the stamp.
FAMILY PLATFORM IDENTITY DIR) did not match theparser.
Not in this PR
No workflow writes or restores a real cache yet — that is the follow-up
(producers/consumers per platform, identity derived from
ci/native_cache_identity.pyso both halves agree).