You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cache: S3 origin does not support Content-Encoding decompression (HTTP origin does) #804
kind:featureNew capability or a change to current behaviorprio:lowWhen convenientrustDependabot: a Cargo update; use area: labels for Rust code otherwise
The S3 origin adapter rejects any non-identity Content-Encoding outright, while the HTTP origin adapter supports decompression via DecompressMode. This is an asymmetry that forces operators using S3/R2/B2 backends to pre-store canonical (uncompressed) bytes or front their bucket with an HTTP CDN that strips encoding.
Evidence
crates/cache/src/origin/s3.rs:483-499 — on any non-identityContent-Encoding, returns OriginPullError::Permanent with a pointer error. The comment notes decompression "is a follow-up issue (HttpOrigin::decompress_body is reusable)".
crates/cache/src/origin/http.rs:53-139 — HTTP origin already implements DecompressMode::{Auto,Strict} with an UnsupportedEncoding path.
Why it matters
The reason for rejecting is correct (BLAKE3 verify runs over canonical bytes, so a gzipped body would later trip a confusing hash mismatch). But the result is a real functional gap between the two first-class origin backends, and the comment indicates the fix is straightforward because the HTTP decode path is reusable.
Suggested fix
Reuse the HTTP origin decompression logic (DecompressMode) on the S3 backend so encoded objects decode to canonical bytes before the engine hash-verifies, with the same strict/auto semantics.
Filed during a repository review; verified not already tracked.
The S3/R2/B2 origin adapter currently hard-fails (OriginPullError::Permanent) on any non-identity Content-Encoding header, while the HTTP origin adapter already handles gzip/br/zstd via DecompressMode::{Auto,Strict}. The issue is well-evidenced with exact file locations, correctly identifies the root cause (BLAKE3 verification must run over decoded bytes), and points to a ready-made solution (HttpOrigin::decompress_body is already factored for reuse). Labels and priority already look accurate.
📊 Assessment
Dimension
Value
Reasoning
Type
Feature
Adds new capability to an existing adapter; not a regression
Labels
unchanged (enhancement, technical, rust, low)
All four are accurate; low is appropriate — operators can work around it by pre-storing uncompressed objects
Coding agent
Suitable
Scope is self-contained: extend S3Origin to call HttpOrigin::decompress_body (or extract it to a shared helper), mirror DecompressMode config field in S3OriginConfig, add a unit test with a mock encoded response
🔗 Similar issues
No duplicate or closely related open issues found.
💡 Notes and suggestions
Key files:
crates/cache/src/origin/s3.rs:483-499 — current rejection site; this is where decompression should be inserted before returning the body to the engine
crates/cache/src/origin/http.rs:53-139 — decompress_body implementation and DecompressMode usage to replicate or factor out
Suggested sub-tasks:
Extract decompress_body (or a wrapper) to a shared location — either crates/cache/src/origin/mod.rs or a new crates/cache/src/origin/decompress.rs — so both adapters import it without a circular dependency
Add decompress: DecompressMode field to S3OriginConfig (mirror HttpOriginConfig); default to Auto to match the HTTP adapter's existing default
Call decompression after the GetObject response body is read but before returning bytes to the hash-verify layer
Add a unit test: mock S3 response with Content-Encoding: gzip, confirm canonical bytes are returned and hash check passes; also confirm Strict mode errors on unsupported encodings
Update config-types crate docs / config schema docs if DecompressMode is referenced there
Config-types note:DecompressMode lives in crates/config-types/ which is a leaf crate (serde + url only). Any new config field on S3OriginConfig must stay within those constraints.
Anti-panic policy reminder: the decompression path must propagate errors as Result — no .unwrap() / .expect() / indexing without bounds check (Clippy denies these workspace-wide).
kind:featureNew capability or a change to current behaviorprio:lowWhen convenientrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon Jun 3, 2026
🎯 Triage report
The S3/R2/B2 origin adapter currently hard-fails (
OriginPullError::Permanent) on any non-identityContent-Encodingheader, while the HTTP origin adapter already handles gzip/br/zstd viaDecompressMode::{Auto,Strict}. The issue is well-evidenced with exact file locations, correctly identifies the root cause (BLAKE3 verification must run over decoded bytes), and points to a ready-made solution (HttpOrigin::decompress_bodyis already factored for reuse). Labels and priority already look accurate.📊 Assessment
enhancement,technical,rust,low)lowis appropriate — operators can work around it by pre-storing uncompressed objectsS3Originto callHttpOrigin::decompress_body(or extract it to a shared helper), mirrorDecompressModeconfig field inS3OriginConfig, add a unit test with a mock encoded response🔗 Similar issues
No duplicate or closely related open issues found.
💡 Notes and suggestions
Key files:
crates/cache/src/origin/s3.rs:483-499— current rejection site; this is where decompression should be inserted before returning the body to the enginecrates/cache/src/origin/http.rs:53-139—decompress_bodyimplementation andDecompressModeusage to replicate or factor outSuggested sub-tasks:
decompress_body(or a wrapper) to a shared location — eithercrates/cache/src/origin/mod.rsor a newcrates/cache/src/origin/decompress.rs— so both adapters import it without a circular dependencydecompress: DecompressModefield toS3OriginConfig(mirrorHttpOriginConfig); default toAutoto match the HTTP adapter's existing defaultGetObjectresponse body is read but before returning bytes to the hash-verify layerContent-Encoding: gzip, confirm canonical bytes are returned and hash check passes; also confirmStrictmode errors on unsupported encodingsconfig-typescrate docs / config schema docs ifDecompressModeis referenced thereConfig-types note:
DecompressModelives incrates/config-types/which is a leaf crate (serde + url only). Any new config field onS3OriginConfigmust stay within those constraints.Anti-panic policy reminder: the decompression path must propagate errors as
Result— no.unwrap()/.expect()/ indexing without bounds check (Clippy denies these workspace-wide).Add this agentic workflows to your repo
To install this agentic workflow, run
fix(cache): stream compressed origin bodies so decoded blobs aren't f…
test(cache): pin HTTP compressed-buffer-threshold fix; restore S3 run…
feat(cache): decompress Content-Encoding on the S3 origin (#804) (#806)