feat(cli): add gzip compression to v2 docs publish requests#16035
feat(cli): add gzip compression to v2 docs publish requests#16035broady wants to merge 1 commit into
Conversation
Co-Authored-By: cbro <cbro@buildwithfern.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
Test Results: Gzip Compression for V2 Docs PublishTested by building the dev CLI with these changes and running end-to-end docs publish against Content-Length Investigation (Key Concern)Finding: Content-Length was never set in the first place — the "loss" concern is moot.
Test 1: Unit-Level Transport VerificationLocal HTTP test server receiving gzip-compressed requests via the exact
Test 2: E2E Docs Publish — Minimal Fixture (1 page)2 FDR POST requests, all gzip'd, all 200 OK: Published to: Test 3: E2E Docs Publish — Full Smoke-Test Fixture (multiple APIs, products, pages)7 FDR POST requests, all gzip'd, all 200 OK: 14/14 assertions passed. Non-FDR requests (health, slugs, versions) correctly NOT compressed. |
Description
Refs FER-10484
Adds transparent gzip compression to the v2 (current default) docs publish request bodies. This is the companion to #16033 which does the same for the docs-ledger write path.
Changes Made
compressedFetch.ts:createGzipFetch()returns afetchwrapper that pipes request bodies throughCompressionStream("gzip")and setsContent-Encoding: gzip. Also exportsgzipJsonBody()for raw fetch calls.publishDocs.ts: TheFdrClientis constructed whileglobalThis.fetchis temporarily replaced with the gzip fetch, so oRPC'sLinkFetchClientcaptures it for all subsequent calls (register, finish, API registration).publishDocs.ts: The rawfetchtranslation registration call now usesgzipJsonBody()to compress its JSON body.How it works
LinkFetchClientsnapshotsglobalThis.fetchat construction timeFdrClient, then restore immediately afterCompressionStream("gzip")withContent-Encoding: gzipheader@fastify/compresstransparently decompresses on the server sideTesting
Link to Devin session: https://app.devin.ai/sessions/08fa84ed296b46629c0316c86ee1aca1
Requested by: @broady