Skip to content

feat(prebuilt): manual artifact builder + two client defects it exposed (#1882) - #2195

Merged
zackees merged 2 commits into
mainfrom
agent/1882-artifact-builder
Nov 27, 2026
Merged

zackees merged 2 commits into
mainfrom
agent/1882-artifact-builder

Conversation

@zackees

@zackees zackees commented Nov 27, 2026

Copy link
Copy Markdown
Member

#1882 unit 14 — the manual artifact builder, and two client defects it exposed

The publisher half of the exact-fingerprint track: prebuilt::pack writes one
deterministic archive under decision 2's key and emits the Catalog entry the
client 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, a
    special file, a non-UTF-8-hostile name or an empty tree before writing a
    byte
    , and emits one tar.zst with normalized metadata (mode from the
    executable 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.
  • The archive is written to a .part sibling, re-hashed from disk, and only
    then renamed into place, so a killed run leaves nothing a publisher could
    upload by mistake.
  • bucket_key derives v1/<vendor>/<product>/<channel>/<ref>/<chip>/<product>-<ref>-<chip>.<sha16>.tar.zst
    from (product, reference, chip, digest) — a publisher cannot emit a key the
    client will not look up.
  • release/catalog emit 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 and
    prints 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 → extract path. Two
faults showed up that no existing test covered, because every existing fixture
uses a short asset name and no executable entry:

  1. sanitized() truncated the archive's shape away. It keeps the first 48
    characters 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.zst and extract refused it as an unsupported format — the asset could
    never be extracted at all. It now keeps the archive suffix and shortens the
    stem instead.
  2. extract dropped the executable bit. File::create cannot carry the
    header's mode, so a served tree differed from the tree the publisher
    fingerprinted (and from what content id covers). Only the execute bits are
    applied now — never setuid/setgid, whatever the header claims.

Tests (real output)

soldr cargo test -p fbuild-packages-fetch prebuilt::
  test result: ok. 83 passed; 0 failed; 0 ignored; 0 measured; 324 filtered out; finished in 0.32s
soldr cargo test -p fbuild-packages-fetch --lib
  test result: ok. 405 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 4.62s
soldr cargo test -p fbuild-cli --bin fbuild prebuilt_pack
  test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 520 filtered out; finished in 0.07s
uv run --no-project python ci/enforce_platform_boundary.py --print-totals
  rows=0; dylint_rows=0

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, and
that the command stays out of --help while 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.
#1882 stays open. No workflow files, no new crates.

…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()`.
@zackees
zackees added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit a7394a5 Nov 27, 2026
33 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant