Repository navigation
chore: Unify eqlCaseInsensitiveASCIIPlaceholders of the world - #25286
markovejnovic wants to merge 2 commits into
Conversation
WalkthroughConsolidates case-insensitive ASCII comparison logic by adding a single Changes
Possibly related PRs
Suggested reviewers
Pre-merge checks✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (5)
🧰 Additional context used📓 Path-based instructions (5)src/**/*.{cpp,zig}📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
Files:
src/**/*.zig📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
Files:
**/*.zig📄 CodeRabbit inference engine (.cursor/rules/zig-javascriptcore-classes.mdc)
Files:
src/**/*.{ts,zig,cpp}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
src/**/*.{ts,zig}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (21)📓 Common learnings📚 Learning: 2025-10-16T02:17:35.237ZApplied to files:
📚 Learning: 2025-11-11T22:55:08.547ZApplied to files:
📚 Learning: 2025-10-17T20:50:58.644ZApplied to files:
📚 Learning: 2025-09-12T18:16:50.754ZApplied to files:
📚 Learning: 2025-10-16T21:24:52.779ZApplied to files:
📚 Learning: 2025-10-18T20:50:47.750ZApplied to files:
📚 Learning: 2025-10-15T22:03:50.832ZApplied to files:
📚 Learning: 2025-10-16T17:32:03.074ZApplied to files:
📚 Learning: 2025-11-12T07:15:00.763ZApplied to files:
📚 Learning: 2025-09-02T19:17:26.376ZApplied to files:
📚 Learning: 2025-11-24T18:36:08.558ZApplied to files:
📚 Learning: 2025-09-06T03:37:41.154ZApplied to files:
📚 Learning: 2025-10-24T10:43:09.398ZApplied to files:
📚 Learning: 2025-11-12T04:11:52.293ZApplied to files:
📚 Learning: 2025-10-18T01:49:31.037ZApplied to files:
📚 Learning: 2025-11-24T18:36:59.706ZApplied to files:
📚 Learning: 2025-09-02T18:25:27.976ZApplied to files:
📚 Learning: 2025-09-04T02:04:43.094ZApplied to files:
📚 Learning: 2025-09-02T17:09:17.391ZApplied to files:
📚 Learning: 2025-11-24T18:37:44.864ZApplied to files:
🔇 Additional comments (10)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/css/values/length.zig (1)
446-452: Bug:tryOpandtryOpToignoreotherand callthis.toPx()twiceBoth
tryOpandtryOpTocomputebfromthis.toPx()instead ofother.toPx(), so mixed-unit operations fallback paths never actually see the right-hand operand.Consider fixing as:
- const a = this.toPx(); - const b = this.toPx(); + const a = this.toPx(); + const b = other.toPx();and similarly in
tryOpTo:- const a = this.toPx(); - const b = this.toPx(); + const a = this.toPx(); + const b = other.toPx();so the second operand is correctly incorporated in the px-based operations.
Also applies to: 472-476
src/css/values/angle.zig (1)
261-283: Bug inAngle.opTo:other_tagusesthis.*instead ofother.*
Angle.opTocurrently does:const self_tag: u8 = @intFromEnum(this.*); const other_tag: u8 = @intFromEnum(this.*); // uses this.* twice ... const switch_val: u8 = self_tag | other_tag;This means
switch_valis always derived solely fromthis’s tag. For mixed-unit inputs (e.g..degvs.rad), the function will incorrectly enter one of the “same-unit” arms (DEG | DEG, etc.) instead of falling back to theelsecase that converts both sides to degrees, and will read the wrong union field fromother.Fixing
other_tagto useother.*restores the intended behavior:- const self_tag: u8 = @intFromEnum(this.*); - const other_tag: u8 = @intFromEnum(this.*); + const self_tag: u8 = @intFromEnum(this.*); + const other_tag: u8 = @intFromEnum(other.*); ... - const switch_val: u8 = self_tag | other_tag; + const switch_val: u8 = self_tag | other_tag;(Only the
other_tagassignment needs to change; the rest of the logic then correctly routes mixed units to the genericelsebranch.)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📥 Commits
Reviewing files that changed from the base of the PR and between 6745bda and 006261237a4550324b39562bfa39dae5e7ed507e.
📒 Files selected for processing (48)
src/bun.js/api/crypto/EVP.zig(1 hunks)src/bun.js/node/path.zig(1 hunks)src/bun.js/uuid.zig(1 hunks)src/bun.zig(4 hunks)src/cli/create_command.zig(1 hunks)src/cli/pack_command.zig(1 hunks)src/cli/publish_command.zig(1 hunks)src/css/css_parser.zig(11 hunks)src/css/media_query.zig(2 hunks)src/css/properties/animation.zig(2 hunks)src/css/properties/background.zig(2 hunks)src/css/properties/css_modules.zig(1 hunks)src/css/properties/custom.zig(4 hunks)src/css/properties/font.zig(1 hunks)src/css/properties/generate_properties.ts(2 hunks)src/css/properties/grid.zig(2 hunks)src/css/properties/transform.zig(10 hunks)src/css/rules/container.zig(1 hunks)src/css/rules/font_face.zig(2 hunks)src/css/rules/font_palette_values.zig(2 hunks)src/css/rules/keyframes.zig(2 hunks)src/css/rules/property.zig(1 hunks)src/css/rules/supports.zig(2 hunks)src/css/selectors/parser.zig(9 hunks)src/css/targets.zig(1 hunks)src/css/values/angle.zig(2 hunks)src/css/values/color.zig(3 hunks)src/css/values/easing.zig(2 hunks)src/css/values/gradient.zig(3 hunks)src/css/values/ident.zig(1 hunks)src/css/values/image.zig(1 hunks)src/css/values/length.zig(2 hunks)src/css/values/resolution.zig(2 hunks)src/css/values/syntax.zig(1 hunks)src/css/values/time.zig(2 hunks)src/deps/picohttp.zig(3 hunks)src/http.zig(3 hunks)src/http/Headers.zig(2 hunks)src/http/websocket_client/WebSocketUpgradeClient.zig(6 hunks)src/install/repository.zig(4 hunks)src/options.zig(1 hunks)src/output.zig(1 hunks)src/resolver/resolve_path.zig(4 hunks)src/sql/postgres/DataCell.zig(3 hunks)src/string.zig(2 hunks)src/string/immutable.zig(3 hunks)src/url.zig(3 hunks)src/which.zig(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
src/**/*.{cpp,zig}
📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
src/**/*.{cpp,zig}: Usebun bdorbun run build:debugto build debug versions for C++ and Zig source files; creates debug build at./build/debug/bun-debug
Run tests usingbun bd test <test-file>with the debug build; never usebun testdirectly as it will not include your changes
Execute files usingbun bd <file> <...args>; never usebun <file>directly as it will not include your changes
Enable debug logs for specific scopes usingBUN_DEBUG_$(SCOPE)=1environment variable
Code generation happens automatically as part of the build process; no manual code generation commands are required
Files:
src/which.zigsrc/css/rules/container.zigsrc/css/rules/font_palette_values.zigsrc/css/values/image.zigsrc/css/values/time.zigsrc/output.zigsrc/css/values/length.zigsrc/css/properties/css_modules.zigsrc/resolver/resolve_path.zigsrc/http/Headers.zigsrc/url.zigsrc/css/properties/transform.zigsrc/css/media_query.zigsrc/css/properties/grid.zigsrc/bun.js/api/crypto/EVP.zigsrc/css/values/syntax.zigsrc/css/properties/custom.zigsrc/css/values/angle.zigsrc/css/values/easing.zigsrc/cli/pack_command.zigsrc/bun.js/uuid.zigsrc/string.zigsrc/http.zigsrc/css/values/ident.zigsrc/bun.js/node/path.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/properties/font.zigsrc/css/rules/supports.zigsrc/css/targets.zigsrc/cli/publish_command.zigsrc/bun.zigsrc/install/repository.zigsrc/css/rules/keyframes.zigsrc/sql/postgres/DataCell.zigsrc/css/rules/property.zigsrc/css/css_parser.zigsrc/options.zigsrc/css/values/color.zigsrc/css/values/resolution.zigsrc/css/properties/background.zigsrc/css/rules/font_face.zigsrc/cli/create_command.zigsrc/css/values/gradient.zigsrc/css/selectors/parser.zigsrc/deps/picohttp.zigsrc/css/properties/animation.zigsrc/string/immutable.zig
src/**/*.zig
📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
Use
bun.Output.scoped(.${SCOPE}, .hidden)for creating debug logs in Zig codeImplement core functionality in Zig, typically in its own directory in
src/
src/**/*.zig: Zig source code should be organized insrc/*.zigfor core runtime, JavaScript bindings, and package manager
In Zig code, be careful with allocators and use defer for cleanup to manage memory properly
UseBUN_DEBUG_QUIET_LOGS=1to disable debug logging, orBUN_DEBUG_<scopeName>=1to enable specific Output.scoped calls in debug builds
Runbun run zig:check-allto compile the Zig code on all platforms when making platform-specific changes
src/**/*.zig: Private fields in Zig are fully supported using the#prefix:struct { #foo: u32 };
Use decl literals in Zig for declaration initialization:const decl: Decl = .{ .binding = 0, .value = 0 };
Prefer@importat the bottom of the file (auto formatter will move them automatically)
Files:
src/which.zigsrc/css/rules/container.zigsrc/css/rules/font_palette_values.zigsrc/css/values/image.zigsrc/css/values/time.zigsrc/output.zigsrc/css/values/length.zigsrc/css/properties/css_modules.zigsrc/resolver/resolve_path.zigsrc/http/Headers.zigsrc/url.zigsrc/css/properties/transform.zigsrc/css/media_query.zigsrc/css/properties/grid.zigsrc/bun.js/api/crypto/EVP.zigsrc/css/values/syntax.zigsrc/css/properties/custom.zigsrc/css/values/angle.zigsrc/css/values/easing.zigsrc/cli/pack_command.zigsrc/bun.js/uuid.zigsrc/string.zigsrc/http.zigsrc/css/values/ident.zigsrc/bun.js/node/path.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/properties/font.zigsrc/css/rules/supports.zigsrc/css/targets.zigsrc/cli/publish_command.zigsrc/bun.zigsrc/install/repository.zigsrc/css/rules/keyframes.zigsrc/sql/postgres/DataCell.zigsrc/css/rules/property.zigsrc/css/css_parser.zigsrc/options.zigsrc/css/values/color.zigsrc/css/values/resolution.zigsrc/css/properties/background.zigsrc/css/rules/font_face.zigsrc/cli/create_command.zigsrc/css/values/gradient.zigsrc/css/selectors/parser.zigsrc/deps/picohttp.zigsrc/css/properties/animation.zigsrc/string/immutable.zig
**/*.zig
📄 CodeRabbit inference engine (.cursor/rules/zig-javascriptcore-classes.mdc)
**/*.zig: Expose generated bindings in Zig structs usingpub const js = JSC.Codegen.JS<ClassName>with trait conversion methods:toJS,fromJS, andfromJSDirect
Use consistent parameter nameglobalObjectinstead ofctxin Zig constructor and method implementations
Usebun.JSError!JSValuereturn type for Zig methods and constructors to enable proper error handling and exception propagation
Implement resource cleanup usingdeinit()method that releases resources, followed byfinalize()called by the GC that invokesdeinit()and frees the pointer
UseJSC.markBinding(@src())in finalize methods for debugging purposes before callingdeinit()
For methods returning cached properties in Zig, declare external C++ functions usingextern fnandcallconv(JSC.conv)calling convention
Implement getter functions with naming patternget<PropertyName>in Zig that acceptthisandglobalObjectparameters and returnJSC.JSValue
Access JavaScript CallFrame arguments usingcallFrame.argument(i), check argument count withcallFrame.argumentCount(), and getthiswithcallFrame.thisValue()
For reference-counted objects, use.deref()in finalize instead ofdestroy()to release references to other JS objects
Files:
src/which.zigsrc/css/rules/container.zigsrc/css/rules/font_palette_values.zigsrc/css/values/image.zigsrc/css/values/time.zigsrc/output.zigsrc/css/values/length.zigsrc/css/properties/css_modules.zigsrc/resolver/resolve_path.zigsrc/http/Headers.zigsrc/url.zigsrc/css/properties/transform.zigsrc/css/media_query.zigsrc/css/properties/grid.zigsrc/bun.js/api/crypto/EVP.zigsrc/css/values/syntax.zigsrc/css/properties/custom.zigsrc/css/values/angle.zigsrc/css/values/easing.zigsrc/cli/pack_command.zigsrc/bun.js/uuid.zigsrc/string.zigsrc/http.zigsrc/css/values/ident.zigsrc/bun.js/node/path.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/properties/font.zigsrc/css/rules/supports.zigsrc/css/targets.zigsrc/cli/publish_command.zigsrc/bun.zigsrc/install/repository.zigsrc/css/rules/keyframes.zigsrc/sql/postgres/DataCell.zigsrc/css/rules/property.zigsrc/css/css_parser.zigsrc/options.zigsrc/css/values/color.zigsrc/css/values/resolution.zigsrc/css/properties/background.zigsrc/css/rules/font_face.zigsrc/cli/create_command.zigsrc/css/values/gradient.zigsrc/css/selectors/parser.zigsrc/deps/picohttp.zigsrc/css/properties/animation.zigsrc/string/immutable.zig
src/**/*.{ts,zig,cpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Always use absolute paths in file operations
Files:
src/which.zigsrc/css/rules/container.zigsrc/css/rules/font_palette_values.zigsrc/css/values/image.zigsrc/css/values/time.zigsrc/output.zigsrc/css/values/length.zigsrc/css/properties/css_modules.zigsrc/resolver/resolve_path.zigsrc/http/Headers.zigsrc/url.zigsrc/css/properties/transform.zigsrc/css/media_query.zigsrc/css/properties/grid.zigsrc/bun.js/api/crypto/EVP.zigsrc/css/values/syntax.zigsrc/css/properties/custom.zigsrc/css/values/angle.zigsrc/css/values/easing.zigsrc/cli/pack_command.zigsrc/bun.js/uuid.zigsrc/string.zigsrc/http.zigsrc/css/values/ident.zigsrc/bun.js/node/path.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/properties/font.zigsrc/css/rules/supports.zigsrc/css/targets.zigsrc/cli/publish_command.zigsrc/css/properties/generate_properties.tssrc/bun.zigsrc/install/repository.zigsrc/css/rules/keyframes.zigsrc/sql/postgres/DataCell.zigsrc/css/rules/property.zigsrc/css/css_parser.zigsrc/options.zigsrc/css/values/color.zigsrc/css/values/resolution.zigsrc/css/properties/background.zigsrc/css/rules/font_face.zigsrc/cli/create_command.zigsrc/css/values/gradient.zigsrc/css/selectors/parser.zigsrc/deps/picohttp.zigsrc/css/properties/animation.zigsrc/string/immutable.zig
src/**/*.{ts,zig}
📄 CodeRabbit inference engine (CLAUDE.md)
Avoid shell commands in code - don't use
findorgrep; use Bun's Glob and built-in tools instead
Files:
src/which.zigsrc/css/rules/container.zigsrc/css/rules/font_palette_values.zigsrc/css/values/image.zigsrc/css/values/time.zigsrc/output.zigsrc/css/values/length.zigsrc/css/properties/css_modules.zigsrc/resolver/resolve_path.zigsrc/http/Headers.zigsrc/url.zigsrc/css/properties/transform.zigsrc/css/media_query.zigsrc/css/properties/grid.zigsrc/bun.js/api/crypto/EVP.zigsrc/css/values/syntax.zigsrc/css/properties/custom.zigsrc/css/values/angle.zigsrc/css/values/easing.zigsrc/cli/pack_command.zigsrc/bun.js/uuid.zigsrc/string.zigsrc/http.zigsrc/css/values/ident.zigsrc/bun.js/node/path.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/properties/font.zigsrc/css/rules/supports.zigsrc/css/targets.zigsrc/cli/publish_command.zigsrc/css/properties/generate_properties.tssrc/bun.zigsrc/install/repository.zigsrc/css/rules/keyframes.zigsrc/sql/postgres/DataCell.zigsrc/css/rules/property.zigsrc/css/css_parser.zigsrc/options.zigsrc/css/values/color.zigsrc/css/values/resolution.zigsrc/css/properties/background.zigsrc/css/rules/font_face.zigsrc/cli/create_command.zigsrc/css/values/gradient.zigsrc/css/selectors/parser.zigsrc/deps/picohttp.zigsrc/css/properties/animation.zigsrc/string/immutable.zig
🧠 Learnings (55)
📓 Common learnings
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 24423
File: test/js/node/path/browserify.test.js:472-475
Timestamp: 2025-11-07T17:28:58.045Z
Learning: markovejnovic prefers functional programming patterns (e.g., using reduce) over imperative loops and does not want style-based readability suggestions unless there's a concrete technical reason beyond personal preference.
<!--
📚 Learning: 2025-09-12T18:16:50.754Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 22606
File: src/glob/GlobWalker.zig:449-452
Timestamp: 2025-09-12T18:16:50.754Z
Learning: For Bun codebase: prefer using `std.fs.path.sep` over manual platform separator detection, and use `bun.strings.lastIndexOfChar` instead of `std.mem.lastIndexOfScalar` for string operations.
Applied to files:
src/which.zigsrc/resolver/resolve_path.zigsrc/bun.js/uuid.zigsrc/bun.js/node/path.zigsrc/bun.zigsrc/css/values/resolution.zigsrc/css/rules/font_face.zigsrc/css/selectors/parser.zig
📚 Learning: 2025-10-13T06:54:58.043Z
Learnt from: robobun
Repo: oven-sh/bun PR: 0
File: :0-0
Timestamp: 2025-10-13T06:54:58.043Z
Learning: File extensions in Bun's module resolution are case-sensitive by design, and there are no existing precedents in the codebase for case-insensitive HTML file detection.
Applied to files:
src/which.zig
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/**/*.zig : Run `bun run zig:check-all` to compile the Zig code on all platforms when making platform-specific changes
Applied to files:
src/which.zigsrc/bun.zig
📚 Learning: 2025-09-06T03:37:41.154Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 22229
File: src/bundler/LinkerGraph.zig:0-0
Timestamp: 2025-09-06T03:37:41.154Z
Learning: In Bun's codebase, when checking import record source indices in src/bundler/LinkerGraph.zig, prefer using `if (import_index >= self.import_records.len)` bounds checking over `isValid()` checks, as the bounds check is more robust and `isValid()` is a strict subset of this condition.
Applied to files:
src/which.zigsrc/css/values/length.zigsrc/css/properties/css_modules.zigsrc/css/properties/grid.zigsrc/css/properties/custom.zigsrc/css/values/ident.zigsrc/bun.js/node/path.zigsrc/css/targets.zigsrc/bun.zigsrc/css/css_parser.zigsrc/css/values/resolution.zig
📚 Learning: 2025-11-12T07:15:00.763Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 24631
File: src/install/resolution.zig:375-376
Timestamp: 2025-11-12T07:15:00.763Z
Learning: In src/install/resolution.zig, the eql() function intentionally returns false for unknown/unhandled tags in the else branch, even though order() returns .eq for matching unknown tags. This semantic difference is by design.
Applied to files:
src/css/rules/container.zigsrc/css/values/image.zigsrc/output.zigsrc/css/values/length.zigsrc/url.zigsrc/css/properties/transform.zigsrc/css/media_query.zigsrc/css/values/angle.zigsrc/css/values/easing.zigsrc/cli/pack_command.zigsrc/string.zigsrc/css/values/ident.zigsrc/bun.js/node/path.zigsrc/css/rules/supports.zigsrc/css/values/resolution.zigsrc/css/values/gradient.zigsrc/string/immutable.zig
📚 Learning: 2025-11-24T18:34:55.173Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/building-bun.mdc:0-0
Timestamp: 2025-11-24T18:34:55.173Z
Learning: Applies to src/**/*.zig : Use `bun.Output.scoped(.${SCOPE}, .hidden)` for creating debug logs in Zig code
Applied to files:
src/output.zig
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/**/*.zig : Use `BUN_DEBUG_QUIET_LOGS=1` to disable debug logging, or `BUN_DEBUG_<scopeName>=1` to enable specific Output.scoped calls in debug builds
Applied to files:
src/output.zig
📚 Learning: 2025-10-16T02:17:35.237Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23710
File: src/analytics.zig:15-21
Timestamp: 2025-10-16T02:17:35.237Z
Learning: In src/analytics.zig and similar files using bun.EnvVar boolean environment variables: the new EnvVar API for boolean flags (e.g., bun.EnvVar.do_not_track.get(), bun.EnvVar.ci.get()) is designed to parse and return boolean values from environment variables, not just check for their presence. This is an intentional design change from the previous presence-based checks using bun.getenvZ().
Applied to files:
src/output.zigsrc/http/Headers.zigsrc/url.zigsrc/css/media_query.zigsrc/bun.js/api/crypto/EVP.zigsrc/css/values/syntax.zigsrc/css/properties/custom.zigsrc/bun.js/uuid.zigsrc/css/values/ident.zigsrc/css/targets.zigsrc/cli/publish_command.zigsrc/bun.zigsrc/css/css_parser.zigsrc/css/values/color.zigsrc/css/values/resolution.zigsrc/css/rules/font_face.zigsrc/deps/picohttp.zig
📚 Learning: 2025-10-18T02:06:31.606Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 23796
File: src/bun.js/test/Execution.zig:624-625
Timestamp: 2025-10-18T02:06:31.606Z
Learning: In Zig files using bun.Output.scoped(), the visibility level `.visible` means logs are enabled by default in debug builds unless `BUN_DEBUG_QUIET_LOGS=1` is set; if that environment variable is set, the logs can be re-enabled with `BUN_DEBUG_<scope>=1`. Use `.visible` for logs that should appear by default in debug builds, and `.hidden` for logs that require explicit opt-in via `BUN_DEBUG_<scope>=1`.
Applied to files:
src/output.zig
📚 Learning: 2025-11-24T18:37:11.466Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/js/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:11.466Z
Learning: Applies to src/js/{builtins,node,bun,thirdparty,internal}/**/*.{ts,js} : Use `$debug()` for debug logging and `$assert()` for assertions; both are stripped in release builds
Applied to files:
src/output.zig
📚 Learning: 2025-11-24T18:36:08.558Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-11-24T18:36:08.558Z
Learning: Applies to **/*.zig : Use consistent parameter name `globalObject` instead of `ctx` in Zig constructor and method implementations
Applied to files:
src/output.zigsrc/url.zigsrc/css/properties/transform.zigsrc/css/values/syntax.zigsrc/css/values/angle.zigsrc/bun.zigsrc/css/rules/keyframes.zigsrc/css/css_parser.zigsrc/css/values/color.zigsrc/deps/picohttp.zig
📚 Learning: 2025-10-16T21:24:52.779Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23710
File: src/crash_handler.zig:1415-1423
Timestamp: 2025-10-16T21:24:52.779Z
Learning: When a boolean EnvVar in src/envvars.zig is defined with a default value (e.g., `.default = false`), the `get()` method returns `bool` instead of `?bool`. This means you cannot distinguish between "environment variable not set" and "environment variable explicitly set to the default value". For opt-out scenarios where detection of explicit setting is needed (like `BUN_ENABLE_CRASH_REPORTING` on platforms where crash reporting defaults to enabled), either: (1) don't provide a default value so `get()` returns `?bool`, or (2) use the returned boolean directly instead of only checking if it's true.
Applied to files:
src/output.zig
📚 Learning: 2025-11-24T18:34:55.173Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/building-bun.mdc:0-0
Timestamp: 2025-11-24T18:34:55.173Z
Learning: Applies to src/**/*.{cpp,zig} : Enable debug logs for specific scopes using `BUN_DEBUG_$(SCOPE)=1` environment variable
Applied to files:
src/output.zig
📚 Learning: 2025-11-24T18:36:08.558Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-11-24T18:36:08.558Z
Learning: Applies to **/*.zig : Use `JSC.markBinding(src())` in finalize methods for debugging purposes before calling `deinit()`
Applied to files:
src/output.zig
📚 Learning: 2025-10-18T20:50:47.750Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: src/bun.js/telemetry.zig:366-373
Timestamp: 2025-10-18T20:50:47.750Z
Learning: In Bun's Zig codebase (src/bun.js/bindings/JSValue.zig), the JSValue enum uses `.null` (not `.js_null`) for JavaScript's null value. Only `js_undefined` has the `js_` prefix to avoid collision with Zig's built-in `undefined` keyword. The correct enum fields are: `js_undefined`, `null`, `true`, `false`, and `zero`.
Applied to files:
src/css/values/length.zigsrc/css/values/syntax.zigsrc/bun.js/uuid.zigsrc/css/values/ident.zigsrc/bun.js/node/path.zigsrc/css/targets.zigsrc/css/values/color.zig
📚 Learning: 2025-10-01T21:59:54.571Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h:47-74
Timestamp: 2025-10-01T21:59:54.571Z
Learning: In the new bindings generator (bindgenv2) for `src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h`, the context-aware enumeration conversion overloads intentionally use stricter validation (requiring `value.isString()` without ToString coercion), diverging from Web IDL semantics. This is a design decision documented in comments.
Applied to files:
src/css/values/length.zigsrc/css/values/syntax.zigsrc/css/properties/custom.zigsrc/bun.js/uuid.zigsrc/css/values/ident.zigsrc/css/values/color.zig
📚 Learning: 2025-09-04T02:04:43.094Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 22278
File: src/ast/E.zig:980-1003
Timestamp: 2025-09-04T02:04:43.094Z
Learning: In Bun's Zig codebase, `as(i32, u8_or_u16_value)` is sufficient for casting u8/u16 to i32 in comparison operations. `intCast` is not required in this context, and the current casting approach compiles successfully.
Applied to files:
src/css/values/length.zigsrc/css/values/angle.zigsrc/string.zigsrc/bun.js/node/path.zigsrc/bun.zigsrc/css/css_parser.zigsrc/css/values/resolution.zig
📚 Learning: 2025-11-24T18:36:38.104Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:38.104Z
Learning: Applies to src/**/*.zig : Prefer `import` at the bottom of the file (auto formatter will move them automatically)
Applied to files:
src/css/properties/css_modules.zig
📚 Learning: 2025-09-02T18:25:27.976Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 22227
File: src/allocators/allocation_scope.zig:284-314
Timestamp: 2025-09-02T18:25:27.976Z
Learning: In bun's custom Zig implementation, the `#` prefix for private fields is valid syntax and should not be flagged as invalid. The syntax `#fieldname` creates private fields that cannot be accessed from outside the defining struct, and usage like `self.#fieldname` is correct within the same struct. This applies to fields like `#parent`, `#state`, `#allocator`, `#trace`, etc. throughout the codebase.
Applied to files:
src/css/properties/css_modules.zigsrc/css/values/syntax.zigsrc/css/properties/custom.zigsrc/css/values/ident.zigsrc/css/rules/keyframes.zigsrc/css/rules/property.zigsrc/css/css_parser.zigsrc/css/values/color.zig
📚 Learning: 2025-11-24T18:36:08.558Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-11-24T18:36:08.558Z
Learning: Applies to **/*.zig : Expose generated bindings in Zig structs using `pub const js = JSC.Codegen.JS<ClassName>` with trait conversion methods: `toJS`, `fromJS`, and `fromJSDirect`
Applied to files:
src/css/properties/css_modules.zigsrc/css/rules/keyframes.zig
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/**/*.{ts,zig,cpp} : Always use absolute paths in file operations
Applied to files:
src/resolver/resolve_path.zig
📚 Learning: 2025-10-08T13:56:00.875Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 23373
File: src/bun.js/api/BunObject.zig:2514-2521
Timestamp: 2025-10-08T13:56:00.875Z
Learning: For Bun codebase: prefer using `bun.path` utilities (e.g., `bun.path.joinAbsStringBuf`, `bun.path.join`) over `std.fs.path` functions for path operations.
Applied to files:
src/resolver/resolve_path.zigsrc/bun.js/node/path.zig
📚 Learning: 2025-10-15T22:03:50.832Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23710
File: src/envvars.zig:135-144
Timestamp: 2025-10-15T22:03:50.832Z
Learning: In src/envvars.zig, the boolean feature flag cache uses a single atomic enum and should remain monotonic. Only the string cache (which uses two atomics: ptr and len) requires acquire/release ordering to prevent torn reads.
Applied to files:
src/url.zig
📚 Learning: 2025-11-24T18:35:39.205Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/registering-bun-modules.mdc:0-0
Timestamp: 2025-11-24T18:35:39.205Z
Learning: Applies to src/**/*.zig : Implement core functionality in Zig, typically in its own directory in `src/`
Applied to files:
src/url.zig
📚 Learning: 2025-09-02T17:09:17.391Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 22227
File: src/allocators.zig:778-782
Timestamp: 2025-09-02T17:09:17.391Z
Learning: In Zig's bun codebase, the `isDefault` function in `src/allocators.zig` only needs to compare `allocator.vtable == c_allocator.vtable` rather than also checking the `ptr` field, because: (1) the codebase never creates multiple allocators that use `c_allocator.vtable` but have different `ptr`s, and (2) the default allocator vtable ignores the `ptr` field anyway, so any allocators sharing the same vtable would function identically.
Applied to files:
src/url.zigsrc/string.zigsrc/css/values/ident.zigsrc/css/targets.zigsrc/bun.zigsrc/css/values/resolution.zig
📚 Learning: 2025-10-24T10:43:09.398Z
Learnt from: fmguerreiro
Repo: oven-sh/bun PR: 23774
File: src/install/PackageManager/updatePackageJSONAndInstall.zig:548-548
Timestamp: 2025-10-24T10:43:09.398Z
Learning: In Bun's Zig codebase, the `as(usize, intCast(...))` cast pattern triggers a Zig compiler bug that causes compilation to hang indefinitely when used in complex control flow contexts (loops + short-circuit operators + optional unwrapping). Avoid this pattern and use simpler alternatives like just `intCast(...)` if type casting is necessary.
Applied to files:
src/css/media_query.zigsrc/css/values/angle.zigsrc/string.zigsrc/css/values/ident.zigsrc/bun.zigsrc/css/css_parser.zigsrc/css/values/resolution.zig
📚 Learning: 2025-09-25T18:39:03.607Z
Learnt from: nektro
Repo: oven-sh/bun PR: 22958
File: src/bun.js/api/crypto/EVP.zig:24-24
Timestamp: 2025-09-25T18:39:03.607Z
Learning: BoringSSL's translated bindings in src/deps/boringssl.translated.zig only provide EVP_blake2b256() and EVP_blake2b512() extern function declarations. EVP_blake2s256() does not exist in BoringSSL bindings, so blake2s256 algorithm support must rely on the EVP_get_digestbyname() fallback mechanism rather than direct function binding in the Algorithm.md() switch statement.
Applied to files:
src/bun.js/api/crypto/EVP.zig
📚 Learning: 2025-09-25T18:39:03.607Z
Learnt from: nektro
Repo: oven-sh/bun PR: 22958
File: src/bun.js/api/crypto/EVP.zig:24-24
Timestamp: 2025-09-25T18:39:03.607Z
Learning: BoringSSL does not provide EVP_blake2s256() function binding in Bun's codebase, unlike EVP_blake2b256() and EVP_blake2b512() which are available. For blake2s256 algorithm support, the correct approach is to rely on the EVP_get_digestbyname() fallback mechanism rather than adding a direct function binding to the Algorithm.md() switch statement.
Applied to files:
src/bun.js/api/crypto/EVP.zig
📚 Learning: 2025-10-29T19:05:25.638Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 24063
File: packages/bun-types/telemetry.d.ts:252-261
Timestamp: 2025-10-29T19:05:25.638Z
Learning: In packages/bun-types/telemetry.d.ts and src/telemetry/telemetry.zig, the naming inconsistency between `kind` (public API) and `type` (internal implementation) is intentional. The public API uses `InstrumentInfo.kind: InstrumentKind` with string values ("http", "fetch", etc.) for developer ergonomics, while the internal implementation uses `InstrumentRecord.type: InstrumentType` with numeric enum (0-6) for O(1) dispatch performance. This dual naming provides both ergonomic strings externally and efficient numeric dispatch internally without compromising either developer experience or runtime performance.
Applied to files:
src/css/values/syntax.zig
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/src/napi/napi.zig : For each new V8 C++ method, add both GCC/Clang and MSVC mangled symbol names to the V8API struct in src/napi/napi.zig using extern fn declarations
Applied to files:
src/css/values/syntax.zig
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/src/symbols.txt : Add symbol names without leading underscore to src/symbols.txt for each new V8 API method
Applied to files:
src/css/values/syntax.zig
📚 Learning: 2025-11-11T22:55:04.070Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 24571
File: src/css/selectors/parser.zig:908-916
Timestamp: 2025-11-11T22:55:04.070Z
Learning: In oven-sh/bun, CSS serialization uses an arena allocator. In src/css/selectors/parser.zig, functions like PseudoClass.toCss and PseudoElement.toCss intentionally do not call deinit on std.Io.Writer.Allocating, scratch buffers, or css.Printer because dest.allocator is an arena and these temporaries are reclaimed when the CSS pass completes. Only debug-only paths (e.g., DeclarationBlock.DebugFmt in src/css/declaration.zig) may explicitly deinit.
Applied to files:
src/css/properties/custom.zigsrc/css/properties/generate_properties.tssrc/css/rules/keyframes.zigsrc/css/selectors/parser.zigsrc/css/properties/animation.zig
📚 Learning: 2025-09-02T19:17:26.376Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 0
File: :0-0
Timestamp: 2025-09-02T19:17:26.376Z
Learning: In Bun's Zig codebase, when handling error unions where the same cleanup operation (like `rawFree`) needs to be performed regardless of success or failure, prefer using boolean folding with `else |err| switch (err)` over duplicating the cleanup call in multiple switch branches. This approach avoids code duplication while maintaining compile-time error checking.
Applied to files:
src/css/values/angle.zig
📚 Learning: 2025-11-24T18:35:39.205Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/registering-bun-modules.mdc:0-0
Timestamp: 2025-11-24T18:35:39.205Z
Learning: Applies to src/bun.js/api/BunObject.zig : Implement getter functions in `src/bun.js/api/BunObject.zig` that return your feature, and export them in the `exportAll()` function
Applied to files:
src/bun.js/uuid.zigsrc/bun.js/node/path.zig
📚 Learning: 2025-10-01T21:49:27.862Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/BunIDLConvert.h:29-42
Timestamp: 2025-10-01T21:49:27.862Z
Learning: In Bun's IDL bindings (src/bun.js/bindings/BunIDLConvert.h), IDLStrictNull intentionally treats both undefined and null as null (using isUndefinedOrNull()), matching WebKit's IDLNull & IDLNullable behavior. This is the correct implementation and should not be changed to only accept null.
Applied to files:
src/bun.js/uuid.zigsrc/css/targets.zig
📚 Learning: 2025-11-24T18:36:08.558Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-11-24T18:36:08.558Z
Learning: Applies to src/bun.js/bindings/generated_classes_list.zig : Include new class bindings in `src/bun.js/bindings/generated_classes_list.zig` to register them with the code generator
Applied to files:
src/bun.js/uuid.zigsrc/bun.js/node/path.zigsrc/css/rules/keyframes.zig
📚 Learning: 2025-11-24T18:37:47.899Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/AGENTS.md:0-0
Timestamp: 2025-11-24T18:37:47.899Z
Learning: Applies to src/bun.js/bindings/v8/**/<UNKNOWN> : <UNKNOWN>
Applied to files:
src/bun.js/uuid.zigsrc/css/selectors/parser.zig
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/test/v8/v8.test.ts : Add corresponding test cases to test/v8/v8.test.ts using checkSameOutput() function to compare Node.js and Bun output
Applied to files:
src/bun.js/uuid.zigsrc/bun.js/node/path.zig
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/V8*.h : Add BUN_EXPORT visibility attribute to all public V8 API functions to ensure proper symbol export across platforms
Applied to files:
src/bun.js/uuid.zig
📚 Learning: 2025-11-11T22:55:08.547Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 24571
File: src/css/values/url.zig:97-116
Timestamp: 2025-11-11T22:55:08.547Z
Learning: In Zig 0.15, the standard library module `std.io` was renamed to `std.Io` (with capital I). Code using `std.Io.Writer.Allocating` and similar types is correct for Zig 0.15+.
Applied to files:
src/string.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/options.zigsrc/deps/picohttp.zig
📚 Learning: 2025-10-21T20:57:01.892Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23889
File: src/string.zig:751-752
Timestamp: 2025-10-21T20:57:01.892Z
Learning: In Zig code handling bun.String: calling deref() on an empty bun.String (String.empty or after being set to .empty) is well-defined behavior and safely does nothing (no-op). While such calls may be redundant and could be removed for code clarity, their presence is not a correctness issue.
Applied to files:
src/string.zigsrc/bun.zig
📚 Learning: 2025-11-24T18:35:39.205Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/registering-bun-modules.mdc:0-0
Timestamp: 2025-11-24T18:35:39.205Z
Learning: Applies to **/js_*.zig : Use `bun.JSError!JSValue` for proper error propagation in JavaScript bindings
Applied to files:
src/css/values/ident.zigsrc/css/properties/generate_properties.ts
📚 Learning: 2025-11-24T18:36:08.558Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-11-24T18:36:08.558Z
Learning: Applies to **/*.zig : Use `bun.JSError!JSValue` return type for Zig methods and constructors to enable proper error handling and exception propagation
Applied to files:
src/css/values/ident.zigsrc/css/properties/generate_properties.ts
📚 Learning: 2025-11-12T04:11:52.293Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 24622
File: src/deps/uws/us_socket_t.zig:112-113
Timestamp: 2025-11-12T04:11:52.293Z
Learning: In Bun's Zig codebase, when passing u32 values to C FFI functions that expect c_uint parameters, no explicit intCast is needed because c_uint is equivalent to u32 on Bun's target platforms and Zig allows implicit coercion between equivalent types. This pattern is used consistently throughout src/deps/uws/us_socket_t.zig in functions like setTimeout, setLongTimeout, and setKeepalive.
Applied to files:
src/bun.js/node/path.zig
📚 Learning: 2025-09-05T18:45:29.200Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 21728
File: src/valkey/js_valkey.zig:0-0
Timestamp: 2025-09-05T18:45:29.200Z
Learning: In JSValkeyClient.cloneWithoutConnecting() in src/valkey/js_valkey.zig, the address/username/password fields must be repointed to the duplicated connection_strings buffer to avoid use-after-free when the original client is destroyed. The original client properly frees connection_strings in ValkeyClient.deinit().
Applied to files:
src/http/websocket_client/WebSocketUpgradeClient.zig
📚 Learning: 2025-10-17T20:50:58.644Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23755
File: src/bun.js/api/bun/socket/Handlers.zig:154-159
Timestamp: 2025-10-17T20:50:58.644Z
Learning: In Bun socket configuration error messages (src/bun.js/api/bun/socket/Handlers.zig), use the user-facing JavaScript names "data" and "drain" instead of internal field names "onData" and "onWritable", as these are the names users see in the API according to SocketConfig.bindv2.ts.
Applied to files:
src/http/websocket_client/WebSocketUpgradeClient.zig
📚 Learning: 2025-11-24T18:35:39.205Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/registering-bun-modules.mdc:0-0
Timestamp: 2025-11-24T18:35:39.205Z
Learning: Applies to **/*js_bindings.classes.ts : Add JSDoc comments to JavaScript binding definitions in `.classes.ts` files
Applied to files:
src/css/properties/generate_properties.ts
📚 Learning: 2025-10-16T17:32:03.074Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23710
File: src/install/PackageManager/PackageManagerOptions.zig:187-193
Timestamp: 2025-10-16T17:32:03.074Z
Learning: In Bun's codebase (particularly in files like src/install/PackageManager/PackageManagerOptions.zig), mixing bun.EnvVar.*.get() and bun.EnvVar.*.platformGet() for environment variable lookups is intentional and safe. The code is protected by compile-time platform checks (Environment.isWindows, etc.), and compilation will fail if the wrong function is used on the wrong platform. This pattern should not be flagged as a consistency issue.
Applied to files:
src/bun.zig
📚 Learning: 2025-11-24T18:35:25.883Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/javascriptcore-class.mdc:0-0
Timestamp: 2025-11-24T18:35:25.883Z
Learning: Applies to *.zig : In Zig, declare external C++ functions and wrap them in public methods using the convention `extern fn Bun__ClassName__toJS(...)` and `pub fn toJS(...)`
Applied to files:
src/css/rules/keyframes.zig
📚 Learning: 2025-09-25T22:51:15.539Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 22946
File: src/js/internal/sql/postgres.ts:138-143
Timestamp: 2025-09-25T22:51:15.539Z
Learning: In PostgreSQL array serialization for Bun.SQL, typed arrays (Uint8Array, Int32Array, etc.) should always be treated as arrays and expand their elements, not as binary data. BYTEA binary serialization should only use Buffer objects, maintaining consistency with postgres.js behavior. Typed arrays and Buffer have different semantic purposes.
Applied to files:
src/sql/postgres/DataCell.zig
📚 Learning: 2025-09-25T01:02:43.263Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 22946
File: src/js/internal/sql/postgres.ts:188-198
Timestamp: 2025-09-25T01:02:43.263Z
Learning: In the PostgreSQL array implementation for Bun.SQL, when getPostgresArrayType returns null for unknown numeric OIDs, throwing an error is not the desired behavior. The user prefers a different approach for handling unknown array type OIDs.
Applied to files:
src/sql/postgres/DataCell.zig
📚 Learning: 2025-09-25T01:04:19.262Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 22946
File: src/js/internal/sql/postgres.ts:1185-1416
Timestamp: 2025-09-25T01:04:19.262Z
Learning: In the PostgreSQL array implementation for Bun.SQL, when serializing arrays for JSON/JSONB columns, the user prefers using PostgreSQL array literal format (serializeArray(value, "JSON")) over standard JSON serialization (JSON.stringify(value)). PostgreSQL JSON array handling is different from JavaScript JSON array handling according to the user's requirements.
Applied to files:
src/sql/postgres/DataCell.zig
📚 Learning: 2025-10-30T21:52:04.707Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 24212
File: src/cli/publish_command.zig:782-788
Timestamp: 2025-10-30T21:52:04.707Z
Learning: In the Bun codebase (oven-sh/bun), `enable_ansi_colors` flags are used to gate both ANSI color codes and Unicode box-drawing characters/emoji. This is the established pattern across the codebase.
Applied to files:
src/css/values/color.zig
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/bun.js/bindings/**/*.cpp : When implementing JavaScript classes in C++, define properties using HashTableValue arrays and add iso subspaces for classes with C++ fields, caching structures in ZigGlobalObject
Applied to files:
src/css/selectors/parser.zig
| @@ -119,7 +119,7 @@ function generatePropertyImpl(property_defs: Record<string, PropertyDef>): strin | |||
| // - eql() | |||
| // - parse() | |||
| // - toCss() | |||
| // | |||
| // | |||
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Remove unnecessary blank comment line.
The extra blank comment line appears to be unintentional and doesn't improve readability.
- //📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // |
🤖 Prompt for AI Agents
In src/css/properties/generate_properties.ts around line 122, there is an
unnecessary blank comment line ("//") that should be removed; delete that empty
comment so the file has no stray comment-only line at that position to improve
cleanliness and readability.
| @@ -491,7 +491,7 @@ function generatePropertyIdImplFromNameAndPrefix(property_defs: Record<string, P | |||
| return Object.entries(property_defs) | |||
| .map(([name, meta]) => { | |||
| if (name === "unparsed") return ""; | |||
| return `if (bun.strings.eqlCaseInsensitiveASCIIICheckLength(name1, "${name}")) { | |||
| return `if (bun.strings.eqlCaseInsensitiveASCII(name1, "${name}")) { | |||
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if generatePropertyIdImplFromNameAndPrefix is called
echo "=== Checking if generatePropertyIdImplFromNameAndPrefix is used ==="
rg -n "generatePropertyIdImplFromNameAndPrefix" --type=ts
# Find the new function in Zig string utilities
echo -e "\n=== Looking for eqlCaseInsensitiveASCII definition ==="
rg -n "fn eqlCaseInsensitiveASCII" --type=zig -A 5
# Check if the old function still exists
echo -e "\n=== Checking if old function eqlCaseInsensitiveASCIIICheckLength still exists ==="
rg -n "eqlCaseInsensitiveASCIIICheckLength" --type=zig
# Check generated file for actual usage
echo -e "\n=== Checking generated Zig file for the function usage ==="
fd "properties_generated.zig" --type f -x cat -n {} \; 2>/dev/null | head -100
# Check the generate_properties.ts file around line 490-500
echo -e "\n=== Content of generate_properties.ts around line 490-500 ==="
sed -n '480,510p' src/css/properties/generate_properties.ts | cat -nRepository: oven-sh/bun
Length of output: 7970
🏁 Script executed:
#!/bin/bash
# Search for where generatePropertyIdImplFromNameAndPrefix might be called
echo "=== Checking full context of generate_properties.ts file ==="
wc -l src/css/properties/generate_properties.ts
# Get end of file to see if function is exported
echo -e "\n=== Last 50 lines of generate_properties.ts ==="
tail -50 src/css/properties/generate_properties.ts
# Search for imports of this file or function exports
echo -e "\n=== Checking for exports or other function calls in generate_properties.ts ==="
rg -n "export|generatePropertyIdImpl" src/css/properties/generate_properties.ts
# Search for where properties_generated.zig is created
echo -e "\n=== Looking for build/generation scripts ==="
fd -t f "\.ts$" -x rg -l "properties_generated" {}
# Check if there's a run script or main export
echo -e "\n=== Checking if generate_properties.ts has a main export ==="
head -30 src/css/properties/generate_properties.tsRepository: oven-sh/bun
Length of output: 3221
🏁 Script executed:
#!/bin/bash
# Look at the actual generatePropertyIdImpl function and what it generates
echo "=== Lines 368-420 showing generatePropertyIdImpl and its usage ==="
sed -n '360,425p' src/css/properties/generate_properties.ts | cat -nRepository: oven-sh/bun
Length of output: 2987
🏁 Script executed:
#!/bin/bash
# Check git history for generatePropertyIdImplFromNameAndPrefix
echo "=== Git log for generatePropertyIdImplFromNameAndPrefix ==="
git log --oneline -p src/css/properties/generate_properties.ts | grep -B5 -A5 "generatePropertyIdImplFromNameAndPrefix" | head -40
# Check when this function was added
echo -e "\n=== Git blame for line 490 ==="
git blame -L 490,495 src/css/properties/generate_properties.ts
# Verify Map.getASCIIICaseInsensitive exists
echo -e "\n=== Looking for getASCIIICaseInsensitive implementation ==="
rg -n "getASCIIICaseInsensitive" --type=ts --type=zig -B 2 -A 5Repository: oven-sh/bun
Length of output: 22256
Remove unused dead code function generatePropertyIdImplFromNameAndPrefix.
The function generatePropertyIdImplFromNameAndPrefix (lines 490–500) is never called and should be removed. The actual implementation uses Map.getASCIIICaseInsensitive from ComptimeEnumMap instead (line 402), which generates the property matching code correctly. The unused function appears to be leftover from refactoring.
🤖 Prompt for AI Agents
In src/css/properties/generate_properties.ts around lines 490 to 500, remove the
dead/unreferenced function generatePropertyIdImplFromNameAndPrefix which is
never called (leftover from refactor) and ensure there are no remaining
references or exports to it; after deletion, run a quick grep/TS compile to
confirm nothing else depends on that identifier and update any related comments
to reflect that ComptimeEnumMap.Map.getASCIIICaseInsensitive is the active
implementation.
| if (bun.strings.startsWithChar(name, '_')) { | ||
| this.options.warn(loc.newCustomError(SelectorParseErrorKind{ .unsupported_pseudo_class_or_element = name })); | ||
| } else if (this.options.css_modules != null and bun.strings.eqlCaseInsensitiveASCIIICheckLength(name, "local") or bun.strings.eqlCaseInsensitiveASCIIICheckLength(name, "global")) { | ||
| } else if (this.options.css_modules != null and bun.strings.eqlCaseInsensitiveASCII(name, "local") or bun.strings.eqlCaseInsensitiveASCII(name, "global")) { | ||
| return .{ .err = loc.newCustomError(SelectorParseErrorKind{ .ambiguous_css_module_class = name }) }; | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check if the file exists and read the relevant lines
cat -n src/css/selectors/parser.zig | sed -n '1210,1225p'Repository: oven-sh/bun
Length of output: 958
🏁 Script executed:
# Let's also check more context around this section to understand the logic
cat -n src/css/selectors/parser.zig | sed -n '1200,1280p'Repository: oven-sh/bun
Length of output: 4629
🏁 Script executed:
# Search for related CSS modules handling to understand intended behavior
rg -A 5 -B 5 "css_modules" src/css/selectors/parser.zig | head -100Repository: oven-sh/bun
Length of output: 2488
🌐 Web query:
Zig operator precedence and vs or
💡 Result:
In Zig the logical operator and has higher precedence than or, so expressions parse as (a and b) or c (not a and (b or c)). See the Zig operator-precedence table. [1][2]
Example:
- a and b or c ===> (a and b) or c. [1][2]
Sources:
[1] Zig docs — Precedence (master).
[2] Zig docs — Precedence (0.12.1).
:global pseudo-class incorrectly rejected when CSS modules are disabled due to operator precedence
Line 1217 uses and and or without proper grouping:
} else if (this.options.css_modules != null and bun.strings.eqlCaseInsensitiveASCII(name, "local") or bun.strings.eqlCaseInsensitiveASCII(name, "global")) {Since and has higher precedence than or in Zig, this evaluates as:
if (((this.options.css_modules != null and eql(name, "local")) or eql(name, "global"))) { ... }This causes :global to trigger ambiguous_css_module_class even when css_modules is null, which contradicts the correct logic at lines 1256 and 1269 in parseNonTsFunctionalPseudoClass where both conditions explicitly require and this.options.css_modules != null.
Both local and global should only be treated as ambiguous when CSS modules are enabled. Fix by grouping the conditions:
- } else if (this.options.css_modules != null and bun.strings.eqlCaseInsensitiveASCII(name, "local") or bun.strings.eqlCaseInsensitiveASCII(name, "global")) {
+ } else if (this.options.css_modules != null and (bun.strings.eqlCaseInsensitiveASCII(name, "local") or bun.strings.eqlCaseInsensitiveASCII(name, "global"))) {🤖 Prompt for AI Agents
In src/css/selectors/parser.zig around lines 1215 to 1219, the conditional mixes
`and` and `or` without grouping so `:global` is treated as ambiguous even when
css_modules is null; change the condition to first check
`this.options.css_modules != null` and then check the name (e.g., `if
(this.options.css_modules != null and (bun.strings.eqlCaseInsensitiveASCII(name,
"local") or bun.strings.eqlCaseInsensitiveASCII(name, "global")))`) so both
`local` and `global` are only considered ambiguous when CSS modules are enabled,
returning the same ambiguous_css_module_class error as intended.
0062612 to
1bad8a4
Compare
| pub inline fn eqlCaseInsensitiveASCII(a: string, b: string) bool { | ||
| // This is separated into a slow path to reduce code size of the fast path. We're letting LLVM | ||
| // decide whether it inlines it or not. | ||
| const SlowPathNs = struct { |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
src/css/values/length.zig (1)
446-452: Bug:tryOp/tryOpTousethis.toPx()for both operandsBoth helpers currently compute
bfromthis.toPx()instead ofother.toPx(), so mixed-unit ops that fall back to pixels will incorrectly use the left-hand value twice.Fix by calling
other.toPx()forbin both functions:@@ - const a = this.toPx(); - const b = this.toPx(); + const a = this.toPx(); + const b = other.toPx(); @@ - const a = this.toPx(); - const b = this.toPx(); + const a = this.toPx(); + const b = other.toPx();This will make
LengthValue.tryOp/tryOpTobehave correctly when the tags differ but both values are convertible to pixels.Also applies to: 472-476
src/css/properties/css_modules.zig (1)
64-73: Fix the CI compilation error around the “from” sentinel checkThe logic
if (bun.strings.eqlCaseInsensitiveASCII(name.v, "from")) return .{ .err = input.newErrorForNextToken() };is semantically correct for reservingfromas a keyword, but CI is currently failing with a Zig compile error reported at this line. Double-check that all references to the oldeqlCaseInsensitiveASCII*variants are removed, thatbun.strings.eqlCaseInsensitiveASCIIis visible with the new two-argument signature on all targets, and re-runbun run zig:check-allto ensure this compiles everywhere before merging.src/css/properties/animation.zig (1)
172-176: Fix malformedparseStringcall infill_modebranch: missing 3 required parametersIn
Animation.toCssat line 187-192, thefill_modebranch calls:css.parse_utility.parseString(dest.allocator).isOk()This is incomplete. The
parseStringfunction signature requires 4 parameters:
allocator: Allocatorcomptime T: typeinput: []const u8comptime parse_one: *const fn (*Parser) Result(T)Your call provides only the allocator. The
direction(lines 177-182) andplay_state(lines 194-199) branches correctly pass all 4 arguments. Update thefill_modebranch to match:if (!this.fill_mode.eql(&AnimationFillMode.default()) or (!bun.strings.eqlCaseInsensitiveASCII(name_str, "none") and css.parse_utility.parseString( dest.allocator, AnimationFillMode, name_str, AnimationFillMode.parse, ).isOk())) { try this.fill_mode.toCss(dest); try dest.writeChar(' '); }This is a compile-time error. Run
bun run zig:check-allafter fixing to verify compilation across all targets.src/css/values/color.zig (1)
2876-2914: Fix enum variant typo:@"a99-rgb"should be@"a98-rgb"At line 2880, the Variants enum defines
@"a99-rgb", but the CSS Color Module Level 4 specification defines this color space asa98-rgb. This typo is inconsistent with:
- Line 2828: the earlier
eqlCaseInsensitiveASCII("a98-rgb", colorspace)check- Line 3572: the output serialization
"a98-rgb"- Comments (lines 1478, 1932) and all helper functions that reference
a98-rgbThe typo allows the non-standard
color(a99-rgb …)syntax to parse while the correctcolor(a98-rgb …)only works through the manual fallthrough at line 2828. Rename the enum tag to@"a98-rgb"to ensure consistent parsing of both relative and non-relative color() syntax.
♻️ Duplicate comments (4)
src/css/properties/generate_properties.ts (1)
122-122: Remove unnecessary blank comment line.This extra blank comment line was already flagged in previous reviews and should be removed.
src/sql/postgres/DataCell.zig (1)
585-602: MakeNULLcheck for date/timestamp text strictly case‑sensitive (or drop it)This branch:
if (bun.strings.eqlCaseInsensitiveASCII(bytes, "NULL")) { return SQLDataCell{ .tag = .null, .value = .{ .null = 0 } }; }treats any case variation of
"NULL"(e.g."null","Null") as SQL NULL for.date/.timestamp/.timestamptz, even though on the wire NULLs are represented by a-1length and never as the text"NULL". If bytes are present, they’re actual text data. Elsewhere in this file (array parsing), unquotedNULLis matched case‑sensitively witheqlComptime, and quoted"NULL"is treated as a string.To keep semantics consistent and avoid silently discarding data that happens to be
"null"in user text, this should be case‑sensitive (or removed entirely). For a minimal, consistent fix:- } else { - if (bun.strings.eqlCaseInsensitiveASCII(bytes, "NULL")) { - return SQLDataCell{ .tag = .null, .value = .{ .null = 0 } }; - } + } else { + if (bun.strings.eqlComptime(bytes, "NULL")) { + return SQLDataCell{ .tag = .null, .value = .{ .null = 0 } }; + } var str = bun.String.init(bytes);This keeps the unification work but aligns with the array handling and the protocol’s NULL semantics.
src/css/rules/font_face.zig (1)
380-396: Font format and @font-face property name comparisons align with unified helper
FontFormat.parsenow usesbun.strings.eqlCaseInsensitiveASCIIto match"woff","woff2","truetype","opentype","embedded-opentype","collection", and"svg". That preserves the intended case-insensitive keyword handling while simplifying the helper.FontFaceDeclarationParser.DeclarationParser.parseValuesimilarly switches tobun.strings.eqlCaseInsensitiveASCIIfor"src","font-family","font-weight","font-style","font-stretch", and"unicode-renage".These changes are mechanically consistent with the rest of the PR. Note that the
"unicode-renage"spelling matches the earlier declaration parser; see the comment insrc/css/rules/property.zigabout verifying whether this is intended or a typo for"unicode-range".Also applies to: 671-705
src/css/selectors/parser.zig (1)
1215-1220: Fix operator precedence in CSS modules:local/:globalambiguity checkThe condition currently parses as:
(this.options.css_modules != null and eql(name, "local")) or eql(name, "global")so
:globalis treated as ambiguous even whencss_modulesis null. Bothlocalandglobalshould only be considered ambiguous when CSS modules are enabled. Group the name checks:- } else if (this.options.css_modules != null and bun.strings.eqlCaseInsensitiveASCII(name, "local") or bun.strings.eqlCaseInsensitiveASCII(name, "global")) { + } else if (this.options.css_modules != null and + (bun.strings.eqlCaseInsensitiveASCII(name, "local") or + bun.strings.eqlCaseInsensitiveASCII(name, "global"))) + { return .{ .err = loc.newCustomError(SelectorParseErrorKind{ .ambiguous_css_module_class = name }) }; }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📥 Commits
Reviewing files that changed from the base of the PR and between 006261237a4550324b39562bfa39dae5e7ed507e and 1bad8a4.
📒 Files selected for processing (48)
src/bun.js/api/crypto/EVP.zig(1 hunks)src/bun.js/node/path.zig(1 hunks)src/bun.js/uuid.zig(1 hunks)src/bun.zig(4 hunks)src/cli/create_command.zig(1 hunks)src/cli/pack_command.zig(1 hunks)src/cli/publish_command.zig(1 hunks)src/css/css_parser.zig(11 hunks)src/css/media_query.zig(2 hunks)src/css/properties/animation.zig(2 hunks)src/css/properties/background.zig(2 hunks)src/css/properties/css_modules.zig(1 hunks)src/css/properties/custom.zig(4 hunks)src/css/properties/font.zig(1 hunks)src/css/properties/generate_properties.ts(2 hunks)src/css/properties/grid.zig(2 hunks)src/css/properties/transform.zig(10 hunks)src/css/rules/container.zig(1 hunks)src/css/rules/font_face.zig(2 hunks)src/css/rules/font_palette_values.zig(2 hunks)src/css/rules/keyframes.zig(2 hunks)src/css/rules/property.zig(1 hunks)src/css/rules/supports.zig(2 hunks)src/css/selectors/parser.zig(9 hunks)src/css/targets.zig(1 hunks)src/css/values/angle.zig(2 hunks)src/css/values/color.zig(3 hunks)src/css/values/easing.zig(2 hunks)src/css/values/gradient.zig(3 hunks)src/css/values/ident.zig(1 hunks)src/css/values/image.zig(1 hunks)src/css/values/length.zig(2 hunks)src/css/values/resolution.zig(2 hunks)src/css/values/syntax.zig(1 hunks)src/css/values/time.zig(2 hunks)src/deps/picohttp.zig(3 hunks)src/http.zig(3 hunks)src/http/Headers.zig(2 hunks)src/http/websocket_client/WebSocketUpgradeClient.zig(6 hunks)src/install/repository.zig(4 hunks)src/options.zig(1 hunks)src/output.zig(1 hunks)src/resolver/resolve_path.zig(4 hunks)src/sql/postgres/DataCell.zig(3 hunks)src/string.zig(2 hunks)src/string/immutable.zig(3 hunks)src/url.zig(3 hunks)src/which.zig(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
src/**/*.{cpp,zig}
📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
src/**/*.{cpp,zig}: Usebun bdorbun run build:debugto build debug versions for C++ and Zig source files; creates debug build at./build/debug/bun-debug
Run tests usingbun bd test <test-file>with the debug build; never usebun testdirectly as it will not include your changes
Execute files usingbun bd <file> <...args>; never usebun <file>directly as it will not include your changes
Enable debug logs for specific scopes usingBUN_DEBUG_$(SCOPE)=1environment variable
Code generation happens automatically as part of the build process; no manual code generation commands are required
Files:
src/css/values/image.zigsrc/output.zigsrc/css/values/angle.zigsrc/css/properties/grid.zigsrc/css/values/time.zigsrc/css/rules/font_palette_values.zigsrc/http/Headers.zigsrc/css/values/easing.zigsrc/install/repository.zigsrc/css/media_query.zigsrc/css/values/resolution.zigsrc/css/properties/transform.zigsrc/css/values/length.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/values/syntax.zigsrc/css/rules/supports.zigsrc/css/properties/font.zigsrc/string.zigsrc/css/rules/font_face.zigsrc/cli/publish_command.zigsrc/cli/pack_command.zigsrc/http.zigsrc/sql/postgres/DataCell.zigsrc/css/targets.zigsrc/css/rules/keyframes.zigsrc/css/values/gradient.zigsrc/options.zigsrc/cli/create_command.zigsrc/css/values/ident.zigsrc/css/values/color.zigsrc/css/properties/animation.zigsrc/css/selectors/parser.zigsrc/resolver/resolve_path.zigsrc/bun.zigsrc/css/properties/css_modules.zigsrc/string/immutable.zigsrc/deps/picohttp.zigsrc/css/rules/container.zigsrc/bun.js/node/path.zigsrc/css/css_parser.zigsrc/css/rules/property.zigsrc/bun.js/api/crypto/EVP.zigsrc/url.zigsrc/css/properties/custom.zigsrc/css/properties/background.zigsrc/bun.js/uuid.zigsrc/which.zig
src/**/*.zig
📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
Use
bun.Output.scoped(.${SCOPE}, .hidden)for creating debug logs in Zig codeImplement core functionality in Zig, typically in its own directory in
src/
src/**/*.zig: Zig source code should be organized insrc/*.zigfor core runtime, JavaScript bindings, and package manager
In Zig code, be careful with allocators and use defer for cleanup to manage memory properly
UseBUN_DEBUG_QUIET_LOGS=1to disable debug logging, orBUN_DEBUG_<scopeName>=1to enable specific Output.scoped calls in debug builds
Runbun run zig:check-allto compile the Zig code on all platforms when making platform-specific changes
src/**/*.zig: Private fields in Zig are fully supported using the#prefix:struct { #foo: u32 };
Use decl literals in Zig for declaration initialization:const decl: Decl = .{ .binding = 0, .value = 0 };
Prefer@importat the bottom of the file (auto formatter will move them automatically)
Files:
src/css/values/image.zigsrc/output.zigsrc/css/values/angle.zigsrc/css/properties/grid.zigsrc/css/values/time.zigsrc/css/rules/font_palette_values.zigsrc/http/Headers.zigsrc/css/values/easing.zigsrc/install/repository.zigsrc/css/media_query.zigsrc/css/values/resolution.zigsrc/css/properties/transform.zigsrc/css/values/length.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/values/syntax.zigsrc/css/rules/supports.zigsrc/css/properties/font.zigsrc/string.zigsrc/css/rules/font_face.zigsrc/cli/publish_command.zigsrc/cli/pack_command.zigsrc/http.zigsrc/sql/postgres/DataCell.zigsrc/css/targets.zigsrc/css/rules/keyframes.zigsrc/css/values/gradient.zigsrc/options.zigsrc/cli/create_command.zigsrc/css/values/ident.zigsrc/css/values/color.zigsrc/css/properties/animation.zigsrc/css/selectors/parser.zigsrc/resolver/resolve_path.zigsrc/bun.zigsrc/css/properties/css_modules.zigsrc/string/immutable.zigsrc/deps/picohttp.zigsrc/css/rules/container.zigsrc/bun.js/node/path.zigsrc/css/css_parser.zigsrc/css/rules/property.zigsrc/bun.js/api/crypto/EVP.zigsrc/url.zigsrc/css/properties/custom.zigsrc/css/properties/background.zigsrc/bun.js/uuid.zigsrc/which.zig
**/*.zig
📄 CodeRabbit inference engine (.cursor/rules/zig-javascriptcore-classes.mdc)
**/*.zig: Expose generated bindings in Zig structs usingpub const js = JSC.Codegen.JS<ClassName>with trait conversion methods:toJS,fromJS, andfromJSDirect
Use consistent parameter nameglobalObjectinstead ofctxin Zig constructor and method implementations
Usebun.JSError!JSValuereturn type for Zig methods and constructors to enable proper error handling and exception propagation
Implement resource cleanup usingdeinit()method that releases resources, followed byfinalize()called by the GC that invokesdeinit()and frees the pointer
UseJSC.markBinding(@src())in finalize methods for debugging purposes before callingdeinit()
For methods returning cached properties in Zig, declare external C++ functions usingextern fnandcallconv(JSC.conv)calling convention
Implement getter functions with naming patternget<PropertyName>in Zig that acceptthisandglobalObjectparameters and returnJSC.JSValue
Access JavaScript CallFrame arguments usingcallFrame.argument(i), check argument count withcallFrame.argumentCount(), and getthiswithcallFrame.thisValue()
For reference-counted objects, use.deref()in finalize instead ofdestroy()to release references to other JS objects
Files:
src/css/values/image.zigsrc/output.zigsrc/css/values/angle.zigsrc/css/properties/grid.zigsrc/css/values/time.zigsrc/css/rules/font_palette_values.zigsrc/http/Headers.zigsrc/css/values/easing.zigsrc/install/repository.zigsrc/css/media_query.zigsrc/css/values/resolution.zigsrc/css/properties/transform.zigsrc/css/values/length.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/values/syntax.zigsrc/css/rules/supports.zigsrc/css/properties/font.zigsrc/string.zigsrc/css/rules/font_face.zigsrc/cli/publish_command.zigsrc/cli/pack_command.zigsrc/http.zigsrc/sql/postgres/DataCell.zigsrc/css/targets.zigsrc/css/rules/keyframes.zigsrc/css/values/gradient.zigsrc/options.zigsrc/cli/create_command.zigsrc/css/values/ident.zigsrc/css/values/color.zigsrc/css/properties/animation.zigsrc/css/selectors/parser.zigsrc/resolver/resolve_path.zigsrc/bun.zigsrc/css/properties/css_modules.zigsrc/string/immutable.zigsrc/deps/picohttp.zigsrc/css/rules/container.zigsrc/bun.js/node/path.zigsrc/css/css_parser.zigsrc/css/rules/property.zigsrc/bun.js/api/crypto/EVP.zigsrc/url.zigsrc/css/properties/custom.zigsrc/css/properties/background.zigsrc/bun.js/uuid.zigsrc/which.zig
src/**/*.{ts,zig,cpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Always use absolute paths in file operations
Files:
src/css/values/image.zigsrc/output.zigsrc/css/values/angle.zigsrc/css/properties/grid.zigsrc/css/values/time.zigsrc/css/rules/font_palette_values.zigsrc/http/Headers.zigsrc/css/values/easing.zigsrc/install/repository.zigsrc/css/media_query.zigsrc/css/values/resolution.zigsrc/css/properties/transform.zigsrc/css/values/length.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/values/syntax.zigsrc/css/rules/supports.zigsrc/css/properties/font.zigsrc/string.zigsrc/css/rules/font_face.zigsrc/cli/publish_command.zigsrc/cli/pack_command.zigsrc/http.zigsrc/sql/postgres/DataCell.zigsrc/css/targets.zigsrc/css/rules/keyframes.zigsrc/css/values/gradient.zigsrc/options.zigsrc/cli/create_command.zigsrc/css/values/ident.zigsrc/css/values/color.zigsrc/css/properties/animation.zigsrc/css/selectors/parser.zigsrc/resolver/resolve_path.zigsrc/bun.zigsrc/css/properties/css_modules.zigsrc/string/immutable.zigsrc/deps/picohttp.zigsrc/css/rules/container.zigsrc/bun.js/node/path.zigsrc/css/css_parser.zigsrc/css/rules/property.zigsrc/bun.js/api/crypto/EVP.zigsrc/url.zigsrc/css/properties/custom.zigsrc/css/properties/background.zigsrc/css/properties/generate_properties.tssrc/bun.js/uuid.zigsrc/which.zig
src/**/*.{ts,zig}
📄 CodeRabbit inference engine (CLAUDE.md)
Avoid shell commands in code - don't use
findorgrep; use Bun's Glob and built-in tools instead
Files:
src/css/values/image.zigsrc/output.zigsrc/css/values/angle.zigsrc/css/properties/grid.zigsrc/css/values/time.zigsrc/css/rules/font_palette_values.zigsrc/http/Headers.zigsrc/css/values/easing.zigsrc/install/repository.zigsrc/css/media_query.zigsrc/css/values/resolution.zigsrc/css/properties/transform.zigsrc/css/values/length.zigsrc/http/websocket_client/WebSocketUpgradeClient.zigsrc/css/values/syntax.zigsrc/css/rules/supports.zigsrc/css/properties/font.zigsrc/string.zigsrc/css/rules/font_face.zigsrc/cli/publish_command.zigsrc/cli/pack_command.zigsrc/http.zigsrc/sql/postgres/DataCell.zigsrc/css/targets.zigsrc/css/rules/keyframes.zigsrc/css/values/gradient.zigsrc/options.zigsrc/cli/create_command.zigsrc/css/values/ident.zigsrc/css/values/color.zigsrc/css/properties/animation.zigsrc/css/selectors/parser.zigsrc/resolver/resolve_path.zigsrc/bun.zigsrc/css/properties/css_modules.zigsrc/string/immutable.zigsrc/deps/picohttp.zigsrc/css/rules/container.zigsrc/bun.js/node/path.zigsrc/css/css_parser.zigsrc/css/rules/property.zigsrc/bun.js/api/crypto/EVP.zigsrc/url.zigsrc/css/properties/custom.zigsrc/css/properties/background.zigsrc/css/properties/generate_properties.tssrc/bun.js/uuid.zigsrc/which.zig
🧠 Learnings (51)
📓 Common learnings
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 0
File: :0-0
Timestamp: 2025-09-02T19:17:26.376Z
Learning: In Bun's Zig codebase, when handling error unions where the same cleanup operation (like `rawFree`) needs to be performed regardless of success or failure, prefer using boolean folding with `else |err| switch (err)` over duplicating the cleanup call in multiple switch branches. This approach avoids code duplication while maintaining compile-time error checking.
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/**/*.zig : Run `bun run zig:check-all` to compile the Zig code on all platforms when making platform-specific changes
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 25111
File: packages/bun-types/wasm.d.ts:103-104
Timestamp: 2025-11-27T15:18:21.607Z
Learning: In the Bun repository, autofixci automatically formats code in the main branch, which can cause formatting diffs to appear in pull requests even when the PR author didn't make those changes. These formatting changes from autofixci are expected and not the PR author's responsibility.
Learnt from: fmguerreiro
Repo: oven-sh/bun PR: 23774
File: src/install/PackageManager/updatePackageJSONAndInstall.zig:548-548
Timestamp: 2025-10-24T10:43:09.398Z
Learning: In Bun's Zig codebase, the `as(usize, intCast(...))` cast pattern triggers a Zig compiler bug that causes compilation to hang indefinitely when used in complex control flow contexts (loops + short-circuit operators + optional unwrapping). Avoid this pattern and use simpler alternatives like just `intCast(...)` if type casting is necessary.
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 22606
File: src/glob/GlobWalker.zig:449-452
Timestamp: 2025-09-12T18:16:50.754Z
Learning: For Bun codebase: prefer using `std.fs.path.sep` over manual platform separator detection, and use `bun.strings.lastIndexOfChar` instead of `std.mem.lastIndexOfScalar` for string operations.
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 24423
File: test/js/node/path/browserify.test.js:472-475
Timestamp: 2025-11-07T17:28:58.045Z
Learning: markovejnovic prefers functional programming patterns (e.g., using reduce) over imperative loops and does not want style-based readability suggestions unless there's a concrete technical reason beyond personal preference.
<!--
📚 Learning: 2025-11-12T07:15:00.763Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 24631
File: src/install/resolution.zig:375-376
Timestamp: 2025-11-12T07:15:00.763Z
Learning: In src/install/resolution.zig, the eql() function intentionally returns false for unknown/unhandled tags in the else branch, even though order() returns .eq for matching unknown tags. This semantic difference is by design.
Applied to files:
src/css/values/image.zigsrc/css/values/angle.zigsrc/install/repository.zigsrc/css/media_query.zigsrc/css/values/resolution.zigsrc/css/properties/transform.zigsrc/string.zigsrc/sql/postgres/DataCell.zigsrc/css/values/gradient.zigsrc/css/values/ident.zigsrc/css/selectors/parser.zigsrc/string/immutable.zigsrc/css/rules/container.zigsrc/url.zig
📚 Learning: 2025-11-24T18:34:55.173Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/building-bun.mdc:0-0
Timestamp: 2025-11-24T18:34:55.173Z
Learning: Applies to src/**/*.zig : Use `bun.Output.scoped(.${SCOPE}, .hidden)` for creating debug logs in Zig code
Applied to files:
src/output.zig
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/**/*.zig : Use `BUN_DEBUG_QUIET_LOGS=1` to disable debug logging, or `BUN_DEBUG_<scopeName>=1` to enable specific Output.scoped calls in debug builds
Applied to files:
src/output.zig
📚 Learning: 2025-10-18T02:06:31.606Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 23796
File: src/bun.js/test/Execution.zig:624-625
Timestamp: 2025-10-18T02:06:31.606Z
Learning: In Zig files using bun.Output.scoped(), the visibility level `.visible` means logs are enabled by default in debug builds unless `BUN_DEBUG_QUIET_LOGS=1` is set; if that environment variable is set, the logs can be re-enabled with `BUN_DEBUG_<scope>=1`. Use `.visible` for logs that should appear by default in debug builds, and `.hidden` for logs that require explicit opt-in via `BUN_DEBUG_<scope>=1`.
Applied to files:
src/output.zig
📚 Learning: 2025-10-16T02:17:35.237Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23710
File: src/analytics.zig:15-21
Timestamp: 2025-10-16T02:17:35.237Z
Learning: In src/analytics.zig and similar files using bun.EnvVar boolean environment variables: the new EnvVar API for boolean flags (e.g., bun.EnvVar.do_not_track.get(), bun.EnvVar.ci.get()) is designed to parse and return boolean values from environment variables, not just check for their presence. This is an intentional design change from the previous presence-based checks using bun.getenvZ().
Applied to files:
src/output.zigsrc/http/Headers.zigsrc/css/media_query.zigsrc/css/values/resolution.zigsrc/css/values/syntax.zigsrc/css/rules/supports.zigsrc/css/rules/font_face.zigsrc/css/targets.zigsrc/css/values/ident.zigsrc/css/values/color.zigsrc/bun.zigsrc/deps/picohttp.zigsrc/bun.js/node/path.zigsrc/css/css_parser.zigsrc/url.zigsrc/css/properties/custom.zigsrc/bun.js/uuid.zig
📚 Learning: 2025-11-24T18:36:08.558Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-11-24T18:36:08.558Z
Learning: Applies to **/*.zig : Use consistent parameter name `globalObject` instead of `ctx` in Zig constructor and method implementations
Applied to files:
src/output.zigsrc/css/values/angle.zigsrc/css/properties/transform.zigsrc/css/values/length.zigsrc/css/selectors/parser.zigsrc/bun.zigsrc/deps/picohttp.zigsrc/css/css_parser.zigsrc/css/properties/custom.zig
📚 Learning: 2025-10-24T10:43:09.398Z
Learnt from: fmguerreiro
Repo: oven-sh/bun PR: 23774
File: src/install/PackageManager/updatePackageJSONAndInstall.zig:548-548
Timestamp: 2025-10-24T10:43:09.398Z
Learning: In Bun's Zig codebase, the `as(usize, intCast(...))` cast pattern triggers a Zig compiler bug that causes compilation to hang indefinitely when used in complex control flow contexts (loops + short-circuit operators + optional unwrapping). Avoid this pattern and use simpler alternatives like just `intCast(...)` if type casting is necessary.
Applied to files:
src/css/values/angle.zigsrc/css/media_query.zigsrc/css/values/resolution.zigsrc/css/rules/supports.zigsrc/string.zigsrc/css/values/ident.zigsrc/css/selectors/parser.zigsrc/bun.zigsrc/css/css_parser.zig
📚 Learning: 2025-09-06T03:37:41.154Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 22229
File: src/bundler/LinkerGraph.zig:0-0
Timestamp: 2025-09-06T03:37:41.154Z
Learning: In Bun's codebase, when checking import record source indices in src/bundler/LinkerGraph.zig, prefer using `if (import_index >= self.import_records.len)` bounds checking over `isValid()` checks, as the bounds check is more robust and `isValid()` is a strict subset of this condition.
Applied to files:
src/css/properties/grid.zigsrc/css/values/resolution.zigsrc/css/values/length.zigsrc/css/rules/supports.zigsrc/css/targets.zigsrc/css/values/ident.zigsrc/bun.zigsrc/which.zig
📚 Learning: 2025-09-12T18:16:50.754Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 22606
File: src/glob/GlobWalker.zig:449-452
Timestamp: 2025-09-12T18:16:50.754Z
Learning: For Bun codebase: prefer using `std.fs.path.sep` over manual platform separator detection, and use `bun.strings.lastIndexOfChar` instead of `std.mem.lastIndexOfScalar` for string operations.
Applied to files:
src/css/values/resolution.zigsrc/css/rules/font_face.zigsrc/css/selectors/parser.zigsrc/resolver/resolve_path.zigsrc/bun.zigsrc/bun.js/node/path.zigsrc/bun.js/uuid.zigsrc/which.zig
📚 Learning: 2025-09-04T02:04:43.094Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 22278
File: src/ast/E.zig:980-1003
Timestamp: 2025-09-04T02:04:43.094Z
Learning: In Bun's Zig codebase, `as(i32, u8_or_u16_value)` is sufficient for casting u8/u16 to i32 in comparison operations. `intCast` is not required in this context, and the current casting approach compiles successfully.
Applied to files:
src/css/values/resolution.zigsrc/string.zigsrc/bun.zigsrc/css/css_parser.zig
📚 Learning: 2025-10-18T20:50:47.750Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: src/bun.js/telemetry.zig:366-373
Timestamp: 2025-10-18T20:50:47.750Z
Learning: In Bun's Zig codebase (src/bun.js/bindings/JSValue.zig), the JSValue enum uses `.null` (not `.js_null`) for JavaScript's null value. Only `js_undefined` has the `js_` prefix to avoid collision with Zig's built-in `undefined` keyword. The correct enum fields are: `js_undefined`, `null`, `true`, `false`, and `zero`.
Applied to files:
src/css/values/length.zigsrc/css/values/syntax.zigsrc/sql/postgres/DataCell.zigsrc/css/targets.zigsrc/css/values/ident.zigsrc/css/values/color.zigsrc/bun.js/node/path.zigsrc/bun.js/uuid.zig
📚 Learning: 2025-10-01T21:59:54.571Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h:47-74
Timestamp: 2025-10-01T21:59:54.571Z
Learning: In the new bindings generator (bindgenv2) for `src/bun.js/bindings/webcore/JSDOMConvertEnumeration.h`, the context-aware enumeration conversion overloads intentionally use stricter validation (requiring `value.isString()` without ToString coercion), diverging from Web IDL semantics. This is a design decision documented in comments.
Applied to files:
src/css/values/length.zigsrc/css/values/syntax.zigsrc/css/rules/font_face.zigsrc/css/values/ident.zigsrc/css/values/color.zigsrc/css/properties/custom.zigsrc/bun.js/uuid.zig
📚 Learning: 2025-09-05T18:45:29.200Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 21728
File: src/valkey/js_valkey.zig:0-0
Timestamp: 2025-09-05T18:45:29.200Z
Learning: In JSValkeyClient.cloneWithoutConnecting() in src/valkey/js_valkey.zig, the address/username/password fields must be repointed to the duplicated connection_strings buffer to avoid use-after-free when the original client is destroyed. The original client properly frees connection_strings in ValkeyClient.deinit().
Applied to files:
src/http/websocket_client/WebSocketUpgradeClient.zig
📚 Learning: 2025-10-17T20:50:58.644Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23755
File: src/bun.js/api/bun/socket/Handlers.zig:154-159
Timestamp: 2025-10-17T20:50:58.644Z
Learning: In Bun socket configuration error messages (src/bun.js/api/bun/socket/Handlers.zig), use the user-facing JavaScript names "data" and "drain" instead of internal field names "onData" and "onWritable", as these are the names users see in the API according to SocketConfig.bindv2.ts.
Applied to files:
src/http/websocket_client/WebSocketUpgradeClient.zigsrc/bun.js/node/path.zigsrc/bun.js/uuid.zig
📚 Learning: 2025-11-11T22:55:08.547Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 24571
File: src/css/values/url.zig:97-116
Timestamp: 2025-11-11T22:55:08.547Z
Learning: In Zig 0.15, the standard library module `std.io` was renamed to `std.Io` (with capital I). Code using `std.Io.Writer.Allocating` and similar types is correct for Zig 0.15+.
Applied to files:
src/http/websocket_client/WebSocketUpgradeClient.zigsrc/string.zig
📚 Learning: 2025-09-02T18:25:27.976Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 22227
File: src/allocators/allocation_scope.zig:284-314
Timestamp: 2025-09-02T18:25:27.976Z
Learning: In bun's custom Zig implementation, the `#` prefix for private fields is valid syntax and should not be flagged as invalid. The syntax `#fieldname` creates private fields that cannot be accessed from outside the defining struct, and usage like `self.#fieldname` is correct within the same struct. This applies to fields like `#parent`, `#state`, `#allocator`, `#trace`, etc. throughout the codebase.
Applied to files:
src/css/values/syntax.zigsrc/css/values/ident.zigsrc/css/selectors/parser.zigsrc/css/css_parser.zigsrc/css/rules/property.zigsrc/css/properties/custom.zig
📚 Learning: 2025-10-29T19:05:25.638Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 24063
File: packages/bun-types/telemetry.d.ts:252-261
Timestamp: 2025-10-29T19:05:25.638Z
Learning: In packages/bun-types/telemetry.d.ts and src/telemetry/telemetry.zig, the naming inconsistency between `kind` (public API) and `type` (internal implementation) is intentional. The public API uses `InstrumentInfo.kind: InstrumentKind` with string values ("http", "fetch", etc.) for developer ergonomics, while the internal implementation uses `InstrumentRecord.type: InstrumentType` with numeric enum (0-6) for O(1) dispatch performance. This dual naming provides both ergonomic strings externally and efficient numeric dispatch internally without compromising either developer experience or runtime performance.
Applied to files:
src/css/values/syntax.zig
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/src/napi/napi.zig : For each new V8 C++ method, add both GCC/Clang and MSVC mangled symbol names to the V8API struct in src/napi/napi.zig using extern fn declarations
Applied to files:
src/css/values/syntax.zigsrc/bun.js/node/path.zigsrc/bun.js/uuid.zigsrc/which.zig
📚 Learning: 2025-11-24T18:36:38.104Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:38.104Z
Learning: Applies to src/**/*.zig : Use decl literals in Zig for declaration initialization: `const decl: Decl = .{ .binding = 0, .value = 0 };`
Applied to files:
src/css/values/syntax.zig
📚 Learning: 2025-09-02T17:09:17.391Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 22227
File: src/allocators.zig:778-782
Timestamp: 2025-09-02T17:09:17.391Z
Learning: In Zig's bun codebase, the `isDefault` function in `src/allocators.zig` only needs to compare `allocator.vtable == c_allocator.vtable` rather than also checking the `ptr` field, because: (1) the codebase never creates multiple allocators that use `c_allocator.vtable` but have different `ptr`s, and (2) the default allocator vtable ignores the `ptr` field anyway, so any allocators sharing the same vtable would function identically.
Applied to files:
src/string.zigsrc/css/targets.zigsrc/css/values/ident.zigsrc/bun.zigsrc/deps/picohttp.zigsrc/css/css_parser.zig
📚 Learning: 2025-09-25T22:51:15.539Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 22946
File: src/js/internal/sql/postgres.ts:138-143
Timestamp: 2025-09-25T22:51:15.539Z
Learning: In PostgreSQL array serialization for Bun.SQL, typed arrays (Uint8Array, Int32Array, etc.) should always be treated as arrays and expand their elements, not as binary data. BYTEA binary serialization should only use Buffer objects, maintaining consistency with postgres.js behavior. Typed arrays and Buffer have different semantic purposes.
Applied to files:
src/sql/postgres/DataCell.zig
📚 Learning: 2025-09-25T01:02:43.263Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 22946
File: src/js/internal/sql/postgres.ts:188-198
Timestamp: 2025-09-25T01:02:43.263Z
Learning: In the PostgreSQL array implementation for Bun.SQL, when getPostgresArrayType returns null for unknown numeric OIDs, throwing an error is not the desired behavior. The user prefers a different approach for handling unknown array type OIDs.
Applied to files:
src/sql/postgres/DataCell.zig
📚 Learning: 2025-09-25T01:04:19.262Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 22946
File: src/js/internal/sql/postgres.ts:1185-1416
Timestamp: 2025-09-25T01:04:19.262Z
Learning: In the PostgreSQL array implementation for Bun.SQL, when serializing arrays for JSON/JSONB columns, the user prefers using PostgreSQL array literal format (serializeArray(value, "JSON")) over standard JSON serialization (JSON.stringify(value)). PostgreSQL JSON array handling is different from JavaScript JSON array handling according to the user's requirements.
Applied to files:
src/sql/postgres/DataCell.zig
📚 Learning: 2025-10-01T21:49:27.862Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23169
File: src/bun.js/bindings/BunIDLConvert.h:29-42
Timestamp: 2025-10-01T21:49:27.862Z
Learning: In Bun's IDL bindings (src/bun.js/bindings/BunIDLConvert.h), IDLStrictNull intentionally treats both undefined and null as null (using isUndefinedOrNull()), matching WebKit's IDLNull & IDLNullable behavior. This is the correct implementation and should not be changed to only accept null.
Applied to files:
src/css/targets.zig
📚 Learning: 2025-11-11T22:55:04.070Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 24571
File: src/css/selectors/parser.zig:908-916
Timestamp: 2025-11-11T22:55:04.070Z
Learning: In oven-sh/bun, CSS serialization uses an arena allocator. In src/css/selectors/parser.zig, functions like PseudoClass.toCss and PseudoElement.toCss intentionally do not call deinit on std.Io.Writer.Allocating, scratch buffers, or css.Printer because dest.allocator is an arena and these temporaries are reclaimed when the CSS pass completes. Only debug-only paths (e.g., DeclarationBlock.DebugFmt in src/css/declaration.zig) may explicitly deinit.
Applied to files:
src/css/rules/keyframes.zigsrc/css/properties/animation.zigsrc/css/selectors/parser.zigsrc/css/properties/css_modules.zigsrc/css/properties/custom.zigsrc/css/properties/generate_properties.ts
📚 Learning: 2025-11-24T18:35:39.205Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/registering-bun-modules.mdc:0-0
Timestamp: 2025-11-24T18:35:39.205Z
Learning: Applies to **/js_*.zig : Use `bun.JSError!JSValue` for proper error propagation in JavaScript bindings
Applied to files:
src/css/values/ident.zigsrc/css/properties/css_modules.zigsrc/css/properties/generate_properties.ts
📚 Learning: 2025-11-24T18:36:08.558Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-11-24T18:36:08.558Z
Learning: Applies to **/*.zig : Use `bun.JSError!JSValue` return type for Zig methods and constructors to enable proper error handling and exception propagation
Applied to files:
src/css/values/ident.zigsrc/css/properties/generate_properties.ts
📚 Learning: 2025-10-30T21:52:04.707Z
Learnt from: pfgithub
Repo: oven-sh/bun PR: 24212
File: src/cli/publish_command.zig:782-788
Timestamp: 2025-10-30T21:52:04.707Z
Learning: In the Bun codebase (oven-sh/bun), `enable_ansi_colors` flags are used to gate both ANSI color codes and Unicode box-drawing characters/emoji. This is the established pattern across the codebase.
Applied to files:
src/css/values/color.zig
📚 Learning: 2025-11-24T18:35:39.205Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/registering-bun-modules.mdc:0-0
Timestamp: 2025-11-24T18:35:39.205Z
Learning: Applies to **/*js_bindings.classes.ts : Use `JSC.Codegen` correctly to generate necessary binding code for JavaScript-Zig integration
Applied to files:
src/css/selectors/parser.zigsrc/css/properties/generate_properties.ts
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/bun.js/bindings/**/*.cpp : When implementing JavaScript classes in C++, define properties using HashTableValue arrays and add iso subspaces for classes with C++ fields, caching structures in ZigGlobalObject
Applied to files:
src/css/selectors/parser.zigsrc/bun.js/uuid.zig
📚 Learning: 2025-11-24T18:37:47.899Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/AGENTS.md:0-0
Timestamp: 2025-11-24T18:37:47.899Z
Learning: Applies to src/bun.js/bindings/v8/**/<UNKNOWN> : <UNKNOWN>
Applied to files:
src/css/selectors/parser.zig
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/**/*.{ts,zig,cpp} : Always use absolute paths in file operations
Applied to files:
src/resolver/resolve_path.zig
📚 Learning: 2025-10-08T13:56:00.875Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 23373
File: src/bun.js/api/BunObject.zig:2514-2521
Timestamp: 2025-10-08T13:56:00.875Z
Learning: For Bun codebase: prefer using `bun.path` utilities (e.g., `bun.path.joinAbsStringBuf`, `bun.path.join`) over `std.fs.path` functions for path operations.
Applied to files:
src/resolver/resolve_path.zigsrc/bun.js/node/path.zig
📚 Learning: 2025-10-21T20:57:01.892Z
Learnt from: taylordotfish
Repo: oven-sh/bun PR: 23889
File: src/string.zig:751-752
Timestamp: 2025-10-21T20:57:01.892Z
Learning: In Zig code handling bun.String: calling deref() on an empty bun.String (String.empty or after being set to .empty) is well-defined behavior and safely does nothing (no-op). While such calls may be redundant and could be removed for code clarity, their presence is not a correctness issue.
Applied to files:
src/bun.zig
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/**/*.zig : Run `bun run zig:check-all` to compile the Zig code on all platforms when making platform-specific changes
Applied to files:
src/bun.zigsrc/which.zig
📚 Learning: 2025-10-16T17:32:03.074Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23710
File: src/install/PackageManager/PackageManagerOptions.zig:187-193
Timestamp: 2025-10-16T17:32:03.074Z
Learning: In Bun's codebase (particularly in files like src/install/PackageManager/PackageManagerOptions.zig), mixing bun.EnvVar.*.get() and bun.EnvVar.*.platformGet() for environment variable lookups is intentional and safe. The code is protected by compile-time platform checks (Environment.isWindows, etc.), and compilation will fail if the wrong function is used on the wrong platform. This pattern should not be flagged as a consistency issue.
Applied to files:
src/bun.zig
📚 Learning: 2025-11-24T18:35:08.612Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/dev-server-tests.mdc:0-0
Timestamp: 2025-11-24T18:35:08.612Z
Learning: Applies to test/bake/dev/css.test.ts : Organize CSS tests in css.test.ts for tests concerning bundling bugs with CSS files
Applied to files:
src/css/properties/css_modules.zig
📚 Learning: 2025-11-24T18:36:08.558Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-11-24T18:36:08.558Z
Learning: Applies to **/*.zig : Expose generated bindings in Zig structs using `pub const js = JSC.Codegen.JS<ClassName>` with trait conversion methods: `toJS`, `fromJS`, and `fromJSDirect`
Applied to files:
src/css/properties/css_modules.zig
📚 Learning: 2025-11-24T18:36:38.104Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:38.104Z
Learning: Applies to src/**/*.zig : Prefer `import` at the bottom of the file (auto formatter will move them automatically)
Applied to files:
src/css/properties/css_modules.zig
📚 Learning: 2025-11-24T18:36:08.558Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/zig-javascriptcore-classes.mdc:0-0
Timestamp: 2025-11-24T18:36:08.558Z
Learning: Applies to src/bun.js/bindings/generated_classes_list.zig : Include new class bindings in `src/bun.js/bindings/generated_classes_list.zig` to register them with the code generator
Applied to files:
src/css/properties/css_modules.zigsrc/bun.js/node/path.zigsrc/bun.js/uuid.zig
📚 Learning: 2025-11-24T18:35:39.205Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/registering-bun-modules.mdc:0-0
Timestamp: 2025-11-24T18:35:39.205Z
Learning: Applies to src/bun.js/api/BunObject.zig : Implement getter functions in `src/bun.js/api/BunObject.zig` that return your feature, and export them in the `exportAll()` function
Applied to files:
src/bun.js/node/path.zigsrc/bun.js/uuid.zig
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/test/v8/v8.test.ts : Add corresponding test cases to test/v8/v8.test.ts using checkSameOutput() function to compare Node.js and Bun output
Applied to files:
src/bun.js/node/path.zigsrc/bun.js/uuid.zig
📚 Learning: 2025-11-12T04:11:52.293Z
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 24622
File: src/deps/uws/us_socket_t.zig:112-113
Timestamp: 2025-11-12T04:11:52.293Z
Learning: In Bun's Zig codebase, when passing u32 values to C FFI functions that expect c_uint parameters, no explicit intCast is needed because c_uint is equivalent to u32 on Bun's target platforms and Zig allows implicit coercion between equivalent types. This pattern is used consistently throughout src/deps/uws/us_socket_t.zig in functions like setTimeout, setLongTimeout, and setKeepalive.
Applied to files:
src/bun.js/node/path.zig
📚 Learning: 2025-09-25T18:39:03.607Z
Learnt from: nektro
Repo: oven-sh/bun PR: 22958
File: src/bun.js/api/crypto/EVP.zig:24-24
Timestamp: 2025-09-25T18:39:03.607Z
Learning: BoringSSL's translated bindings in src/deps/boringssl.translated.zig only provide EVP_blake2b256() and EVP_blake2b512() extern function declarations. EVP_blake2s256() does not exist in BoringSSL bindings, so blake2s256 algorithm support must rely on the EVP_get_digestbyname() fallback mechanism rather than direct function binding in the Algorithm.md() switch statement.
Applied to files:
src/bun.js/api/crypto/EVP.zig
📚 Learning: 2025-09-25T18:39:03.607Z
Learnt from: nektro
Repo: oven-sh/bun PR: 22958
File: src/bun.js/api/crypto/EVP.zig:24-24
Timestamp: 2025-09-25T18:39:03.607Z
Learning: BoringSSL does not provide EVP_blake2s256() function binding in Bun's codebase, unlike EVP_blake2b256() and EVP_blake2b512() which are available. For blake2s256 algorithm support, the correct approach is to rely on the EVP_get_digestbyname() fallback mechanism rather than adding a direct function binding to the Algorithm.md() switch statement.
Applied to files:
src/bun.js/api/crypto/EVP.zig
📚 Learning: 2025-11-24T18:36:38.104Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:38.104Z
Learning: Applies to src/**/*.zig : Private fields in Zig are fully supported using the `#` prefix: `struct { #foo: u32 };`
Applied to files:
src/url.zig
📚 Learning: 2025-10-15T22:03:50.832Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 23710
File: src/envvars.zig:135-144
Timestamp: 2025-10-15T22:03:50.832Z
Learning: In src/envvars.zig, the boolean feature flag cache uses a single atomic enum and should remain monotonic. Only the string cache (which uses two atomics: ptr and len) requires acquire/release ordering to prevent torn reads.
Applied to files:
src/url.zig
📚 Learning: 2025-11-24T18:35:39.205Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/registering-bun-modules.mdc:0-0
Timestamp: 2025-11-24T18:35:39.205Z
Learning: Applies to **/*js_bindings.classes.ts : Add JSDoc comments to JavaScript binding definitions in `.classes.ts` files
Applied to files:
src/css/properties/generate_properties.ts
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Generated code files are auto-generated from `.classes.ts` and other sources - Bun will automatically rebuild these files when you make changes to source files
Applied to files:
src/css/properties/generate_properties.ts
📚 Learning: 2025-10-13T06:54:58.043Z
Learnt from: robobun
Repo: oven-sh/bun PR: 0
File: :0-0
Timestamp: 2025-10-13T06:54:58.043Z
Learning: File extensions in Bun's module resolution are case-sensitive by design, and there are no existing precedents in the codebase for case-insensitive HTML file detection.
Applied to files:
src/which.zig
| fn eqlIgnoreCaseT(comptime T: type, a: []const T, b: []const T) bool { | ||
| if (T != u16) { | ||
| return bun.strings.eqlCaseInsensitiveASCII(a, b, true); | ||
| return bun.strings.eqlCaseInsensitiveASCII(a, b); | ||
| } | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Function is incomplete for T == u16.
The eqlIgnoreCaseT function only handles the T != u16 case. When T == u16, there's no return statement, which would cause a compile error if this code path were instantiated. However, tracing the call sites shows this function is only called with T = u8 in practice (via relative(), resolve(), etc.), so Zig never compiles the u16 branch.
For consistency with toLowerT (which handles both cases), consider either:
- Adding the u16 implementation, or
- Adding a
@compileErrorfor the u16 case to make the limitation explicit
This is a pre-existing issue, not introduced by this PR's migration to the unified API.
fn eqlIgnoreCaseT(comptime T: type, a: []const T, b: []const T) bool {
if (T != u16) {
return bun.strings.eqlCaseInsensitiveASCII(a, b);
}
+ if (a.len != b.len) return false;
+ for (a, b) |a_c, b_c| {
+ const a_lower: T = if (a_c < 128) @intCast(std.ascii.toLower(@intCast(a_c))) else a_c;
+ const b_lower: T = if (b_c < 128) @intCast(std.ascii.toLower(@intCast(b_c))) else b_c;
+ if (a_lower != b_lower) return false;
+ }
+ return true;
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| fn eqlIgnoreCaseT(comptime T: type, a: []const T, b: []const T) bool { | |
| if (T != u16) { | |
| return bun.strings.eqlCaseInsensitiveASCII(a, b, true); | |
| return bun.strings.eqlCaseInsensitiveASCII(a, b); | |
| } | |
| } | |
| fn eqlIgnoreCaseT(comptime T: type, a: []const T, b: []const T) bool { | |
| if (T != u16) { | |
| return bun.strings.eqlCaseInsensitiveASCII(a, b); | |
| } | |
| if (a.len != b.len) return false; | |
| for (a, b) |a_c, b_c| { | |
| const a_lower: T = if (a_c < 128) @intCast(std.ascii.toLower(@intCast(a_c))) else a_c; | |
| const b_lower: T = if (b_c < 128) @intCast(std.ascii.toLower(@intCast(b_c))) else b_c; | |
| if (a_lower != b_lower) return false; | |
| } | |
| return true; | |
| } |
| if (bun.strings.eqlCaseInsensitiveASCII(s, "none") or | ||
| bun.strings.eqlCaseInsensitiveASCII(s, "initial") or | ||
| bun.strings.eqlCaseInsensitiveASCII(s, "inherit") or | ||
| bun.strings.eqlCaseInsensitiveASCII(s, "unset") or | ||
| bun.strings.eqlCaseInsensitiveASCII(s, "default") or | ||
| bun.strings.eqlCaseInsensitiveASCII(s, "revert") or | ||
| bun.strings.eqlCaseInsensitiveASCII(s, "revert-layer")) |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Confirm eqlCaseInsensitiveASCII remains a full, length-respecting equality check
The replacements to bun.strings.eqlCaseInsensitiveASCII(s, "...") in both KeyframesName.parse and KeyframesName.toCss look mechanically correct, assuming the unified helper still enforces equal lengths and compares the entire string. If, instead, it only checks a prefix of s, identifiers like "noneX" or "initially" could start being treated as CSS-wide keywords, which would be a subtle behavior change.
Two follow-ups I’d recommend:
-
Verify helper semantics / tests
- Ensure
eqlCaseInsensitiveASCIIguarantees same-length, full-string ASCII case-insensitive equality. - If not already covered, consider tests that assert:
eqlCaseInsensitiveASCII("none", "NoNe") == trueeqlCaseInsensitiveASCII("noneX", "none") == false- Similar for
"initial","inherit","unset","default","revert","revert-layer".
- Ensure
-
(Optional) Factor keyword check into a shared helper
Both branches now duplicate the same chain of checks. A small local helper likeisKeyframesCssWideKeywordIgnoreCase(s: []const u8) boolreused inparseandtoCsswould keep the keyword list single-sourced and reduce the chance of them diverging if new CSS-wide keywords need to be handled later.
Also applies to: 141-147
🤖 Prompt for AI Agents
In src/css/rules/keyframes.zig around lines 111-117 (and similarly 141-147), the
replacement calls to bun.strings.eqlCaseInsensitiveASCII must be confirmed to
perform full-length, whole-string ASCII case-insensitive equality (not
prefix-only); verify the helper's semantics and, if it currently allows prefix
matches, update it so it checks lengths and full contents. Add unit tests
asserting true for eqlCaseInsensitiveASCII("none","NoNe") and false for
eqlCaseInsensitiveASCII("noneX","none") (and equivalent tests for
"initial","inherit","unset","default","revert","revert-layer"). Also optionally
factor the repeated keyword chain into a single helper (e.g.,
isKeyframesCssWideKeywordIgnoreCase(s: []const u8) bool) and use it in both
KeyframesName.parse and KeyframesName.toCss to avoid duplication.
| /// Note that this function performs bound checks, but is marked as inline, so the caller may also | ||
| /// perform bounds checks without a performance penalty. |
There was a problem hiding this comment.
Does this comment apply considering std.ascii.eqlIgnoreCase is not marked inline?
There was a problem hiding this comment.
Should we just replace all uses of eqlCaseInsensitiveASCII with std.ascii.eqlIgnoreCase?
|
Closing as stale: this PR predates the Rust rewrite. Every If the underlying change is still wanted, it will need to be redone against the current Rust/C++ tree. Apologies for the churn, and thank you for the contribution. |
What does this PR do?
Removes redundant
eqlCaseInsensitiveASCIIvariants.How did you verify your code works?
CI.