Skip to content

[pull] canary from vercel:canary#1505

Merged
pull[bot] merged 6 commits intoMLH-Fellowship:canaryfrom
vercel:canary
Mar 20, 2026
Merged

[pull] canary from vercel:canary#1505
pull[bot] merged 6 commits intoMLH-Fellowship:canaryfrom
vercel:canary

Conversation

@pull
Copy link

@pull pull bot commented Mar 20, 2026

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 : )

sokra and others added 6 commits March 20, 2026 13:00
…ity transition (#91701)

## Summary

- Add `'turbopack-transition': 'next-server-utility'` to all server-side imports in the `app-page.ts` template so they are properly placed in the server utility layer, rather than relying on `SharedMerged` chunk groups to handle them
- Remove the now-unnecessary `next-server-utility` transition from `fillMetadataSegment` import in `app_page_loader_tree.rs`
- Add `SharedMultiple` chunk group variant to support multiple shared entries without a merge tag
  - This avoid passing the `parent` into `SharedMerged`, which did break the layout segment optimization.
- Refactor `app_module_graphs` to combine `client_shared_entries` + `has_layout_segments` into a single `Option` parameter, simplifying the API and removing the dead code path for non-page endpoints

## Test plan

- [ ] Verify dev and production builds work with app pages that have layout segments
- [ ] Verify route handlers still build correctly (no client runtime entries passed)
- [ ] Run existing app-dir e2e tests
The `staticPathKey` condition added in #91231 inadvertently applies to
server action requests on dynamic SSG routes when `cacheComponents` is
enabled.

Server action fetch requests from the client do not send the `RSC`
header (`rsc: 1`). They only send `Accept: text/x-component` and the
`Next-Action` header. This means `isRSCRequest` and
`isDynamicRSCRequest` are both `false` for action requests. The new
`staticPathKey` condition (`isSSG && pageIsDynamic &&
prerenderInfo?.fallbackRouteParams`) evaluates to `true` for dynamic PPR
routes, setting `staticPathKey` even though `ssgCacheKey` is `null` for
actions.

With `staticPathKey` set, the request enters the fallback rendering
block, which serves the cached fallback HTML shell with the action
result appended to it, instead of responding with just the RSC action
result.

The fix excludes server action requests from the `staticPathKey`
computation by adding `!isPossibleServerAction` to the condition,
restoring the pre-#91231 behavior where `staticPathKey` was always
`null` for server actions in production.

fixes #91662
closes #91677
closes #91669
### What?

Remove the `MADV_UNMERGEABLE` (Unmergeable) mmap advice from
`turbo-persistence`'s `advise_mmap_for_persistence` helper in
`mmap_helper.rs`.

### Why?

The WSL (Windows Subsystem for Linux) kernel does not support
`MADV_UNMERGEABLE` and returns an error when it is applied, causing
turbo-persistence to fail on WSL. See:
https://x.com/von_cronen/status/2034944304712392891

Additionally, `MADV_UNMERGEABLE` is already the **default** state for
memory pages — KSM (Kernel Same-page Merging) is opt-in via
`MADV_MERGEABLE`. Explicitly setting `MADV_UNMERGEABLE` on pages that
were never marked mergeable is a no-op on standard kernels, so the call
provides no benefit while breaking WSL users.

The `MADV_DONTFORK` advice is retained, as it has a clear correctness
benefit (prevents mmap regions from being inherited by child processes
on `fork()`).

### How?

Removed the `mmap.advise(memmap2::Advice::Unmergeable)` call and its
associated doc comment from
`turbopack/crates/turbo-persistence/src/mmap_helper.rs`.

Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
)

### What?

Move the `"compact database"` tracing span from `turbo-persistence`
(`db.rs`) to the backend layer
(`turbo-tasks-backend/src/backend/mod.rs`), make it a root span, group
it with the sibling `"persist"` span under a shared `"background
snapshot"` root, and emit one span per compaction session rather than
one per iteration.

### Why?

The `compact()` function is called from the background persistence job,
which runs inside a `"persisting background job"` span (inherited via
`.in_current_span()` at task spawn time). Previously the `"compact
database"` span was a child of that ambient span, making it appear
nested under `"persisting background job"` in traces — inconsistent with
its sibling spans `"snapshot"` and `"persist"`, which are already
top-level root spans.

Moving the span to the backend call site and giving it an explicit
parent allows us to:

1. Detach it from the `"persisting background job"` ambient span.
2. Group it with the `"persist"` span under a shared `"background
snapshot"` root span so all snapshot + compaction work appears together
in trace viewers.
3. Keep `turbo-persistence` free of span-policy decisions (root vs.
child), which belong at the call site where the ambient span context is
known.

### How?

- Introduced a non-entered `background_span`
(`tracing::info_span!(parent: None, "background snapshot")`) as a shared
root for both the snapshot/persist work and the compaction loop.
- Passed `background_span.id()` as the `parent_span` argument to
`snapshot_and_persist`, so the `"snapshot"` and `"persist"` spans become
children of it.
- Inside the idle compaction loop, a child `"compact database"` span is
entered and dropped synchronously around each `compact()` call (not
across the `tokio::select!` await point).
- Moved the span creation outside the `MAX_IDLE_COMPACTION_PASSES` loop
so there is one `"compact database"` span per compaction session rather
than one per iteration.
- Removed the `tracing::info_span!("compact database")` span from
`turbo-persistence/src/db.rs` entirely.
- Downgraded the `"sync new files"` span from `info` to `trace` level
(noise reduction).

The non-entered `tracing::Span` is `Send`, so it can be safely held
across the `select!` await without triggering the `future cannot be sent
between threads safely` compile error that an `EnteredSpan` would cause.

---------

Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Fixes based on feedback post release

Fixes: #91715
A regression from #88487

1. Make metadata import lazy with `() => require()`, just like for the layout segments
2. Properly await the return value to better handle TLA modules

This align with Webpack which does this:

<img width="1535" height="509" alt="Bildschirmfoto 2026-03-20 um 11 58 00" src="https://github.com/user-attachments/assets/f2864c86-ccce-4884-8417-c8ae06c05f78" />


Closes PACK-6927
Closes #91700
Closes #91676
@pull pull bot locked and limited conversation to collaborators Mar 20, 2026
@pull pull bot added the ⤵️ pull label Mar 20, 2026
@pull pull bot merged commit 118bdaf into MLH-Fellowship:canary Mar 20, 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.

5 participants