feat(compiler): remove action render mode#680
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01d880da16
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| render, err := parseRenderConfig(field.Value) | ||
| if err != nil { | ||
| return gowdk.Config{}, false, false, err | ||
| } | ||
| config.Render = render |
There was a problem hiding this comment.
Validate executable render defaults too
This new rejection only runs for the AST-only config path; when Render.Default contains an expression such as Default: gowdk.RenderMode("action") or a variable initialized to that value, needsConfigExpressionEvaluation switches to loadExecutableConfig, and validateLoadedConfig never revalidates config.Render.Default. Those configs still load with the removed "action" mode and then fail later or produce inconsistent route metadata, despite this change intending removed render modes to fail during config loading.
Useful? React with 👍 / 👎.
| return renderModeByName(typed.Name) | ||
| default: | ||
| return "" | ||
| return "", fmt.Errorf("unsupported render mode expression") |
There was a problem hiding this comment.
Preserve explicit zero render defaults
A literal config that explicitly leaves the render default at its zero value, e.g. Render: gowdk.RenderConfig{Default: ""}, now falls through to this new unsupported-expression error because parseString returns an empty string for both an empty literal and non-string expressions. The zero value is still the documented/default SPA behavior via RenderConfig.DefaultMode(), so this rejects an otherwise equivalent config during loading; allow an empty string literal before treating the expression as unsupported.
Useful? React with 👍 / 👎.
Summary
gowdk.Actionfrom the public render-mode enum and reject"action"/gowdk.Actionin config render defaultsgowdk.SPAIssue Closure
Closes #676
Migration / Compatibility
This is intentionally breaking: configs that used
Render.Default: gowdk.ActionorRender.Default: "action"now fail config loading. Usegowdk.SPAor omit the default render mode.actdeclarations,g:post, generated action adapters, CSRF, partial responses, and action endpoint metadata remain supported.Verification
scripts/test-go-modules.shwhen Go code or compiler behavior changed.go build ./cmd/gowdkwhen CLI, compiler, runtime, addon, or release behavior changed.node --check editors/vscode/extension.jswhen editor files changed.request-time handlers, logs, diagnostics, embedded assets, editor commands,
WASM, contracts, and realtime behavior.
Commands run:
go test ./internal/project ./internal/publicapi ./internal/gwdkir ./internal/compiler ./internal/buildgen ./internal/langgo build ./cmd/gowdkgo test ./cmd/gowdknode --check editors/vscode/extension-core.js && node --check editors/vscode/extension.jsnode --test editors/vscode/*.test.jsgo run ./cmd/gowdk check --ssr examples/pages/home.page.gwdk examples/actions/signup.page.gwdkgo run ./cmd/gowdk manifest --ssr examples/pages/home.page.gwdk examples/actions/signup.page.gwdk >/tmp/gowdk-action-render-manifest.jsongo test ./...scripts/test-go-modules.shLLM Assistance
Action#676, confirmed actions should remain as endpoint capability, implemented the breaking removal of theActionrender mode in an isolated worktree, updated tests/docs/editor metadata, and opened this draft PR.actionas a render mode is acceptable for this change; action endpoint behavior remains in scope and should not be removed.