Skip to content

[pull] canary from vercel:canary#1134

Merged
pull[bot] merged 3 commits into
code:canaryfrom
vercel:canary
Jun 16, 2026
Merged

[pull] canary from vercel:canary#1134
pull[bot] merged 3 commits into
code:canaryfrom
vercel:canary

Conversation

@pull

@pull pull Bot commented Jun 16, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

unstubbable and others added 3 commits June 16, 2026 10:26
[flakiness
metrics](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.name%3A%22app%20dir%20-%20metadata%20static%20routes%20cache%20should%20generate%20different%20content%20after%20replace%20the%20static%20metadata%20file%22%20%40test.type%3A%22nextjs%22%20%40test.status%3A%28fail%20OR%20pass%29%20%40git.branch%3Acanary&agg_m=count&agg_m_source=base&agg_t=count&fromUser=false&index=citest&start=1780774829532&end=1781379629532&paused=false)

<img width="423" height="173" alt="Screenshot 2026-06-13 at 21 41 05"
src="https://github.com/user-attachments/assets/d9888a77-db05-4ab5-89e3-97f01b9d7353"
/>

This test replaces the static favicon and Open Graph image and rebuilds
to verify the served content changes, so it needs one production build
with the original files and another with the replacements. Running both
`next.start()` cycles in a single test case put two full builds under
the 60s per-test budget, which is easy to exceed on slower CI runners,
where the second build most often stalls while collecting build traces.

We move the first build, start, and baseline measurement into
`beforeAll`, where it can use the longer setup-hook budget, and leave
the test body responsible only for the second build. Keeping the build
out of the test body also makes it idempotent, so a retry recomputes the
new hashes against the baseline that `beforeAll` captures once.
When a `next start` test exceeds the per-test timeout while `next build`
is still running, the build process is left running and tracked by the
next instance, because the build phase of `NextStartInstance.start()`
clears `childProcess` only when the process exits. `jest.retryTimes`
then re-runs the test body in the same process, and `start()`
immediately throws `next already started`, which masks the original
timeout.

`NextStartInstance` now tracks whether a build or a server currently
owns the child process. When `start()` finds a leftover `next build`
process from an interrupted attempt, it stops that process and continues
instead of throwing, so the retry can start from a clean state. The
`next already started` guard is preserved for the case where a server is
genuinely already running.
**Ignore whitespace changes when viewing the diff**

This fixes some of the failures (particularly the ones where a 500
returned from an App API route showed up as status:200 in OTEL).
But the newly added tests have more failures that I skipped for now

1. Missing `setStatus` call
2. Attribute handling was too early, before `sendResponse` was called:



https://github.com/vercel/next.js/blob/6f4d94ac889db3d23a77847ec4f3a9dadf9dd775/packages/next/src/build/templates/app-route.ts#L289-L296
```js
  return routeModule.handle(nextReq, context).finally(() => { // <-- handle() returns the response object from the user code
        if (!span) return
        span.setAttributes({
          'http.status_code': res.statusCode,          // <---------- this is using some default response object, not what handle() returned
          'next.rsc': false,
        })
```
@pull pull Bot locked and limited conversation to collaborators Jun 16, 2026
@pull pull Bot added the ⤵️ pull label Jun 16, 2026
@pull pull Bot merged commit 37e9d09 into code:canary Jun 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants