Skip to content

Pre-compress the assembler preview S3 upload - #4239

Open
Mpdreamz wants to merge 4 commits into
mainfrom
fix/compress-assembler-preview
Open

Mpdreamz wants to merge 4 commits into
mainfrom
fix/compress-assembler-preview

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

Pre-compresses the assembler preview S3 upload so the wire cost drops from ~2.0 GiB to ~120 MB per preview run.

Affects: Deploys & previews, Automation

Why

Each API operation page is ~420 KB uncompressed (89% sidebar nav). At 4,029 pages the raw upload is ~1.7 GiB. CloudFront already serves with content-encoding: gzip on the fly, but the origin upload still pays the full uncompressed byte count. Storing pre-compressed objects lets CloudFront forward them untouched at ~120 MB.

What

Pre-compressed upload with zip exclusion

All non-zip files are gzip-compressed in place using find ... ! -name "*.zip" piped to parallel gzip. Each file is compressed to a mktemp-generated temp path then atomically renamed, avoiding collisions when both foo and foo.gz exist in the tree. Zip bundles (llm.zip, okf.zip) are excluded from compression and synced in a separate pass without content-encoding: gzip so clients receive raw zip bytes.

Verify

Trigger the assembler preview workflow on a PR. The Upload assembled docs to S3 step should complete in seconds rather than minutes. Verify a preview page renders correctly in a browser and that downloading llm.zip or okf.zip from the preview URL produces a valid zip archive.

Supersedes #4210.

🤖 Generated with Claude Code

Same gzip-in-place + --content-encoding gzip pattern as the local docs
preview upload. The assembler tree is ~2 GiB of uncompressed HTML;
pre-compressing before aws s3 sync cuts wire cost to ~120 MB.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the upload step should fail on any compression discovery error (enable pipefail or equivalent) to avoid publishing non-gzip bytes with gzip content-encoding metadata.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

# Pre-compress all non-zip files so aws s3 sync ships ~120 MB instead of ~2 GiB.
# Zip bundles (llm.zip, okf.zip) are already compressed; syncing them with
# content-encoding:gzip would prevent clients from decoding them correctly.
find ".artifacts/assembly/${ASSEMBLER_PREVIEW_PATH_PREFIX}" -type f ! -name "*.zip" -print0 \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Fail the step if any pre-compression discovery fails

This pipeline can succeed even when find fails, because GitHub Actions runs bash -e but not pipefail by default. In find ... | xargs ..., the pipeline status comes from xargs; a partial find error can be masked, leaving some files uncompressed while the next sync still applies --content-encoding gzip to all non-zip files.

That can publish incorrectly encoded objects (clients receive non-gzip bytes labeled as gzip). Please enable set -o pipefail before this pipeline (or refactor to avoid a pipeline) so any find failure stops the upload.

@Mpdreamz Mpdreamz added the automation packaging, ci/cd. label Sep 29, 2026
GitHub Actions runs bash -e but not pipefail by default. In
'find ... | xargs gzip', the pipeline exit status comes from xargs, so a
partial find failure is masked. Without pipefail, some files can be left
uncompressed while aws s3 sync still applies --content-encoding gzip,
publishing non-gzip bytes with incorrect encoding metadata.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new findings; approving.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

…r-preview

# Conflicts:
#	.github/workflows/assembler-preview.yml
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
assembler-preview — 957487c4 Deployed Oct 27, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation packaging, ci/cd.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants