Skip to content

docs: spec and plan for the upstream Next abort-fix validation - #402

Merged
blove merged 8 commits into
mainfrom
blove/next-abort-upstream-validation
Aug 14, 2026
Merged

blove merged 8 commits into
mainfrom
blove/next-abort-upstream-validation

Conversation

@blove

@blove blove commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The design and implementation plan behind the validation posted to vercel/next.js#96704, and recorded in #377.

Docs only — no source changes.

Outcome

Both open upstream PRs eliminate the destination stream closed early noise (0/0/0 across three suite runs each, against a 28–42 baseline) and both preserve render cancellation.

That second half is the part worth keeping. Zero errors is also what you'd get from a fix that stopped cancelling renders while quietly burning server time finishing responses nobody reads. The plan's "cancellation twin" separates those, and it is the check neither PR's own test currently provides.

Why the plan is committed with its failures visible

The plan was wrong in eight places, and every one was caught by a gate rather than by a number that looked plausible:

  • Task 1's first twin passed its marker check while reproducing nothing — it would have scored both PRs identically whether or not they worked. The plan lacked a positive control on the error, only on the marker. That gap is the single most important correction here.
  • link:ing a built Next cannot work: Turbopack refuses to compile files outside the workspace root, so its resolution fails even though Node's succeeds.
  • pnpm install silently moved ^16.3.0 to 16.3.1, which would have made an arm partly a version bump. That accident established 16.3.1 does not carry either fix.
  • pnpm --filter next build fails on missing workspace deps; turbo's build task is required.
  • Task 5 reused arm B's clone, which would have destroyed it — and both arms would then have agreed, the most convincing form of a wrong answer.
  • pkill -f "next start" can leave the listener alive, so an arm can silently measure the previous arm's build.
  • The results path resolved inside the repo the plan itself forbids writing to.
  • A hardcoded marker id would have made every per-run grep match nothing — read by the twin as "cancelled", a false pass.

Kept rather than tidied away, because the corrections are the reusable part.

Raw logs live outside the repo at /Users/blove/repos/next-abort-results.

🤖 Generated with Claude Code

blove and others added 8 commits August 13, 2026 18:45
Rather than patch Next locally to quiet pretable #377, help the upstream fix
land: two community PRs sit unreviewed with no maintainer comment, and both
rest on one synthetic test.

The design's load-bearing part is the check the error count cannot provide. A
fix that correctly classifies the abort and a fix that stopped cancelling
renders BOTH show zero errors — the second silently burns server time finishing
responses nobody reads. So each arm runs a cancellation twin that fails loudly
in that case, and the twin is itself proven capable of firing first.

Nothing is posted upstream without explicit approval of the drafted text.

Co-Authored-By: Claude Opus 5 <[email protected]>
Three arms, each verified green before its numbers count, plus a cancellation
twin that fails loudly if a fix wins by no longer cancelling renders rather
than by classifying the abort correctly.

Task 1 exists to establish the twin's discriminating power BEFORE any PR is
measured: it proves the marker can fire at all, then proves it stays absent on
an aborted baseline render. Whether React declines to render a component after
an abort is left as a tested gate with a documented alternative, not an
assumption — a wrong guess is caught in the first task instead of silently
invalidating every later number.

Co-Authored-By: Claude Opus 5 <[email protected]>
…fects

The twin aborted a plain HTML document load. On unmodified 16.3.0 that gave
closed-early 0 and RENDER-COMPLETED 1 — it neither cancelled the render nor
reproduced the phenomenon at all, so it had no discriminating power to lend the
PR arms. They would have scored identically whether or not the PRs worked.

That matches both the source analysis (the RSC path pipes into a PassThrough
with a direct res.close -> pt.destroy() link; the document path goes through a
pipe chain where destroy does not propagate upstream) and the proxy data from
the original investigation, where the aborting requests were ?_rsc= router
fetches. Task 1 now drives a real client-router navigation with Playwright
rather than forging RSC headers, which 307 without the router state tree.

The gate the plan was missing: a positive control on the ERROR, not just on the
marker. A baseline that cannot produce the error makes every later zero
meaningless. That is now Gate B, and it is what would have caught this before
three arms of numbers.

Two defects of mine, both found by review rather than by running:
- RESULTS resolved to /Users/blove/repos/pretable/next-abort-results — inside
  the repo the plan forbids writing to. Off by one in the ../ count.
- The four files as written do not build; Next's generated /_global-error needs
  a root route.

And one found while rewriting: the driver took an id but the link hardcoded
?id=nav, so every per-run grep would have matched nothing — and an absent
marker is exactly what this twin reads as 'render cancelled'. A false pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
`pnpm --filter next build` does not build workspace dependencies and fails in
~3s on a missing polyfill-module. Turbo's build task has dependsOn ^build and
does. Both Task 3 and Task 5 carried the broken command.

The spec's named risk did not materialise: Next's postinstall downloads a
prebuilt @next/swc-darwin-arm64, so no Rust compiles. Install 56s, build 63s.
The gate stays for later arms, but is no longer the thing to plan around.

Recorded what arm B actually is, since '7 files changed' oversells it: one
source file at +12 lines, six new e2e fixtures. The change registers a close
listener on the PassThrough BEFORE pipeable.pipe(pt), so Node runs it ahead of
React's own handler and aborts with a reason isAbortError recognises.

Also recorded two source facts that make the fix load-bearing rather than
redundant, both of which belong in the upstream write-up: the existing
if (signal) abort block is dead in production because its signal is gated on
__NEXT_DEV_SERVER, which prod inlines as ''; and __NEXT_USE_NODE_STREAMS is
inlined true for the app bundle, so the Node path is the one that serves
production.

Co-Authored-By: Claude Opus 5 <[email protected]>
Task 5 checked out PR #96717 in arm B's clone, which would overwrite arm B's
dist. Both builds have to survive until the measurement window, because the
spec requires all three arms measured back to back under one load profile — and
rebuilding an arm mid-window changes the load the other arms were measured
under. A second clone is 45s and 416M.

Co-Authored-By: Claude Opus 5 <[email protected]>
Task 1 found pkill -f 'next start -p NNNN' can leave the listener up: the
wrapper exits and the actual 'next-server' child does not carry the pattern.
In the arm loops that is not a tidiness issue — a surviving server means the
next arm's suite runs against the PREVIOUS arm's build and reports a confident
wrong number, which is exactly the class of silent measurement error this plan
exists to avoid. Killing by port cannot miss.

(Verified separately that the pattern DID match for undefined
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command "next" not found, so
the #376 perf measurement, which used that form, stands.)

Tasks 4 and 5 still called probe.mjs, which Task 1 deleted in favour of
drive.mjs — and the argument order swapped from id-then-mode to mode-then-id, so
those calls would have silently measured the wrong thing rather than failing
loudly. Also recorded that drive.mjs needs @playwright/test resolvable from the
twin's own directory, since Node resolves ESM bare specifiers from the importing
file, not from cwd.

Co-Authored-By: Claude Opus 5 <[email protected]>
Task 5 Step 1 said 'cd $NEXTSRC' — a variable that does not exist — and omitted
the clone entirely, because it was written assuming one shared checkout. Run
from a shell where Task 3 had executed, cwd would still be arm B's clone, so it
would have checked #96717 out on top of arm B and destroyed it. Both arms would
then have measured the same build and agreed, which is the most convincing
possible form of a wrong answer.

Arm C also corrected arm B's recorded claim: stream-ops.node.ts is not
byte-identical between v16.3.0 and the merge-base (a 2-line unrelated drift in
continueFizzStream). The patched REGION is identical. The upstream write-up must
make that distinction rather than overclaim.

Tightened the diff expectation from '~95/~12' to an equality gate; it held
exactly on both arms.

Co-Authored-By: Claude Opus 5 <[email protected]>
Both PRs eliminate the error (0/0/0 across three suite runs each) against a
28-42 baseline, and both preserve render cancellation — the distinction the
error count alone could not make, and the reason the cancellation twin existed.

The load confound was real enough to check: the PR arms ran at load 5-8 while
the first baseline ran at 13-25, and lower load narrows the window a disconnect
can land in. Re-measuring the unmodified baseline under the quiet load still
gave 28, so the zeros are the patches.

Two plan assumptions were wrong. A link:ed Next build cannot be used —
Turbopack refuses to compile files outside the workspace root, so its
resolution fails even though Node's succeeds. And pnpm install silently moved
^16.3.0 to 16.3.1, which would have made an arm partly a version bump; that
accident also established that 16.3.1 does not carry either fix.

Co-Authored-By: Claude Opus 5 <[email protected]>
@vercel

vercel Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pretable Ready Ready Preview Aug 14, 2026 5:18pm

@github-actions

Copy link
Copy Markdown
Contributor

Vercel preview ready

Preview: https://pretable-67sceksr3-cacheplane.vercel.app
Commit: fa1bf7389fb3a4d196ec23b919de9ae344b77f3e

Updated automatically by the deploy-preview job.

@blove
blove merged commit 8827604 into main Aug 14, 2026
17 checks passed
@blove
blove deleted the blove/next-abort-upstream-validation branch August 14, 2026 17:26
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