[pull] main from cloudflare:main#167
Merged
Merged
Conversation
…5.13 (#1708) * ci(bonk): switch reviews to GPT-5.5 xhigh Bonk and BigBonk still routed review runs to Claude Opus 4.6 with the max variant. That leaves review commands and local opencode review agents on the old Anthropic model instead of the intended OpenAI xhigh setup. The workflows now route through Cloudflare AI Gateway to openai/gpt-5.5, request the xhigh variant, and pin opencode to 1.14.40 so the cf-ai-gateway reasoning_effort propagation fix from anomalyco/opencode#25573 is present. The viguy and reviewer agent frontmatter plus contributor docs now describe the same GPT-5.5 review setup. * ci(bonk): keep regular Bonk on Opus 4.7 The review model update should split regular Bonk and BigBonk. Regular Bonk is meant to use Claude Opus 4.7, while BigBonk should use GPT-5.5 with xhigh reasoning. Point the /bonk workflow back to the Anthropic Opus 4.7 model through Cloudflare AI Gateway and keep its max variant. Leave /bigbonk on GPT-5.5 xhigh, and update contributor docs to describe the two review paths. * ci(bonk): flip Bonk and BigBonk models The requested review model split is regular Bonk on GPT-5.5 xhigh and BigBonk on Claude Opus 4.6 max. Update only the Bonk workflow model and variant inputs. Leave the local opencode agent frontmatter and contributor docs unchanged from the existing PR branch. * ci(bonk): align agents with review workflows Bonk should run GPT-5.5 xhigh through the reviewer agent, while BigBonk keeps the viguy agent on Claude Opus 4.6 max. Route the Bonk workflow to the reviewer agent, set viguy's default model to Claude Opus 4.6, and use the same 0.2 temperature for both opencode agent definitions. * ci(bonk): use direct model ids in agent defaults OpenCode agent frontmatter should use the normal provider/model ids. The workflow inputs still need Cloudflare AI Gateway-prefixed model ids because the GitHub action routes through AI Gateway credentials. Set viguy back to anthropic/claude-opus-4-6 and reviewer to openai/gpt-5.5 while leaving the Bonk and BigBonk workflow model overrides unchanged. * Update CONTRIBUTING.md Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com> * Update CONTRIBUTING.md Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com> * ci(bonk): bump to Opus 4.8 high, GPT-5.5 high, opencode 1.15.13 * ci(bonk): bump models to Opus 4.8 high and GPT-5.5 high, opencode 1.15.13 * ci(bonk): bump models to Opus 4.8 high and GPT-5.5 high, opencode 1.15.13 --------- Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
…config (#1710) PR #1701 added `resolve.noExternal: true` while loading a TypeScript next.config so a baseUrl-local file could shadow an installed package of the same name. That de-externalizes every installed package and forces it through Vite's module runner, which breaks CJS config plugins that call `require` / `require.resolve` at runtime — e.g. `@next/mdx`, which failed the app-router-playground production build with "require is not defined". This was not caught pre-merge because deploy-examples is skipped for fork PRs. Drop the blanket `noExternal: true`. Installed packages stay externalized (so CJS config plugins keep working), and the native Vite 8 `resolve.tsconfigPaths` resolver still resolves baseUrl-local bare imports that have no installed package of the same name (the real Next.js tsconfig-extends fixture). The only behavior we give up is shadowing an installed package with a baseUrl-local file of the same name, which no Next.js fixture exercises. - Update the shadowing test to assert the installed package wins. - Add a regression test for an @next/mdx-style CJS plugin that calls `require.resolve` at runtime (red before this change). - Document the package-precedence behavior in the README limitations entry.
* chore(deps): bump `@vitejs/plugin-rsc` to 0.5.27 * test(rsc): cover `export * from` in 'use client' modules (#1352) Ports the build fixture from #1373 to verify the `@vitejs/plugin-rsc` 0.5.27 bump resolves the upstream "unsupported ExportAllDeclaration" error. Covers bare `export *`, nested/renamed re-exports, `export * as Ns from`, and destructured re-exported bindings. The version bump fixes this natively, so the vinext-side workaround plugin from #1373 is no longer needed. Refs #1352
…ment.getInitialProps head (#1677) * fix(shims/head): match Next.js charset/viewport order and merge _document.getInitialProps head (#1569) Pages Router head emission did not match Next.js's canonical order (`<meta charset>` then `<meta viewport>` then user tags, all with `data-next-head=""`) and ignored head tags returned from a user `_document.getInitialProps()`. - `next/head` shim now seeds `defaultHead()` (charset + viewport) into the SSR collector before user tags, mirroring `defaultHead()` in `next/src/shared/lib/head.tsx`. They flow through the same dedupe pipeline so users can still override via `key="charset"` / `key="viewport"`. - Serialised attribute names follow HTML conventions (`charSet` -> `charset`, `httpEquiv` -> `http-equiv`, etc.), matching Next.js's `test/e2e/next-head/index.test.ts` exact-string assertion. - `next/document` shim no longer hardcodes charset/viewport in `<Head>` (those defaults now flow from `next/head`); fallback HTML shells in `dev-server.ts` and `pages-page-response.ts` likewise drop the duplicates. - New `setDocumentInitialHead()` accessor and ALS-backed state lets the SSR pipeline forward head tags returned by user `_document.getInitialProps()` into the same dedupe pipeline as `next/head` children. Both the dev server and the prod `renderPagesPageResponse` invoke `_document.getInitialProps()` when present and pass the result through. Adds focused regression coverage in `tests/head.test.ts` for ordering, default attribute serialisation, key-based overrides, and the `_document.getInitialProps()` merge path. Refs #1569. * fix(pages-router): address review feedback on _document head merge - Extract shared `callDocumentGetInitialProps` helper under `server/document-initial-head.ts` so both `dev-server.ts` and `pages-page-response.ts` go through the same code path. The previous duplicated try/catch blocks drifted independently and were the kind of runtime-behavior that AGENTS.md says should live in a helper. - Skip the call when `DocumentComponent.getInitialProps` is still the unmodified default inherited from vinext's `next/document` shim. Comparing against the captured base reference (`DEFAULT_GET_INITIAL_PROPS`) distinguishes a user override from the default — extending `Document` without overriding the method inherits the same static function, so invoking it on every render is wasted work. - Use `jsxAttrToHtml` on the client-side `_applyHeadPropsToElement` path so `httpEquiv` is set as `http-equiv` rather than `httpequiv` (lowercased by `setAttribute`). Matches the SSR output and prevents a hydration mismatch when SSR emits the hyphenated form. - Update stale `tests/document.test.ts` Head assertions: the shim's `<Head>` no longer hardcodes charset/viewport — those flow through `next/head`'s `defaultHead()` so the dedupe pipeline handles them.
…#1684) Concurrent `Router.push` calls (or back-to-back `<Link>` clicks) to the same gSSP route each fired their own `_next/data/<id>/<page>.json` fetch. The Next.js parity test asserts `hit: 1` after 4 rapid navigations to a slow page; vinext was producing `hit: N`. Add a module-scoped in-flight Promise cache keyed by the resolved data URL, mirroring `fetchNextData()`'s `inflightCache` in `packages/next/src/shared/lib/router/router.ts`. Concurrent callers share one `fetch()` invocation and each receive a cloned Response. Entries self-evict on settle so the next navigation re-fetches fresh. The shared fetch deliberately ignores per-caller `AbortSignal`s: stale navigations are already detected via `_navigationId` + `assertStillCurrent()` checkpoints after the await, and aborting the shared request on behalf of one superseded caller would destroy the dedup gain for every other concurrent caller. Pre-await abort still surfaces so callers see the documented `NavigationCancelledError` / `AbortError` when supersession happened before the fetch was even attempted. Wired into both `navigateClientData()` (the JSON fast path) and `resolveMiddlewareDataRedirect()` (the soft-redirect probe).
…1713) * fix(shims/head): keep charset/viewport defaults on client hydration The Pages Router next/head client sync (syncClientHead) removed every [data-next-head] element and rebuilt the projection from only the user <Head> children, omitting defaultHead() (charset + viewport). After the first <Head> mounted on the client, the server-rendered charset and viewport meta tags were stripped and never re-added. PR #1677 seeded defaultHead() into the SSR collector (getSSRHeadHTML) but not the client path. Next.js's reduceComponents() always concatenates defaultHead() on both server and client, so the defaults must survive hydration here too. Seed defaultHead() into the client reduce, mirroring the SSR path. Users can still override via key="charset" / key="viewport" through the same dedupe pipeline. Adds a regression test exercising the client projection with a minimal DOM double (the repo has no jsdom). * fix(shims/head): reconcile client head in place to preserve SSR order The client sync still wiped every [data-next-head] node and re-appended the projection, which moved the SSR-emitted charset/viewport/title tags to the end of <head> (after the modulepreload/script links) and caused DOM churn/flicker on every <Head> update. Mirror Next.js's head-manager.ts updateElements(): diff the desired tags against existing ones via isEqualNode(), leave matches untouched in their original DOM position, append only genuinely new tags, remove stale ones, and prepend a newly-created <meta charset> so it stays first. Extends the regression tests with a richer DOM double asserting node reuse, order preservation, insertion, removal, and charset-first behavior. * test(shims/head): client-side override coverage; document divergences Address non-blocking review notes from /bigbonk: - Add a client-side test asserting a user key="viewport" overrides the default viewport on _syncClientHead (mirrors the SSR override test), locking in the dedupe-precedence parity claim. - Document the deliberate charset prepend if/else divergence from Next.js's head-manager.ts (which prepends then unconditionally appendChilds). - Document the <title> reconciliation divergence (Next.js sets document.title directly; we reconcile title like any tag — cosmetic only). - Reconcile issue references to #1569 / #1677 in the client describe block.
…ncers (#1682) * fix(pages-router): run _document.getInitialProps with renderPage enhancers Refs #1468. Custom `pages/_document.tsx` files that override `getInitialProps` and call `ctx.renderPage({ enhanceApp, enhanceComponent })` to wrap the App/Component tree — the standard styled-components / emotion pattern for SSR style collection — silently no-op'd. The shim type advertised `renderPage`, but the SSR pipeline never invoked `getInitialProps` with a real `renderPage`, so the enhancers never ran and `<Document>` never saw the wrapped tree. This wires the Pages Router `_document.getInitialProps` contract through both the prod (`renderPagesPageResponse`) and dev (`streamPageToResponse`) pipelines: - A new `enhancePageElement(opts)` option exposes the App/Component separation needed to apply `enhanceApp` / `enhanceComponent` from the user's renderPage call. `pages-server-entry.ts` and the dev server both wire it up to wrap `App({ Component, pageProps })`. - When `DocumentComponent.getInitialProps` is defined, we invoke it with a minimal `DocumentContext` shim that includes `renderPage` and `defaultGetInitialProps`. `renderPage` rebuilds the React tree via `enhancePageElement`, drains the React stream to a string, and returns `{ html, head }`. - If renderPage was called, the streaming body fallback is replaced with the captured `html` so `_document` sees a complete body (matches Next.js's `loadDocumentInitialProps` behaviour). Any `styles` element returned by getInitialProps is rendered to HTML and appended to the document head. - If `getInitialProps` throws, returns a non-string `html`, or never invokes renderPage, we fall through to the existing streaming path — no user-visible regression for the common case where `_document` has no `getInitialProps`. Adds a focused regression in `tests/pages-page-response.test.ts` that confirms `enhanceApp` and `enhanceComponent` both run and that the enhanced tree appears in the rendered body. Mirrors `.nextjs-ref/test/development/basic/styled-components/pages/_document.js` and `.nextjs-ref/packages/next/src/server/render.tsx` (`loadDocumentInitialProps` / `enhanceComponents`). Test plan: - `pnpm test tests/pages-page-response.test.ts` - `pnpm test tests/document.test.ts tests/head.test.ts tests/shims.test.ts` - `pnpm test tests/pages-router.test.ts` - `pnpm test tests/entry-templates.test.ts` - `pnpm run check` * refactor(pages-router): consolidate _document renderPage onto shared helper Address review feedback on the _document.getInitialProps + renderPage contract: - Extract a single shared runDocumentRenderPage() helper in pages-document-initial-props.ts, used by both the prod (pages-page-response.ts) and dev (dev-server.ts) SSR pipelines. The duplicated inline implementation in dev-server.ts is removed (-86/+38). - withScriptNonce now lives in one place (the shared helper); both callers' enhancePageElement return the bare enhanced tree. - Remove dead headFromDocument (returned but never consumed). - Drop the redundant React.Fragment wrapper around enhancedElement. - Reconcile with #1677's loadUserDocumentInitialProps: getInitialProps is invoked at most once. A discriminated result (skipped/consumed/rendered) signals when the fast path must be skipped so getInitialProps is not called twice (which would re-throw a user error as a 500). - Add edge-case tests: styles returned, getInitialProps throws (clean fallback), renderPage never called. * refactor(pages-router): address re-review nits on shared renderPage helper - runDocumentRenderPage now skips the base-shim getInitialProps via the BASE_GET_INITIAL_PROPS identity check (mirrors loadUserDocumentInitialProps) so an unoverridden _document stays on the cheap fast path. - Dev now forwards { pathname, query, asPath } as the DocumentContext, matching the prod pipeline's parity. - Add a test for renderPage being called but the underlying stream render throwing (falls back cleanly to the streaming render). * fix(pages-router): drop unused RunDocumentRenderPageResult export, document pageProps capture - Remove the `export` on the internal `RunDocumentRenderPageResult` type (knip flagged it as an unused export; it is only used as the helper's return type within the same module). - Document why `enhancePageElement` captures `pageProps` from the closure rather than receiving it as a parameter (it is invoked once per request with a single `pageProps`; only the enhancers vary). * refactor(pages-router): address bonk re-review nits - dev-server enhancePageElement: document the pageProps closure capture to mirror the prod entry's comment - prod renderStylesToString: render the collected styles fragment with the plain stream renderer instead of the full <Document> shell renderer - lazify pageElement construction so it is only built on the streaming path (never used when renderPage already produced the body)
* fix: align app router navigation parity * fix(app-router): preserve canonical RSC and hard-nav semantics App Router RSC requests now keep the route pathname shape when adding _rsc. Stripping a trailing slash made trailingSlash routes fetch a non-canonical URL and let the server redirect the client-side RSC request back to the slash form. The MPA navigation scheduler also keys pending hard navigations by both href and history mode so a later replace does not reuse an earlier push closure. Redirect handling keeps the global browser bridge out of passive server rendering while retaining client-side redirect recovery. Adds focused regression coverage for trailingSlash RSC requests, same-href push-to-replace hard navigation, and client redirect guard loops. Updates existing navigation observers to the canonical route URL plus _rsc transport. * fix(app-router): stabilize action and prefetch parity * fix(app-router): reset MPA dedupe after bfcache restore A bfcache-restored App Router document can keep the scheduler's last pending hard-navigation marker after the external navigation already left the page. Reissuing the same href and history mode then entered the suspended MPA path without scheduling another location change. Expose a scheduler reset for the browser lifecycle boundary and call it on persisted pageshow events. Cover the scheduler contract so the same external navigation can run again after reset. * fix(app-router): isolate redirect bridge from passive boundaries Unhandled client redirect recovery currently lives inside every RedirectBoundary, while Pages Router params fallback can keep stale App Router params after an App-to-Pages transition. That makes passive boundaries own browser runtime wiring and lets stale app params win over live Pages Router params. Move the unhandled redirect bridge into BrowserRoot under AppRouterContext, keep RedirectBoundary passive, and prefer live Pages Router params when that compat context exists. Add an App-to-Pages navigation regression fixture. * fix: extract shared decodeRedirectError helper, rename stale test - Add decodeRedirectError() to shims/navigation.ts as the single source of truth for parsing redirect error digests - Replace three private helpers in error-boundary.tsx with shared decodeRedirectError() call - Replace inline digest parsing in AppRouterRedirectBridge with shared decodeRedirectError() call (fixes unsafe decodeURIComponent) - Rename test that claimed to test redirect() but actually tests <Link> navigation * refactor: eliminate unnecessary type assertions - isRedirectError: use in-narrowing instead of as-casts - AppRouterRedirectBridge: remove as after guard already narrows - RedirectErrorBoundary: inline digest access, use in for handled check * ci: retrigger checks * fix: emit noindex for Forbidden/Unauthorized boundaries, extract retryScrollTo helper * docs: clarify decodeRedirectError comment about defensive join
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 : )