Skip to content

Replace server fields with typed dev state#94591

Draft
timneutkens wants to merge 1 commit into
codex/refine-fs-output-typesfrom
codex/typed-dev-server-state
Draft

Replace server fields with typed dev state#94591
timneutkens wants to merge 1 commit into
codex/refine-fs-output-typesfrom
codex/typed-dev-server-state

Conversation

@timneutkens

@timneutkens timneutkens commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What?

Replace the generic serverFields bag with typed development server state and explicit render-server commands.

Why?

The string-keyed mutation API mixed serializable state, commands, router-local values, and startup dependencies. This made the render-server boundary difficult to reason about and allowed stale or unrelated fields to accumulate.

How?

Add DevServerState and typed incremental updates, construct middleware matchers inside the render server, pass the router handler as an explicit server option, keep root not-found state in the dev bundler, and replace env propagation with reloadEnv().

Verification

  • pnpm --filter=next types
  • pnpm test-dev-turbo test/development/middleware-dev-update/middleware-dev-update.test.ts
  • pnpm test-dev-webpack test/development/middleware-dev-update/middleware-dev-update.test.ts
  • pnpm test-dev-turbo test/e2e/env-config/env-config.test.ts -t "with hot reload"
  • pnpm test-dev-webpack test/e2e/env-config/env-config.test.ts -t "with hot reload"
  • pnpm test-dev-turbo test/development/app-dir/hmr-intercept-routes/hmr-intercept-routes.test.ts
  • pnpm test-dev-turbo test/e2e/app-dir/not-found/basic/index.test.ts -t "should use the not-found page for non-matching routes|should render the 404 page when the file is removed"
  • pnpm test-dev-turbo test/e2e/instrumentation-hook/instrumentation-hook.test.ts -t "with-node-page should run the instrumentation hook"
  • pnpm test-dev-turbo test/e2e/next-image-new/app-dir/app-dir.test.ts -t "should load the images"

@timneutkens timneutkens changed the title codex/typed dev server state Replace server fields with typed dev state Jun 9, 2026
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Failing test suites

Commit: 7eea785 | About building and testing Next.js

pnpm test-dev-turbo test/e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts (turbopack) (job)

  • instant-navigation-testing-api > renders runtime-prefetched content instantly during navigation (DD)
  • instant-navigation-testing-api > runtime params are excluded from instant shell > does not include cookie values in instant shell during page load (DD)
Expand output

● instant-navigation-testing-api › renders runtime-prefetched content instantly during navigation

locator.waitFor: Timeout 60000ms exceeded.
Call log:
  - waiting for locator('[data-testid="search-param-value"]') to be visible

  105 |         '[data-testid="search-param-value"]'
  106 |       )
> 107 |       await searchParamValue.waitFor({ state: 'visible' })
      |                              ^
  108 |       expect(await searchParamValue.textContent()).toContain(
  109 |         'myParam: testValue'
  110 |       )

  at waitFor (e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts:107:30)
  at instant (../packages/next-playwright/dist/index.js:50:16)
  at Object.<anonymous> (e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts:99:5)

● instant-navigation-testing-api › runtime params are excluded from instant shell › does not include cookie values in instant shell during page load

expect(received).toContain(expected) // indexOf

Expected substring: "testCookie: hello"
Received string:    "testCookie: not set"

  411 |       const cookieValue = page.locator('[data-testid="cookie-value"]')
  412 |       await cookieValue.waitFor({ state: 'visible', timeout: 10000 })
> 413 |       expect(await cookieValue.textContent()).toContain('testCookie: hello')
      |                                               ^
  414 |     })
  415 |
  416 |     it('does not include dynamic param values in instant shell during page load', async () => {

  at Object.toContain (e2e/app-dir/instant-navigation-testing-api/instant-navigation-testing-api.test.ts:413:47)

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Stats cancelled

Commit: 7eea785
View workflow run

@timneutkens timneutkens force-pushed the codex/typed-dev-server-state branch from 16001ef to 165caad Compare June 9, 2026 11:21
@timneutkens timneutkens force-pushed the codex/refine-fs-output-types branch from b5c6320 to a83f2fe Compare June 9, 2026 16:36
@timneutkens timneutkens force-pushed the codex/typed-dev-server-state branch from 165caad to 7eea785 Compare June 9, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant