Repository navigation
feat(prebuilt): manual artifact builder + two client defects it exposed (#1882) - #2195
Merged
Merged
Conversation
…ed (#1882) Unit 14 of the exact-fingerprint track: the publisher side. `prebuilt::pack` writes one deterministic tar.zst under decision 2's key and emits the Catalog entry the client already resolves against; `fbuild __prebuilt-pack` (hidden) drives it. Nothing uploads - decision 8c makes every bucket write a maintainer action. Determinism (sorted entries, normalized mode/uid/gid/mtime/uname), a refused tree before any write (symlink, special file, empty), a .part file re-hashed from disk before the rename, and a key derived from (product, reference, chip, digest). The round-trip test (pack -> serve -> Reader -> fetch -> obtain -> extract) exposed two client faults, fixed here: - fetch::sanitized kept only the first 48 chars, so a real 53-char v1 core object name lost `.tar.zst` and extract refused the asset outright; the archive suffix is now kept and the stem shortened. - extract dropped the archive's execute bits (File::create cannot carry a mode), so a served tree differed from the fingerprinted tree; only the execute bits are applied, never setuid/setgid.
Dylint `ban_std_pathbuf` has no test exemption: the fixtures declared `std::path::PathBuf` return types. They return `NormalizedPath` now, and the call sites pass `.as_path()`.
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.
#1882 unit 14 — the manual artifact builder, and two client defects it exposed
The publisher half of the exact-fingerprint track:
prebuilt::packwrites onedeterministic archive under decision 2's key and emits the
Catalogentry theclient already resolves against, driven by a hidden
fbuild __prebuilt-pack.Nothing uploads anything — decision 8c makes every bucket write a maintainer
action — so this unit's entire output is one archive plus the two JSON files
that describe it.
What the builder does
pack(&PackRequest)walks the compiled core-object tree, refuses a symlink, aspecial file, a non-UTF-8-hostile name or an empty tree before writing a
byte, and emits one
tar.zstwith normalized metadata (mode from theexecutable bit, uid/gid 0, empty uname/gname, mtime 0, entries sorted). Two
packs of the same bytes therefore yield one digest, which is what a shard's
"immutable object" claim depends on.
.partsibling, re-hashed from disk, and onlythen renamed into place, so a killed run leaves nothing a publisher could
upload by mistake.
bucket_keyderivesv1/<vendor>/<product>/<channel>/<ref>/<chip>/<product>-<ref>-<chip>.<sha16>.tar.zstfrom
(product, reference, chip, digest)— a publisher cannot emit a key theclient will not look up.
release/catalogemit the entry the reader accepts:flavor fp-<16>,provides fbuild-fp:<fingerprint>,os: none, single-stream asset.fbuild __prebuilt-pack(hidden, like__usb-recovery-helper) drives it andprints the key, the digest and "nothing was uploaded".
Two client defects the round trip found
The new round-trip test packs a tree, serves it from a real axum server, and
resolves it with the real
Reader→Fetcher→obtain→extractpath. Twofaults showed up that no existing test covered, because every existing fixture
uses a short asset name and no executable entry:
sanitized()truncated the archive's shape away. It keeps the first 48characters of the asset's file name, and a real v1 core-object name is 53
(
arduino-esp32-core-3.3.12-esp32dev.<sha16>.tar.zst), so the local name lost.tar.zstandextractrefused it as an unsupported format — the asset couldnever be extracted at all. It now keeps the archive suffix and shortens the
stem instead.
extractdropped the executable bit.File::createcannot carry theheader's mode, so a served tree differed from the tree the publisher
fingerprinted (and from what
content idcovers). Only the execute bits areapplied now — never setuid/setgid, whatever the header claims.
Tests (real output)
Covered: key shape, determinism across mtimes and output directories, the full
pack → serve → resolve → fetch → extract round trip (bytes and the execute
bit), symlink refusal before any write, empty tree, missing tree, bad
fingerprint / channel / base URL / chip /
min_client_version, entry shape, andthat the command stays out of
--helpwhile still parsing.Not in this PR
The cold/warm benchmark hook (the last cell of the track) needs a real framework
build to name a configuration where core objects pay, so it stays open.
#1882stays open. No workflow files, no new crates.