next.js
da13d4d5 - test: cover Turbopack dev reload loop after restart on a warm dev cache (#102643)

Commit
1 day ago
test: cover Turbopack dev reload loop after restart on a warm dev cache (#102643) ### What? Adds a Turbopack dev regression test for an endless full-reload loop after restarting `next dev` on a warm persistent dev cache. On every new HMR subscription, the first update for the main client entry chunk list was `restart`, so the page kept reloading. Related: #100251, #100267. The test steps are adapted from the public reproductions linked in those issues: [dgomez-orangeloops/next-dev-restart-reload-loop](https://github.com/dgomez-orangeloops/next-dev-restart-reload-loop) and [samuelcole/next-hmr-reload-repro](https://github.com/samuelcole/next-hmr-reload-repro). Thanks to their authors. ### Why? The loop no longer reproduces on current canary, but it was timing dependent. This test guards against it coming back. ### How? `test/development/app-dir/dev-restart-warm-cache-reload` repeats a restart cycle 6 times. Each cycle: 1. **Build a session:** wait for hydration, navigate client-side to `/other` and `/third` (checked with a `window` token), then do a full load of `/`. 2. **Restart:** wait until a non-empty persisted cache table written during this session exists and the cache has settled, `SIGTERM` the server, and restart it with a different inlined `NEXT_PUBLIC_` value. 3. **Load:** compile a route handler first, then open `/` in a new tab and wait for the `turbopack-connected` HMR frame. 4. **Assert over 8 s:** exactly one document request, no `restart` HMR frames, and the page renders the new value. It runs only with Turbopack (`@force-gate turbopack`) and takes about 80 s locally. ### Verification All results below are local runs. - **This branch** (`b21ccf2` JS plus a native binding built from that commit): - Final code: passed 1/1 run, plus 1/1 with `__NEXT_CACHE_COMPONENTS=true`. - The previous revision, with identical logic but using `Dirent.parentPath`: passed 2/2 runs. - **Known-bad builds** (the exact Jest test, with `NEXT_TEST_PKG_PATHS` pointing at the packed canary.21 `next`/`@next/env` tarballs and `NEXT_TEST_NATIVE_DIR` set to the native binding): - canary.21 JS + native binding built from canary.22 (`13ae649`): failed in cycle 1 every time, with 89–95 document requests instead of 1. That was 1/1 run on the final code and 2/2 on the previous revision. - Published 16.5.0-canary.21: failed 1/1 run on the previous revision, in cycle 6, with 94 document requests. Earlier assertion-order variants failed 4/4 runs in cycle 1 or 2. - **Other published versions:** a standalone script with the same steps looped on 16.4.2 and on canary.23, .44, .60 and .62. It did not loop on canary.63 (0/12 cycles), .64 (0/22), .68 (0/10) or .75 (0/8). - These are bounded samples of a stochastic trigger, so they don't pin down a fixing commit. <!-- NEXT_JS_LLM --> <!-- fleet 1a799cd2-d209-4fd1-a3c8-d63fc2f8e894 --> --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Fleet <fleet@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Author
Parents
Loading