Skip to content

fix(store): report compression-store payload size from the frame footer - #3230

Open
mvanhorn wants to merge 4 commits into
TraceMachina:mainfrom
mvanhorn:feat/compression-ac-has-size
Open

mvanhorn wants to merge 4 commits into
TraceMachina:mainfrom
mvanhorn:feat/compression-ac-has-size

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

What and why

CompressionStore::has_with_results overwrote a present digest key's
size with digest.size_bytes(). For a CAS blob that is the uncompressed
length. For an action-cache entry the digest is the Action, so has()
returned the Action size. After #2974, FastSlowStore sizes an
ExactSize fill from that answer and validate_size returns DATA_LOSS
when the stored ActionResult is a different length.

Present digest keys now report Footer.uncompressed_data_size from its
fixed place in the frame footer. Missing keys stay None, zero-digest
keys stay 0, and string keys keep the stored framed size. A truncated or
unreadable footer is an Internal error, matching get_part; the store
does not fall back to the digest size.

Fixes #3194

How was this verified?

On Linux x86_64 with rustc/cargo 1.97.1 (not the Nix flake; Bazel
and pre-commit were not installed).

Untouched upstream/main at 12e8ae20:

cargo +1.97.1 test -p nativelink-store --test compression_store_test

18 passed, 0 failed.

The three new tests, run against that same impl with only the test file
added:

  • has_reports_the_stored_uncompressed_size_when_the_digest_size_differs
    failed with has() = Some(167) instead of Some(334).
  • compressed_slow_tier_refills_when_digest_size_is_the_action_size
    failed with DATA_LOSS: Expected 167 upload bytes, received 334.
  • has_errors_when_the_frame_footer_cannot_be_read failed because a
    present garbage object still reported Some(167).

On this branch, the same cargo +1.97.1 test -p nativelink-store --test compression_store_test command is 21 passed, 0 failed, including the
existing CAS has() size test and
compressed_slow_tier_refills_filesystem_with_the_uncompressed_size.

Also ran cargo +1.97.1 clippy -p nativelink-store --test compression_store_test -- -D warnings (pass) and vale 3.12.0 on
compose-stores.mdx (0 errors, 0 warnings, 0 suggestions). rustfmt
from 1.97.1 on the touched Rust files. Not verified: Bazel
//nativelink-store:integration, bazel test //..., and pre-commit run -a.

Risk

If the footer cannot be read, has() now returns Internal instead of
a guessed size. Callers that assumed a present compression-store object
always has a numeric size will see an error on a truncated frame; that
matches get_part. CAS existence checks for present digest keys now
read 13 bytes from the inner store, so a slow backend sees one extra
ranged read per hit. A wrong footer value would size a fast_slow fill
incorrectly and show up as DATA_LOSS on the fill, the same symptom the
Action size causes today.

AI assistance

An agent wrote it and I reviewed every line.

Demo

demo

Full recording (MP4): https://raw.githubusercontent.com/mvanhorn/pr-demo-assets/main/osc-bulk-1118n/compression-ac-has-size/out.mp4

CompressionStore::has_with_results reported digest.size_bytes() for a
present digest key. That is the decompressed length for a CAS blob, but
for an action-cache entry the digest is the Action size and the stored
value is the ActionResult. After v1.8, FastSlowStore sizes an ExactSize
fill from has() and rejects a length mismatch with DATA_LOSS.

Present digest keys now report Footer.uncompressed_data_size, read from
its fixed place in the frame footer. A missing footer is an error, not
a fallback to the digest size. String keys and missing keys are
unchanged.
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nativelink Ready Ready Preview Nov 20, 2026 5:22am UTC
nativelink-aidm Ready Ready Preview Nov 20, 2026 5:22am UTC

Request Review

@MarcusSorealheis

Copy link
Copy Markdown
Member

damn. this is good.

@mvanhorn

Copy link
Copy Markdown
Contributor Author

Thanks @MarcusSorealheis, and thanks for merging main into the branch.

@MarcusSorealheis

Copy link
Copy Markdown
Member

@mvanhorn we have to run more checks on our end because it is touch a few code paths that are sensitive.

@mvanhorn

Copy link
Copy Markdown
Contributor Author

Makes sense, thanks @MarcusSorealheis. Take the time you need on the sensitive paths, and point me at anything you want changed.

@github-actions

Copy link
Copy Markdown
Contributor

Build results for this fork PR at 4547ae46c8a6:

Job Result Links
pull-request Passed Open the build · check run

Fork PRs cannot stream build events, so a trusted workflow publishes them after CI finishes and updates this comment as each job is published. Opening a build needs a Trace Machina sign-in; the check run lists the failing tests and their logs.

This branch was successfully deployed

2 active and 1 inactive deployments
public-ci — 4547ae46 Deployed Nov 20, 2026 by MarcusSorealheis via NativeLink / Linux (PR) #945
Preview – nativelink — 4547ae46 Deployed Nov 20, 2026 by vercel[bot]
Preview – nativelink-aidm — 4547ae46 Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: v1.8 fails every action-cache fill whose size comes from a compression store (DATA_LOSS: Expected <action size> upload bytes)

2 participants