Skip to content

fix(bench): treat a Next build by the wrong bundler as stale, and let the compile finish - #17

Merged
proggeramlug merged 2 commits into
mainfrom
fix/next-fixture-freshness
Aug 27, 2026
Merged

fix(bench): treat a Next build by the wrong bundler as stale, and let the compile finish#17
proggeramlug merged 2 commits into
mainfrom
fix/next-fixture-freshness

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Three defects in prepare-next-benchmark.sh, all found by running #12's fixture on a developer machine rather than a clean runner. None can show up in CI, which builds from an empty checkout; each cost a full Perry compile before reporting.

1. A turbopack .next/ passed the freshness check

The rebuild condition was route.ts -nt route.js. #12's switch to next build --webpack changed next.config.ts and package.json and left route.ts alone, so a five-day-old turbopack build was judged current, staged, compiled natively for ~8 minutes, and then killed the daemon at preload:

Error: Failed to load chunk server/chunks/[externals]__0l8ei7u._.js
       from runtime for chunk server/app/api/benchmark/route.js

— exactly the computed-require failure #12's config change exists to prevent, reproduced by a stale artifact of the old configuration. The daemon dies on one app, so it looks nothing like perry#8546 until you check the bundler.

Now: freshness considers every input that shapes the bundle (route.ts, layout.tsx, next.config.ts, package.json, package-lock.json); a [turbopack]_runtime.js in the output marks it stale regardless of mtime; .next/ is removed before a rebuild so a bundler switch cannot leave mixed output; and the bundler is asserted after the build, so the wrong one fails in seconds, not a compile later.

2. The script's timeout was shorter than the compile timeout it configures

COOP_NEXT_PREPARE_TIMEOUT defaulted to 1200 s while the script writes compile_timeout_seconds = 1800 into the daemon's runtime config. On a loaded host the outer limit fired with the daemon mid-compile and still entitled to continue: Timed out after 1200s preparing the Next benchmark fixture.

3. The compile budget itself was not adjustable

With the outer limit fixed, the next run died at the inner one: perry compile terminated for deployment next-bench: wall time exceeded 1800 seconds — the same ~8-minute compile, on a host with a load average of 56 from other Perry builds. compile_timeout_seconds was a literal in the generated config.

COOP_NEXT_COMPILE_TIMEOUT now sets it (default unchanged at 1800), and COOP_NEXT_PREPARE_TIMEOUT defaults to that plus 900 s, so the outer limit is derived from the inner one and cannot undercut it again.

Verification

  • bash -n clean.
  • Observed all three failures in sequence on main at ci: exercise and measure the real Next.js app in the Linux proof #12 on this machine; rebuilding from a removed .next/ produced webpack output (webpack-runtime.js, empty chunks/) that the daemon accepted as a compile input.
  • The Linux proof builds from a clean checkout with the defaults, so this change is a no-op there beyond the post-build bundler assert.

https://claude.ai/code/session_01UZJbhb2FTuakurTHPAKQgd

… the compile finish

prepare-next-benchmark.sh rebuilt .next/ only when route.ts was newer than
route.js. The switch to `next build --webpack` changed next.config.ts and
package.json and left route.ts alone, so a five-day-old turbopack .next/
passed as fresh, was staged, compiled for eight minutes, and killed the
daemon at preload:

  Error: Failed to load chunk server/chunks/[externals]__0l8ei7u._.js
         from runtime for chunk server/app/api/benchmark/route.js

Freshness now considers every input that shapes the bundle (route.ts,
layout.tsx, next.config.ts, package.json, package-lock.json) and treats a
`[turbopack]_runtime.js` in the output as stale regardless of mtime; the
build is preceded by removing .next/ so a bundler switch cannot leave mixed
output; and the bundler is asserted after the build, so the failure lands in
seconds rather than one full Perry compile later.

Separately, the script's own timeout (1200 s) was shorter than the
compile_timeout_seconds (1800) it writes into the daemon config, so on a
loaded host it reported "Timed out" with the daemon mid-compile and entitled
to continue. Default raised to 2700 s.

Claude-Session: https://claude.ai/code/session_01UZJbhb2FTuakurTHPAKQgd
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 46 minutes.

View limit details

Limit details: You’ve used the included review currently available.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 9efa7019-b721-4d56-a750-d98cce5c0b15

📥 Commits

Reviewing files that changed from the base of the PR and between 3648d81 and 3b70771.

📒 Files selected for processing (1)
  • scripts/prepare-next-benchmark.sh
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 075a0240-75e9-4aad-8234-e4c9696e2740

📥 Commits

Reviewing files that changed from the base of the PR and between 3555278 and 3648d81.

📒 Files selected for processing (1)
  • scripts/prepare-next-benchmark.sh

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The benchmark preparation script now allows longer compilation, detects stale or Turbopack-generated .next output, rebuilds when relevant inputs change, and rejects results containing a Turbopack runtime marker.

Changes

Benchmark preparation

Layer / File(s) Summary
Freshness and webpack output validation
scripts/prepare-next-benchmark.sh
The default preparation timeout increases to 2700 seconds. Freshness checks cover missing output, Turbopack output, route and layout sources, Next configuration, the package manifest, and the lockfile. A post-build check rejects .next output with the Turbopack runtime marker.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 3648d

This localized script change improves benchmark fixture freshness checks and allows sufficient time for compilation; no actionable merge-blocking risk remains after normal checks and review.


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/settings/billing.

Comment @coderabbitai help to get the list of available commands.

The script wrote compile_timeout_seconds = 1800 into the generated config with
no way to change it. On a host busy with other Perry builds (load average 56)
the ~8-minute compile exceeded it and the daemon reported:

  perry compile terminated for deployment next-bench: wall time exceeded 1800 seconds

COOP_NEXT_COMPILE_TIMEOUT now sets it; COOP_NEXT_PREPARE_TIMEOUT defaults to
that plus 900 s so the outer limit can never undercut the inner one.

Claude-Session: https://claude.ai/code/session_01UZJbhb2FTuakurTHPAKQgd
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