Skip to content

fix: serve stored Content-Encoding objects encoded to clients that accept it - #264

Draft
alukach wants to merge 3 commits into
mainfrom
fix/stored-content-encoding
Draft

alukach wants to merge 3 commits into
mainfrom
fix/stored-content-encoding

Conversation

@alukach

@alukach alukach commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

What I'm changing

source/metadata-catalog/catalog.jsonl is now published brotli-compressed: 789 KB stored with Content-Encoding: br, against 6.1 MB raw. Through data.source.coop, every client gets it decoded instead, with no Content-Encoding and a weak ETag, even clients that send Accept-Encoding: br. Range requests return raw brotli slices with no header.

Cause: Cloudflare decodes a Worker subrequest's encoded body unless the subrequest itself sends Accept-Encoding, and multistore doesn't send one. developmentseed/multistore#165 fixes that. It includes edge measurements from a throwaway Worker on source-coop.workers.dev: with the header, br clients get the stored 788,699 bytes with Content-Encoding: br, and other clients get it decoded by the edge.

How I did it

  • Cargo.toml / Cargo.lock: pin all five multistore crates to the feat: make STS max session TTL configurable via env var #165 branch (e8851a2) until it's released; then drop git/branch. version = "0.8.0" is kept so that swap is a one-word change.
  • tests/stub_api.py: add source/metadata-catalog as a public product on the existing aws-opendata-us-west-2 connection, so the integration suite can read the real brotli object.
  • tests/test_integration.py: test_stored_content_encoding_passes_through asks for br and asserts Content-Encoding: br plus byte-for-byte equality with the S3 object. wrangler dev passes encoded bodies through with or without the fix, so this guards the proxy path, not the Cloudflare-only behaviour.
  • .github/workflows/deploy.yml: a production-only step after the smoke test asserts the catalog comes back with Content-Encoding: br for a br-accepting client. It's the only check that runs on Cloudflare's real network.

Test plan

  • cargo test: all pass
  • cargo check --target wasm32-unknown-unknown with the pinned multistore
  • Local CI mirror (stub API + wrangler dev): tests/test_integration.py 27 passed, including the new test
  • The new deploy check fails against today's production (content-encoding: <none>) and passes against the probe Worker with the fix (br)
  • After feat: make STS max session TTL configurable via env var #165 merges and releases: swap to the released version, deploy, and confirm the production deploy check passes

🤖 Generated with Claude Code

…cept it

Objects stored with Content-Encoding (e.g. source/metadata-catalog's
brotli-compressed catalog.jsonl) reached every client decoded, header
dropped: Cloudflare decodes a Worker subrequest's encoded body unless the
subrequest sends Accept-Encoding. Pins multistore to
developmentseed/multistore#165, which sends it on reads, until that ships.

Adds a stub product and integration test for the stored-encoding read, and
a production-only deploy check against Cloudflare's network, where
wrangler dev can't reproduce the bug.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@claude

claude Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @alukach's task in 13s —— View job


✅ No blocking issues — safe to merge.

I reviewed the diff only. I didn't build it or run the tests.

  • Git pin: the four multistore crates and multistore-cf-workers all point at the same branch, and Cargo.lock pins the commit (e8851a2), so builds are reproducible. Dropping git/branch after the release is a one-word swap, as the PR says.
  • Deploy check: the curl step runs only for production, and it fails loudly if the header is missing. %header{...} needs curl 7.84 or newer, which the ubuntu-latest runner has.
  • Integration test: the byte-for-byte comparison against S3 is sound. Reading with decode_content=False on both sides avoids a false pass from decoding. It does depend on the live AWS object, so it will fail if that object is ever republished uncompressed. The stub product is also a real dependency on the public bucket.

Non-blocking notes:

  • The branch pin is a supply-chain dependency on a mutable ref. Cargo.lock mitigates this, but don't run cargo update before feat: make STS max session TTL configurable via env var #165 is released.
  • The deploy check only covers the Accept-Encoding: br path. Range requests, which the PR description says were also broken, aren't asserted anywhere.

Simplify (ponytail)

  • tests/stub_api.py:92-109: ENCODED_PRODUCT_JSON repeats the mirror structure that PRODUCT_JSON already has. A small helper that builds a product from (account, product) would replace the copy-paste. It's only worth doing if a third product is added.

💰 Estimated review cost: $0.09 · 0m12s · 4 turns

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🚀 Latest commit deployed to https://source-data-proxy-pr-264.source-coop.workers.dev

  • Date: 2026-11-17T04:19:27Z
  • Commit: 637d88a

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
preview — dbc31c6b Deployed Nov 17, 2026 by alukach via Deploy & Test / Deploy #494
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant