Skip to content

fix(aws-lambda): match the shell to its own pin, ship only hashed files, refuse the shell ZIP in CDK and SAM - #8173

Merged
jrusso1020 merged 2 commits into
mainfrom
hf/lambda-shell-followups-2
Nov 18, 2026
Merged

jrusso1020 merged 2 commits into
mainfrom
hf/lambda-shell-followups-2

Conversation

@jrusso1020

@jrusso1020 jrusso1020 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

What

Three review follow-ups to #8170:

  1. build-zip --source=chrome-headless-shell accepts the cached shell only when its digest is pinned for that same version. Before, a digest pinned for any build was accepted.
  2. It no longer copies debug.log and chrome_debug.log into the ZIP. These are the files the digest leaves out, because Chrome writes them while it runs.
  3. The CDK construct throws on chromeSource: "chrome-headless-shell", and the SAM template allows only sparticuz. hyperframes lambda deploy already refused it. The CHROME_PATH wiring for that ZIP and the unused BUNDLED_SHELL_PATH export are removed.

Why

  1. PINNED_SHELL_DIGESTS is keyed by version. Flattening it let a folder of one pinned build pass as another version.
  2. Those log files are not covered by the digest, so whatever they held would ship unchecked.
  3. The shell folder is about 296 MB, which is over Lambda's 250 MiB unzipped limit, so a ZIP function built with it can never deploy. The CLI refused it after fix(aws-lambda): pin the shell ZIP route, gate ZIP headroom, match arm64 fonts to x86 #8170, but CDK and SAM still accepted the value and pointed CHROME_PATH at a file that is not there.

Related work

Follows #8170 and #8155.

How

  • scripts/_chromeHeadlessShell.ts takes the digests as a version-keyed record and checks pinned[version]. It copies with a cpSync filter that skips CHROME_WRITES_WHILE_RUNNING, which @hyperframes/engine/chrome-host-ceiling now exports. That is the same list its digest skips.
  • scripts/package-size-budgets.json: the @hyperframes/aws-lambda packed budget goes from 80,500 to 82,000 bytes. The shipped scripts/_chromeHeadlessShell.ts now does the per-version pin check and the copy filter, which takes the tarball to 81,378 bytes in CI. That is over the old budget's 1% tolerance, and main was already within about 200 bytes of it.
  • HyperframesRenderStack refuses the value in zipChromeSource(), before any resource is built. examples/aws-lambda/template.yaml narrows AllowedValues and drops the condition that set CHROME_PATH. The READMEs say the same.

Test plan

  • Unit tests updated:
    • build-zip refuses a folder whose digest is pinned only for another version.
    • build-zip does not stage debug.log.
    • CDK and SAM both refuse a chrome-headless-shell ZIP.
  • @hyperframes/aws-lambda: 279 pass. The 2 failures are the ffmpeg image fetch curl tests, which also fail on main on this host. Typecheck is clean.
  • Documentation updated
  • Comments follow CONTRIBUTING.md "Comments"

🤖 Generated with Claude Code

…es, refuse the shell ZIP in CDK and SAM

Review follow-ups to the pinned shell route:
- build-zip --source=chrome-headless-shell accepts the folder only when its
  digest is pinned for this version, not for any pinned build.
- It leaves out the files the digest skips (debug.log and chrome_debug.log,
  which Chrome writes as it runs), so nothing unhashed ships.
- The CDK construct throws on chromeSource "chrome-headless-shell" and the
  SAM template allows only sparticuz, as lambda deploy already refused it:
  a shell ZIP cannot fit a function. The CHROME_PATH wiring for that ZIP is
  gone with it.

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

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 66 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

The shipped build-zip script now checks the shell against its own
version's pin and skips the files the digest leaves out. That takes the
tarball to 81,378 bytes in CI, over the 80,500 budget's 1% tolerance;
main was already within about 200 bytes of it.

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

@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 2cfdf891. All three notes from the #8170 review are closed.

Notes

  1. Closed. stageChromeHeadlessShell (_chromeHeadlessShell.ts:36-42) hashes the linux-${managedChromeVersion("linux")} folder and accepts it only if that digest is in pinned[version]. A digest pinned for another build no longer passes. The test "refuses a folder whose digest is pinned only for another build" pins this, and nothing is staged.
  2. Closed. The copy filter skips the same top-level CHROME_WRITES_WHILE_RUNNING names the digest leaves out (chromeHostCeiling.ts:62,96), so every shipped file is hashed. filesUnder still refuses a symlink or any non-file, and a linked folder fails lstat. The test checks that debug.log is not staged.
  3. Closed. zipChromeSource throws for chrome-headless-shell before synth (HyperframesRenderStack.ts). The SAM ChromeSource allows only sparticuz, and the dangling HYPERFRAMES_LAMBDA_CHROME_PATH and its condition are gone. Both are covered in the snapshot test.

Nits

  • The CDK chromeSource prop type still accepts "chrome-headless-shell", a value that now always throws. Narrowing it to "sparticuz" would catch it at compile time (but would break TypeScript callers that pass it today).
  • The @hyperframes/aws-lambda packed budget goes to 82,000 against 81,378 measured, about 0.8% headroom. The file's own rule sets a budget 5% above measured (about 85,400), so the next small change will trip it again.
  • The digest is computed before the copy, so a file swapped between the two would ship unhashed. This only runs on the build machine, so the risk is low.

Not run: the tests (read against the old code, each new one would fail there).

Verdict: APPROVE
Reasoning: Each note is fixed in the code and pinned by a test that fails without it. What remains are typing and budget nits 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 61d65e7 Nov 18, 2026
140 of 141 checks passed
@jrusso1020
jrusso1020 deleted the hf/lambda-shell-followups-2 branch November 18, 2026 11:47
mvanhorn pushed a commit to mvanhorn/hyperframes that referenced this pull request Nov 18, 2026
…eygen-com#8176)

heygen-com#8173 set the budget to 82,000 against 81,378 bytes measured, about 0.8%
over. The budget file's own rule is 5% above measured, so the next small
change would trip it again: ceil(81,378 × 1.05) = 85,447.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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