[pull] canary from vercel:canary - #1413
Merged
Merged
Conversation
## Summary Rename the internal `GenerateStaticParamsStore` work-unit context to `BuildTimeGeneratorStore`, with discriminant `build-time-generator`. Carry the public export name in a required `functionName` field so shared error paths identify the generator that is actually running. This is a behavior-preserving preparatory refactor. `generateStaticParams` remains the only producer. Every consumer retains the same branch, so public-cache support, unavailable request APIs, inherited root parameters, and existing error messages are unchanged. The name describes a build-time generator's execution context rather than one function. For example, another generator that loads configuration through a cached helper should be able to reuse this context without introducing another work-unit variant throughout the framework. Function-specific contexts can be added later if their semantics actually diverge. For example, a generator that calls `headers()` needs an error naming that generator, not an error that always says `generateStaticParams`. The field is set explicitly rather than read from `Function.name`, which may change during bundling. Request APIs, private-cache rejection, revalidation, and rendering invariants use this name. Missing-root-param advice about parent gSP calls remains specific to gSP; other generators report that the value is unavailable in their own scope. This independent prerequisite for #97393 introduces no API or feature flag. The API-specific initializer and its error fixtures live in #97393, so this PR remains independently landable and behavior-preserving for existing gSP users. ## Verification - Existing `generate-static-params-errors`, `app-root-params-getters/generate-static-params`, and `generate-static-params-error` fixtures: all ten production Webpack tests pass, including unchanged error strings and parent root-param behavior. - Existing `use-cache/use-cache.test.ts` static-HTML assertion passes, exercising cached helpers called from gSP in both a page and route handler. - Full bootstrap and TypeScript declaration build pass. <!-- NEXT_JS_LLM -->
## Summary - Distinguish an unreachable agent-feedback rollout gate from an explicitly disabled rollout. - Exit the internal feedback-instructions command with actionable retry guidance so sandboxed agents can request network access instead of silently skipping reports. ## Verification - `pnpm exec jest packages/next/src/cli/internal/agent-feedback-status.test.ts packages/next/src/cli/internal/agent-feedback-instructions.test.ts --runInBand` - `pnpm --filter=next types` - `pnpm --filter=next build` - Verified the built CLI exits 1 with retry guidance without network access and returns the protocol with network access. <!-- NEXT_JS_LLM -->
## Summary This enables strict route matching by default. App Router URLs that cannot construct a complete route tree are rejected, unreachable pages are reported, and incomplete catch-all matchers are pruned. If strict route matching finds one of these invalid route structures, Next.js warns that the validation implies a bug in the app and points to `deprecated.looseRouteMatching: true` as a temporary escape hatch. The deprecated option only accepts `true`; strict matching remains the normalized internal behavior when the option is absent. For example, this layout cannot render either URL as a complete route because neither named slot has a page or default for the URL matched by its sibling: ```text app/ ├── layout.tsx ├── @left/foo/page.tsx └── @right/bar/page.tsx ``` Previously the app could depend on soft navigation preserving stale slot state even though `/foo` and `/bar` could not be loaded directly. With strict route matching enabled, the build reports the incompatible slots and the two unreachable pages. Adding explicit defaults makes the intended fallback behavior valid again. ## Verification - `pnpm build-all` - `pnpm exec jest packages/next/src/server/config.test.ts --runInBand` - `parallel-routes-pruned-matchers` in production with Turbopack and Webpack - `parallel-routes-leaf-segments` in production with Turbopack - strict diagnostic fixtures in production with Turbopack <!-- NEXT_JS_LLM -->
## Summary - Narrow build-time generator names to a literal type that can be extended as new generators are added. - Split the combined revalidation diagnostic into render, cached-function, and build-time-generator errors so each failure reports only its actual context and never needs a fallback generator name. - Cover all three contexts in the existing development and production test suites. Follow-up to the review feedback on #98891. ## Verification - `HEADLESS=true pnpm test-dev-webpack test/e2e/app-dir/revalidatetag-rsc/revalidatetag-rsc.test.ts` (3 tests) - `HEADLESS=true pnpm test-start-webpack test/e2e/app-dir/revalidatetag-rsc/revalidatetag-rsc.test.ts` (3 tests) - Production Webpack `generate-static-params-errors` suite (6 tests) - `pnpm --filter=next types` <!-- NEXT_JS_LLM -->
## Summary Migrate the shared cache-components error tests and two additional legacy deployment exclusions from `skipDeployment`/`skipped` to test gates, so these callers can land on canary before the API is removed. Place the cache-error gate on the existing named `describe` boundary in each of the 12 `.test.ts` entry files. Jest transforms gate pragmas in test files; a gate in the shared utility would be inert. The helper continues registering the same tests inside those entry-level suites, preserving their names and snapshots. These tests inspect local prerender builds and cannot run against a deployment. The other two callers cover segment-cache fixture mutation and production output-file tracing. This is a standalone preparatory migration, not the removal of the legacy API itself. ## Verification - Rebased onto canary at `ccef3db535`; the stable patch ID matches the original migration exactly. - On the rebased tree, all 77 gate infrastructure unit tests passed. - Deploy-mode Jest collection of all 12 cache-error entry files: 236 skipped, zero executed, and no deployment started. - Prettier, ESLint, and diff whitespace checks passed. - Full bootstrap attempted but blocked by missing package-level dependencies (`microbundle`) in the temporary worktree; no full dev/start integration run is claimed. <!-- NEXT_JS_LLM -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 : )