Skip to content

fix(ci): stream release file contents to jq via --rawfile#107

Merged
MaximusHaximus merged 2 commits into
mainfrom
fix/lerna-release-jq-loop-arg-max
Apr 28, 2026
Merged

fix(ci): stream release file contents to jq via --rawfile#107
MaximusHaximus merged 2 commits into
mainfrom
fix/lerna-release-jq-loop-arg-max

Conversation

@MaximusHaximus
Copy link
Copy Markdown
Contributor

@MaximusHaximus MaximusHaximus commented Apr 28, 2026

Summary

Release run 25061014445 died at lerna-signed-release.sh:192 with jq: Argument list too long. The per-file loop passed each file's base64 body through jq --arg c "$CONTENT"; pnpm-lock.yaml alone is ~885 KB encoded, ~6.7× Linux's per-argument ARG_MAX. The previous slurpfile fix (742d06e) only covered Stage 3's payload assembly.

Commits

  1. fix(ci): stream release file contents to jq via --rawfile — spill each file's base64 to a temp file and read it via --rawfile; accumulate the additions/deletions arrays in temp files in-place. Stage 3 already consumed those files via --slurpfile. EXIT trap covers all four temp files.
  2. chore(deps): prune removed remotion-video workspace from lockfile — incidental cleanup. packages/remotion-video was deleted long ago but ~1180 lines of stale entries remained in pnpm-lock.yaml; --frozen-lockfile tolerated it, plain pnpm install regenerates the prune.

Test plan

  • --dry-run against the same 3-package, 7-file changeset the failing CI run produced — additions array builds without error, tree-SHA round-trip matches.
  • Real release on next merge to main is the only end-to-end signal; dry-run exits before the GraphQL mutation. Body shape unchanged from before.

The signed-release script was building the GraphQL fileChanges array by
piping the running JSON through `jq --arg c "$CONTENT"` once per file,
where `$CONTENT` was the base64-encoded body of that file. As soon as a
single file's base64 form exceeded Linux's per-argument ARG_MAX (~128 KB)
— which `pnpm-lock.yaml` does on its own — jq died with
`Argument list too long` and the entire release step exited 126.

Spill each file's base64 into a temp file and pass it via
`jq --rawfile c <file>` instead of `--arg c <string>`. Accumulate the
JSON arrays directly in the additions/deletions temp files (in-place via
`mv`) so we never round-trip a multi-megabyte blob through a shell
variable. Stage 3 already consumed those files via `--slurpfile`; it now
just reuses them rather than receiving them through `$ADDITIONS` /
`$DELETIONS` indirection. The EXIT trap is hoisted up so the new content
tempfile is cleaned even on failure paths.

The previous fix in 742d06e addressed only the GraphQL-payload assembly;
this addresses the per-file accumulation that runs before it.
@MaximusHaximus MaximusHaximus marked this pull request as ready for review April 28, 2026 15:42
`packages/remotion-video` was deleted from the workspace some time ago
(neither `packages/` nor `pnpm-workspace.yaml` reference it anymore),
but its importer entry and ~1180 lines of transitive deps (Remotion
4.0.290 plus its esbuild platform binaries) were still pinned in
`pnpm-lock.yaml`. `pnpm install --frozen-lockfile` accepts that state,
so CI never noticed; a plain `pnpm install` regenerates this exact
diff every time.

Pure prune — no version bumps, no new packages.
@MaximusHaximus MaximusHaximus merged commit 731eb5b into main Apr 28, 2026
4 checks passed
@MaximusHaximus MaximusHaximus deleted the fix/lerna-release-jq-loop-arg-max branch April 28, 2026 15:50
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.

1 participant