Skip to content

feat(prebuilt): streaming integrity-checked archive extraction - #2176

Merged
zackees merged 1 commit into
mainfrom
agent/1882-extract
Nov 25, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/1882-extract

Conversation

@zackees

@zackees zackees commented Nov 24, 2026

Copy link
Copy Markdown
Member

What

Unit 8 of #1882: prebuilt::extract turns a verified Artifact into a tree in one pass, verifying the descriptor while it decompresses.

rule behaviour
format .tar.zst only; anything else is Unsupported, never guessed by extension
integrity the declared size_bytes and SHA-256 are recomputed over the compressed stream during extraction; a body swapped after the fetcher verified it is refused
layout relative paths of ordinary components only — absolute names, .., symlinks, hard links, devices and fifos are refused
bounds decompressed size (MAX_EXTRACTED_BYTES, 16 GiB) and entry count (200 000) are capped, so a small archive cannot fill the disk
commit staging directory + rename after the completion marker, so a killed process leaves a complete tree or nothing claimable
reuse a destination carrying a matching marker is returned without re-reading the archive
eviction a destination holding anything else is refused — never merged into (that is the GC/LRU cell)

extract_async runs the blocking pass on its own thread for daemon callers.

Why this shape

The fetcher already returns an immutable Artifact; extraction is the only other place a bucket object can influence the disk, so it is the only other place that must re-prove identity. Doing that in the same pass keeps the 60 MB read count at one and means a cargo build never starts from a tree whose bytes were never checked.

Tests (real output)

test result: ok. 30 passed; 0 failed; 0 ignored   (prebuilt)
test result: ok. 347 passed; 0 failed; 2 ignored  (fbuild-packages-fetch --lib)
soldr cargo fmt --all -- --check                  exit 0
ci/enforce_platform_boundary.py --print-totals    rc 0
ci/platform_boundary_research.py --check          rc 0
ci.test_enforce_platform_boundary                 14 tests OK

12 new extract_tests.rs fixtures build real .tar.zst archives in a tempdir: layout, marker reuse with the archive deleted, flipped body, replaced-but-valid body, truncated body, .., absolute name, symlink, occupied destination, empty destination, size ceiling, wrong extension.

RED proven by mutation, twice, restored green after each:

  • disabling the digest comparison → a_replaced_body_fails_the_descriptor_check FAILED (11 pass / 1 fail);
  • allowing Component::ParentDir → parent_traversal_is_refused FAILED (11 pass / 1 fail).

Gates I could not run

soldr cargo clippy -p fbuild-packages-fetch --all-targets -- -D warnings could not acquire the build lease (root-maintenance.lock, 30 s bound) — a sibling agent's gate held it across three attempts, so CI's linux / Check is the equivalent. The earlier cold-build attempts also hit the documented runner-daemon flake (broker first-response deadline exceeded), not a compile error.

#1882 stays open (remaining cells: staging/partial GC, disk-cache LRU, the BuildRequest field, the bucket key, daemon-wide single-flight).

Unit 8 of #1882. `prebuilt::extract` turns a verified `Artifact` into a tree
in a single pass: the descriptor's exact size and SHA-256 are recomputed over
the compressed stream while the tar entries are decompressed, so a body swapped
after the fetch ladder verified it cannot land.

Layout rules: `.tar.zst` only, relative paths of ordinary components only,
regular files and directories only — absolute names, `..`, symlinks, hard
links and device entries are refused, so an archive cannot write outside its
root. Decompressed size and entry count are bounded so a few-KiB archive
cannot fill the disk.

Commit rules: extraction goes into a sibling staging directory and is moved
into place only after the completion marker is written, so a killed process
leaves either a complete tree or nothing claimable. A destination carrying a
matching marker is reused without re-reading the archive; a destination holding
anything else is refused rather than merged into (eviction is the GC/LRU cell).

`extract_async` runs the blocking pass on its own thread for daemon callers.

Tests: 12 new real tar.zst fixtures. RED proven by mutation twice: disabling
the digest comparison fails `a_replaced_body_fails_the_descriptor_check` (11
pass / 1 fail), and allowing `ParentDir` fails `parent_traversal_is_refused`
(11 pass / 1 fail); both restored green at 30/30 prebuilt, 347/347 crate lib.

#1882 stays open (remaining cells: staging/partial GC, disk-cache LRU,
BuildRequest field, bucket key, daemon-wide single-flight).
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "enabled" at "reviews.pre_merge_checks"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@zackees
zackees added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 24, 2026
@zackees
zackees added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 24, 2026
@zackees
zackees added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 24, 2026
@zackees
zackees added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
@zackees
zackees added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
@zackees
zackees added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
@zackees
zackees added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 25, 2026
@zackees
zackees added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 8f1e7cc Nov 25, 2026
34 checks passed
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