Skip to content

fix(void): exclude api routes based on env - #297

Merged
Brooooooklyn merged 7 commits into
mainfrom
fix(void)--routing-strips-dev-and-prod
Aug 29, 2026
Merged

Brooooooklyn merged 7 commits into
mainfrom
fix(void)--routing-strips-dev-and-prod

Conversation

@mdong1909

@mdong1909 mdong1909 commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

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!

@mdong1909 mdong1909 changed the title fix: exclude api routes based on env fix(void): exclude api routes based on env Aug 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/void/src/plugin-routing.ts
Comment thread packages/void/src/router/scan.ts Outdated
Comment thread packages/void/src/index.ts
Brooooooklyn and others added 2 commits August 29, 2026 13:52
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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-29T15:04:09.742229Z e840dd8 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread packages/void/src/router/scan.ts
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
@Brooooooklyn
Brooooooklyn merged commit 9309c1e into main Aug 29, 2026
8 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix(void)--routing-strips-dev-and-prod branch August 29, 2026 15:09
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.

2 participants