Validate Bun.serve() app.bundlerOptions is an object#30487
Closed
robobun wants to merge 2 commits into
Closed
Conversation
Previously passing a non-object value for app.bundlerOptions (or its server/client/ssr/minify sub-options) to Bun.serve() would hit a debug assertion in JSValue.get() and crash. Now it throws ERR_INVALID_ARG_TYPE.
Collaborator
Author
Contributor
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/js/bun/http/bun-serve-app-invalid-args.test.ts`:
- Around line 19-24: Add a regression test that verifies Bun.serve accepts
boolean false for bundlerOptions.*.minify and does not throw: create a new test
case alongside the existing "Bun.serve() app.bundlerOptions.*.minify must be a
boolean or object" that calls Bun.serve({ app: { bundlerOptions: { server: {
minify: false } } } }) and asserts it does not throw or returns a valid server
handle; ensure the test uses the same test harness (e.g., test(...)) and cleans
up/ closes any server handle if one is returned so it doesn’t leak resources.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: b87fe978-e315-4974-a60f-8c751e82e95d
📒 Files selected for processing (2)
src/bake/bake.zigtest/js/bun/http/bun-serve-app-invalid-args.test.ts
Contributor
|
This PR may be a duplicate of:
🤖 Generated with Claude Code |
Collaborator
Author
|
Duplicate of #30125. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Passing a non-object value for
app.bundlerOptions(or itsserver/client/ssrsub-options, or a non-boolean non-objectminify) toBun.serve()would hit a debug assertion inJSValue.get()and crash.Now throws
ERR_INVALID_ARG_TYPEinstead.Also fixes
minify: falsewhich previously fell through the boolean check and tried to read.whitespaceoff a boolean primitive.Found by Fuzzilli (fingerprint
4160b7d95e4e6895).