Skip to content

fix(nextcompile): parse real Next 14/15 server-action manifest shape - #40

Merged
aynaash merged 1 commit into
mainfrom
fix/action-manifest-shape
Jul 3, 2026
Merged

fix(nextcompile): parse real Next 14/15 server-action manifest shape#40
aynaash merged 1 commit into
mainfrom
fix/action-manifest-shape

Conversation

@aynaash

@aynaash aynaash commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Captured the real server-reference-manifest.json from actual Next 14.2 and
15.1 builds (into shared/nextcompile/testdata/fixtures) and fixed the parser to
match:

  • The workers map keys on the module path (app/page); its value is the
    webpack moduleId — a bare string in Next 14 ("9459") and a
    {moduleId, async} object in Next 15. The old map[string]string modeling
    failed json.Unmarshal on every Next 15 build.
  • Now decodes the value as json.RawMessage and extracts the moduleId from both
    shapes, keeping Module = the module path (what the action loader keys on).

Also documents (in actions.go) a larger, evidence-backed finding: the compiled
module does not expose the action as a named export — .next/server/app/page.js
exports Next's own decodeReply/decodeAction/serverHooks machinery, so the
runtime's mod[entry.export] model cannot invoke a real server action. Correct
execution needs Next's action runtime and is tracked as a milestone.

Fixture-driven tests parse both real manifests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ru3K1fyNRnyTXQ95Gmv6Su

Verified the actual server-reference-manifest.json against real Next 14.2 and
15.1 builds (captured into testdata/fixtures): the `workers` map keys on the
MODULE PATH ("app/page") and its value is the webpack moduleId — a bare string
in Next 14 ("9459") and a {moduleId, async} object in Next 15. The previous
map[string]string modeling aborted json.Unmarshal on every Next 15 build.

Decode the value as json.RawMessage and extract the moduleId from both shapes,
keeping Module as the module path (what the action loader keys on).

Also documents a larger finding: the compiled module does NOT expose the action
as a named export (it exports Next's decodeReply/decodeAction/serverHooks
machinery), so actions.mjs's `mod[entry.export]` model cannot invoke a real
action. Correct execution needs Next's action runtime — tracked as a milestone.

Adds fixture-driven tests over both real manifests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru3K1fyNRnyTXQ95Gmv6Su
@aynaash
aynaash merged commit 74013c5 into main Jul 3, 2026
14 checks passed
@aynaash
aynaash deleted the fix/action-manifest-shape branch July 3, 2026 16:48
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