Skip to content

fix(aws-lambda): pin the shell ZIP route, gate ZIP headroom, match arm64 fonts to x86 - #8170

Merged
jrusso1020 merged 1 commit into
mainfrom
hf/lambda-shell-followups
Nov 18, 2026
Merged

jrusso1020 merged 1 commit into
mainfrom
hf/lambda-shell-followups

Conversation

@jrusso1020

@jrusso1020 jrusso1020 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

What

Three follow-ups from the review of #8155:

  1. build-zip --source=chrome-headless-shell stages only the repo's pinned shell build, and only when its folder matches the pinned digest. Before, it staged whatever build was newest in the Puppeteer cache. hyperframes lambda deploy now refuses --chrome-source chrome-headless-shell up front, because the shell can't fit a ZIP function.
  2. The handler ZIP's headroom under its size gate is printed on every build. A new workflow builds the ZIP on any PR that touches the code it bundles.
  3. The arm64 video image now uses @sparticuz/chromium's own fonts in place of liberation-fonts, so text falls back to the same fonts on both arches. CI renders a mixed-script page on both and fails if any line resolves to different fonts.

Why

  1. A host with a newer Chrome cached would have shipped that build, even though the error message names 158. The shell folder is about 296 MB, which is over Lambda's 250 MiB unzipped limit, so a ZIP built with it can never deploy. Before this PR, lambda deploy --video-arch x86_64 --chrome-source chrome-headless-shell built the sparticuz ZIP anyway and deployed it pointing at a shell path that doesn't exist.
  2. The sparticuz ZIP is 246.5 MiB against a 248 MiB gate, leaving 1.5 MiB of headroom. The handler bundles the producer, engine and core, but the only PR-time ZIP build ran on packages/aws-lambda changes. So growth elsewhere would first fail in the release job.
  3. @sparticuz/chromium 153 ships only Open Sans plus a fonts.conf that scans its own font folders. The x86 function therefore draws every family (sans-serif, serif, monospace) in Open Sans. fix(aws-lambda): chrome-headless-shell 158 in the arm64 video image, sparticuz 153 in the x86 ZIP #8155 gave the arm64 image liberation-fonts, so the same composition fell back to different fonts depending on --video-arch. Before fix(aws-lambda): chrome-headless-shell 158 in the arm64 video image, sparticuz 153 in the x86 ZIP #8155 the arm64 image also ran sparticuz, with the same Open Sans set.

Related work

Follows #8145 and #8155.

How

  • Pinned shell (scripts/_chromeHeadlessShell.ts): it reads the version from managedChromeVersion("linux") and checks the folder with isPinnedHeadlessShell, both from @hyperframes/engine/chrome-host-ceiling. That is the same pin and per-file digest the CLI uses for its own browser, so pin:chrome keeps both in step. It also uses Puppeteer's real cache layout (linux-<version>/); the old code and its tests assumed bare version folders. @hyperframes/engine is added as a devDependency for this script.
  • Deploy refusal (packages/cli/src/commands/lambda/deploy.ts): one check for every arch, before any build or AWS call, naming the arm64 image as where the shell runs. The SAM template, the CDK prop, the CLI docs and the READMEs say the same.
  • Headroom: build-zip logs unzipped staging size: X, Y under the limit. The new .github/workflows/lambda-handler-zip.yml builds the ZIP when packages/{aws-lambda,producer,engine,core,parsers}, bun.lock or the workflow file change. It skips release-only diffs like the other heavy workflows.
  • Fonts:
    • stage-arm64-image.ts unpacks the handler ZIP's @sparticuz/chromium/bin/fonts.tar.br into /var/task/fonts, the same layout sparticuz unpacks into /tmp/fonts.
    • The Dockerfile sets FONTCONFIG_PATH=/var/task/fonts and drops liberation-fonts. The fonts come from the locked sparticuz package, so nothing new is downloaded.
  • Comparison:
    • image/smoke-video.mjs renders a page with Latin, serif, monospace, Greek and Cyrillic, CJK, Arabic and emoji lines. It returns each line's platform fonts (CDP CSS.getPlatformFontsForNode) and a screenshot.
    • The arm64 image job runs it as before. A new x86 text render job runs it on the unzipped handler ZIP in the same pinned nodejs:22 base, with sparticuz.
    • Text fonts match across arches diffs the two font maps. Both screenshots are uploaded as artifacts.

Test plan

  • Unit tests: build-zip stages only the pinned folder and refuses a cached folder whose digest doesn't match. It names the pinned install command when only another version is cached. stage-arm64-image keeps the fonts and drops the x86 Chrome. CLI lambda deploy refuses the shell on arm64, x86_64 and the default arch.
  • @hyperframes/aws-lambda scripts: 7 pass. CLI src/commands/lambda: 105 pass. scripts/ci/release-only-diff, publish-workflow and check-test-reachability: 70 pass.
  • The real pinned 158 folder from @puppeteer/browsers passes the digest check and stages 295,609,238 bytes. Its files match a folder unzipped from Chrome for Testing's own linux64 archive, byte for byte.
  • build:zip on this branch: 246.5 MiB, 1.5 MiB under the limit.
  • The x86 side, run locally in the pinned nodejs:22 amd64 base under the Lambda runtime: Chrome 153.0.8010.0, and every line resolves to Open Sans only. CJK, Arabic and emoji render blank on x86 today.
  • CI: Lambda arm64 image and the new Text fonts match across arches and Lambda handler ZIP checks. On arm64 (Chrome 158.0.8127.36) every line of the text page resolves to Open Sans with the same glyph counts as on x86.
  • Documentation updated
  • Comments follow CONTRIBUTING.md "Comments"

🤖 Generated with Claude Code

…m64 fonts to x86

- build-zip --source=chrome-headless-shell stages only the repo's pinned
  build (managedChromeVersion) and only when its folder matches the pinned
  digest (isPinnedHeadlessShell), instead of the newest folder in the cache.
  The folder cannot fit a ZIP function, so lambda deploy refuses
  --chrome-source chrome-headless-shell up front on either arch, and the
  docs say the arm64 video image is where the shell runs.
- build-zip prints the headroom under the unzipped gate, and a new
  "Lambda handler ZIP" workflow builds the ZIP on PRs that touch the code
  it bundles, so growth fails before merge rather than in the release job.
- The arm64 image keeps @sparticuz/chromium's fonts and fonts.conf from the
  handler ZIP (FONTCONFIG_PATH=/var/task/fonts) instead of liberation-fonts,
  so text falls back to the same fonts as on x86. The image workflow renders
  a mixed-script page on both arches and fails when any line resolves to
  different platform fonts.

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

mintlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 18, 2026, 9:55 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 70 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

Unstable (1)

  • seqplainkeys-none-px-r0-nested-z100: tracking 0.07, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.07, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.07, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at 6de46be. All three #8155 follow-ups are closed.

Follow-ups

  1. Closed. _chromeHeadlessShell.ts:19-41 stages only linux-${managedChromeVersion("linux")}, and isPinnedHeadlessShell (engine chromeHostCeiling.ts:109-133) hashes every file in the folder, refusing symlinks and non-files. The newest-in-cache pick is gone. lambda deploy now refuses --chrome-source chrome-headless-shell for every arch before any build or AWS call (deploy.ts).
  2. Closed. build-zip logs the headroom. lambda-handler-zip.yml builds the ZIP on PRs touching aws-lambda, the producer/engine/core/parsers src, or bun.lock.
  3. Closed with a better check than the one we asked for: per-line platform fonts on both arches, diffed in CI. The comparison job's log shows arm64 resolving Open Sans, so the fonts load from /var/task/fonts.

Rule 7 / runners
New and changed jobs run on ubuntu-latest only (no paid or macOS runners), with SHA-pinned actions and contents: read. The fonts come from the locked sparticuz package, so nothing new is downloaded. setup-bun has no version, the same as the repo's other workflows.

Minor (follow-ups, not blocking)

  • isPinnedHeadlessShell accepts any pinned digest, not just this version's. The folder must still be a known pinned build, so the exposure is small.
  • The excluded debug.log and chrome_debug.log would be copied into a ZIP unhashed. Drop them in staging.
  • The CDK chromeSource prop and the SAM ChromeSource parameter only document the limit; they still accept the shell value. The CLI refuses it.
  • Body: CJK, Arabic and emoji render blank on x86 today, and arm64 now matches. That's consistent, but it's a real gap worth its own issue: no CJK or emoji font on either arch.

Verdict: approve.
Reasoning: each follow-up is fixed in code and checked in CI on the real artifacts. The pinned route can no longer ship an unchecked build, and the remaining items are small, with no unverified binary path.

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit ed3f05a Nov 18, 2026
148 checks passed
@jrusso1020
jrusso1020 deleted the hf/lambda-shell-followups branch November 18, 2026 10:38

This branch was successfully deployed

1 active deployment
staging - docs — 6de46be7 Deployed Nov 18, 2026 by mintlify[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.

2 participants