feat(runtime): support dynamic fragment routes#353
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d8a3d61f06
ℹ️ 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".
| if status == 0 { | ||
| status = http.StatusSeeOther | ||
| } | ||
| return response.Response{Kind: response.Redirect, Status: status, URL: redirect.URL}, true |
There was a problem hiding this comment.
Revalidate RedirectError before emitting redirects
When a guard returns or wraps a manually constructed guard.RedirectError (its fields are exported), this path bypasses Redirect's local-URL and 3xx status checks and writes whatever URL/Status it contains. A guard that copies a next query parameter into RedirectError{URL: next, Status: 302} can therefore produce an external Location even though the helper promises safe local redirects; re-run the URL/status validation here or make the error opaque.
Useful? React with 👍 / 👎.
| // Same-method endpoints share one generated request-time | ||
| // namespace with pages. Any dynamic overlap can shadow the | ||
| // concrete handler that should own a request path. |
There was a problem hiding this comment.
Include contract routes in overlap validation
This new dynamic-overlap check still only runs over pages and Go endpoints, because ValidateProgram calls validateAmbiguousDynamicPageRoutes(ir.Pages, ir.GoEndpoints) and never passes ir.ContractRefs. As a result a query contract such as GET /patients/42 can validate next to a dynamic fragment GET /patients/{id}; at runtime the exact query registration is found first and document requests do not fall through to the fragment pattern, making /patients/42's fragment route unreachable. Include contract refs in this overlap pass or otherwise reject/fall through these same-method overlaps.
Useful? React with 👍 / 👎.
d8a3d61 to
533e99a
Compare
533e99a to
16bdd39
Compare
16bdd39 to
38ef7b3
Compare
Summary
Issue Closure
Closes #7
Closes #9
Closes #10
Closes #25
Closes #63
Closes #177
Related: #102
Related: #337
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. Not applicable; no editor files changed.Commands run:
LLM Assistance
.gwdksource syntax.