Repository navigation
fix(void): exclude api routes based on env - #297
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34c3fa46f5
ℹ️ 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".
…rips-dev-and-prod
Follow-up polish on the .dev / .prod route suffix enforcement. Tests: - isRouteEnabledForEnvironment truth table (9 cases) - scanRoutePatternsSync and scanWebSocketRoutesSync environment filtering - the asset routing policy differing between serve, build, and preview for a project whose only API route is dev-only - the --backend cloudflare WebSocket gate not firing on a dev-only room The last two fail when the environment argument they cover is removed. Comments: - the guard around resolveConfiguredAssetRoutingPolicy is load-bearing, not an optimization. envPlugin is also returned by the framework and node-target branches, both of which return before ssrEntry / hasPages / hasMiddleware are declared, so an unguarded call throws a TDZ ReferenceError. - websocketRoutes is scanned with no environment on purpose. It reserves binding and Durable Object class names, and reservation must not vary by command. - the construction-time policy is provisional and always recomputed in config. Docs: - define what dev and prod mean, including vite preview - document the WebSocket suffix and that it goes before .ws - note that void prepare boots no Vite and so generates types for both environments Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ZqvzB6uRHQyMZzfF2qjfp
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d66b92bdb6
ℹ️ 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".
The docs claimed a dev-only route is absent from the production Cloudflare config. That is only true of the generated route and WebSocket config. Binding inference globs source files without parsing route filenames, so a `void/storage` import inside a `.dev.ts` route still emits an R2 binding and still provisions the bucket. Document that, point at `inference.bindings` as the way to opt out, and pin the boundary with a test in plugin-inference.test.ts. Leaving inference environment-blind is deliberate. Over-emitting only costs a resource; under-emitting drops a binding the running worker needs and can rename a Durable Object class, orphaning its state. The environment is also not knowable where inference runs — index.ts calls it during plugin construction, before the config hook assigns routeEnvironment. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ZqvzB6uRHQyMZzfF2qjfp
Server routing: .dev & .prod suffix exclusion was never implemented.
Originally thought this was would be a pretty simple/isolated fix. Didn't realize server routing & websockets shared the same code. Been studying up on this code base.
Please scrutinize these code changes deeply. Especially if I'm doing something even remotely wrong!