Skip to content

fix(deps): bump execjs to 2.10.2; add assets precompile CI job - #3055

Merged
mroderick merged 3 commits into
masterfrom
fix/execjs-2-10-2-and-precompile-ci
Oct 24, 2026
Merged

mroderick merged 3 commits into
masterfrom
fix/execjs-2-10-2-and-precompile-ci

Conversation

@mroderick

@mroderick mroderick commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Deploys to Heroku have been rejected since PR #3051 (json 2.21.2 → 3.1.0): rake assets:precompile aborts with ArgumentError: unknown keyword: create_additions. This PR bumps execjs to 2.10.2, which fixes it, and adds a CI job that runs the asset precompile so this class of breakage fails in CI instead of at deploy time.

Key changes

  • execjs 2.10.1 → 2.10.2 (Gemfile.lock only). 2.10.1 passed create_additions: false to JSON.parse, a keyword json 3.x removed; 2.10.2 (released 2026-08-12) calls JSON.parse(output) without it. Terser's constraint (>= 0.3.0, < 3) already allows the new version, so no Gemfile change is needed.
  • New Assets Precompile job in .github/workflows/ruby.yml: rake assets:precompile under RAILS_ENV=production. The task boots the app without connecting to a database, so a placeholder DATABASE_URL resolves the adapter, and PLANNER_SECRET (the app's own secret, set in config/initializers/secret_token.rb) plus AWS credentials (AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY, read by config/initializers/carrier_wave.rb) stand in for the real values; nothing connects to S3 during precompile.
Detail

The failure path: rake assets:precompile → Sprockets → Terser 1.2.8 → ExecJS 2.10.1 ExecJS::ExternalRuntime::Context#extract_result, which called ::JSON.parse(output, create_additions: false) (external_runtime.rb:69). json 3.1.0 removed the create_additions keyword from JSON.parse (flagged as a TODO in json 2.21.2: "extract :create_additions support to another gem for version 3.0"), so every production build died while minifying the first JS asset. The build log confirmed the bundler cache swap of json 2.21.2 for 3.1.0 in the same run.

Why CI missed it: the workflow runs RuboCop, parallel RSpec (uncompressed assets, RAILS_ENV=test), and bundler-audit — nothing loads ExecJS or Terser. The only caller of ExecJS is the Terser compressor wired in config/environments/production.rb.

Verified locally with json 3.1.0 installed: ExecJS.compile("1+1") raises the ArgumentError under execjs 2.10.1 and succeeds under 2.10.2; RAILS_ENV=production PLANNER_SECRET=fake DATABASE_URL=postgres://u:p@localhost:5432/planner_placeholder bundle exec rake assets:precompile completes.

Review notes

No special focus requested; the diff is lockfile plus one CI job. Deliberately not done: no Node version pinning (the Heroku warning about the default Node.js version is pre-existing), and no removal of the bin/bundle binstub (also pre-existing, unrelated).

execjs 2.10.1 calls JSON.parse(output, create_additions: false), and
json 3.1.0 removed the create_additions keyword, so rake
assets:precompile aborts with ArgumentError: unknown keyword:
create_additions whenever the Terser compressor runs. Dependabot PR
#3051 bumped json to 3.1.0 and deploys have been rejected since.

execjs 2.10.2 (released 2026-08-12) drops the keyword. Verified locally:
ExecJS.compile raises with execjs 2.10.1 and succeeds with 2.10.2, and
rake assets:precompile completes with json 3.1.0 installed.
@mroderick
mroderick force-pushed the fix/execjs-2-10-2-and-precompile-ci branch from 1a2401e to 3aa58b1 Compare October 24, 2026 06:09
The test suite never runs the Terser compressor, so the execjs/json
incompatibility passed CI while rejecting every Heroku deploy. The new
job runs rake assets:precompile in RAILS_ENV=production. It boots the
app without touching a database, so a placeholder DATABASE_URL is
enough, and PLANNER_SECRET satisfies config/initializers/
secret_token.rb.
@mroderick
mroderick force-pushed the fix/execjs-2-10-2-and-precompile-ci branch from 3aa58b1 to ae088c5 Compare October 24, 2026 06:13
@mroderick
mroderick marked this pull request as ready for review October 24, 2026 06:24
@mroderick
mroderick enabled auto-merge October 24, 2026 06:27
@mroderick
mroderick disabled auto-merge October 24, 2026 06:27
@mroderick
mroderick merged commit 0c6f33e into master Oct 24, 2026
11 checks passed
@mroderick
mroderick deleted the fix/execjs-2-10-2-and-precompile-ci branch October 24, 2026 06:27
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