Files
Pranay Prakash 9a2770ab34 test: regression coverage for hook.resume() from isolated route bundles (o2flow beta.26 incident) (#3001)
* test: regression coverage for hook.resume() from isolated route bundles (o2flow beta.26 incident)

Reproduces the o2flow v5 upgrade failure (workflow@5.0.0-beta.26, fixed by
#2752 in beta.28): a plain API route importing defineHook() from the root
`workflow` entry and calling .resume() failed with Turbopack's
"Cannot find module as expression is too dynamic" stub, because the world
registration was tree-shaken out of the route bundle and getWorldLazy()'s
dynamic-import fallback got stubbed.

The bug only manifests when a route bundle loads in isolation (a Vercel
lambda): local `next dev`/`next start` evaluates next.config.ts, whose
workflow/next import chain registers the world process-wide and masks it —
which is why no existing server-driven suite caught it.

- route-bundle-isolation.test.ts: production Turbopack build of the
  nextjs-turbopack workbench, then loads ONLY the compiled route bundle in a
  bare Node subprocess (cold-lambda simulation) and invokes its POST handler.
  Fails with the exact incident error on regressed code; passes on main.
  Wired into the build-error-messages CI job.
- e2e: plainModuleDoneHook round-trip through a plain API route on the two
  Next workbenches (deployed matrix covers real lambda isolation).
- Workbench fixtures mirroring o2flow: a directive-less defineHook module
  shared by a workflow (create) and a plain route (resume). The webpack
  workbench gets a real route file because `next dev` (webpack) does not
  serve directory-symlinked app routes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>

* test: authenticate plain hook resume request

* test: address review — marker-based harness output parsing, changeset summary

- route-bundle-isolation: prefix the harness result line with a unique
  marker and locate it explicitly instead of JSON.parse()ing the last
  stdout line, so stray logging from the route bundle or the world can't
  break parsing; failures now include the full subprocess stdout.
- changeset: add a human-readable summary to the (release-less) changeset.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>

---------

Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Karthik Kalyanaraman <karthik.kalyanaraman@vercel.com>
Co-authored-by: Karthik Kalyan <105607645+karthikscale3@users.noreply.github.com>
2026-07-21 13:24:17 +07:00
..
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00
2025-11-08 18:25:49 -08:00
2025-10-23 12:07:52 +03:00
2025-10-23 12:07:52 +03:00

Clone of ../nextjs-turbopack

This directory is mostly a clone of the turbopack workbench with nearly everything symlinked to the directory.

The package.json is notably different - it uses --webpack for dev and build modes.

Most files/directories are symlinked to ../nextjs-turbopack:

  • app/ - All files inside are symlinked (not the directory itself)
  • workflows/ - Symlinked directory
  • util/ - Symlinked directory
  • public/ - Symlinked directory
  • instrumentation.ts - Symlinked file
  • postcss.config.mjs - Symlinked file
  • tsconfig.json - Symlinked file
  • turbo.json - Symlinked file

A few specific files are NOT symlinked:

  • app/favicon.ico - Real file (symlink doesn't work with Next.js)
  • app/.well-known/ - Generated directory by workflow
  • .gitignore - Real file
  • next.config.ts - Different configuration (webpack-specific)
  • package.json - Different configuration (--webpack flag)

Next.js dev mode doesn't work well with symlinks. In CI, the resolve-symlinks.sh script automatically runs before starting the dev server to replace all symlinks with actual file copies. The script:

  • Only runs when CI environment variable is set
  • Resolves all symlinks in the directory (excluding gitignored files like node_modules)
  • Preserves the directory structure while replacing symlinks with real files