Repository navigation
Conversation
…f dropping the later one
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
Comment |
|
Updated 1:44 PM PT - Jul 7th, 2026
✅ @robobun, your commit d0be8999bf868a7ca7cf263f5e66e4452658f5df passed in 🧪 To try this PR locally: bunx bun-pr 33680That installs a local version of the PR into your bun-33680 --bun |
|
Found 1 issue this PR may fix:
🤖 Generated with Claude Code |
There was a problem hiding this comment.
LGTM — two-line fix mirroring the @media arm right above it, with good test coverage.
Extended reasoning...
Overview
This PR fixes a CSS bundler bug where adjacent @supports rules with the same condition had the second rule's contents silently dropped. The fix is a two-line change in src/css/rules/mod.rs that appends the later rule's children into the earlier one before discarding the shell — exactly matching the CssRule::Media arm ~10 lines above (and upstream lightningcss). Five new test cases in test/js/bun/css/css.test.ts cover non-minified output, 2- and 3-way merges, different-condition rules staying separate, and the nested-inside-selector case from #24770.
Security risks
None. This is pure CSS AST transformation with no user input validation, filesystem, network, or auth surface. The change only affects which child rules survive a merge pass.
Level of scrutiny
Low. The fix is mechanical: it copies the exact pattern from the @media arm in the same match block, adjusted only for SupportsRule::minify returning Result<(), _> instead of Result<bool, _> (hence no let _ =). The old comment ("Drop the duplicate-condition rule outright") confirms this was a porting oversight, not intentional behavior. The PR description shows the tests fail on system Bun and pass on the debug build.
Other factors
No CODEOWNERS for src/css/. No prior review comments on the PR. Full css.test.ts (1124 tests) and test/bundler/esbuild/css.test.ts (53 tests) reported passing. No bugs found by the bug-hunting system. The test cases follow the existing minify_test/cssTest conventions in the file.
|
#38589 makes |
|
Closing in favor of #38589, which carries this branch's two commits unchanged (the two-line append-and-minify in the Checked at #38589's head (fee67d6): the assertions from this PR pass there apart from that spelling difference, and the exact input from #24770 (five nested |
Fixes #24770
What
bun build/Bun.buildon CSS silently deletes the contents of the second of two adjacent@supportsrules with the same condition. This happens on the default path (no--minify) because the rule-merge pass runs unconditionally.Reproduction
Output before:
Adjacent same-condition
@supportsblocks are exactly what autoprefixer, utility layers, and the bundler's own@import supports(...)handling emit, so this is silent style loss on real stylesheets. The same happens for@supportsnested inside a style rule (#24770's Tailwind case).Cause
CssRuleList::minify(src/css/rules/mod.rs) merges adjacent at-rules with identical conditions. TheCssRule::Mediaarm appends the later rule's children into the earlier rule before discarding the shell:The
CssRule::Supportsarm ten lines below lost the append during the lightningcss port and justbreak 'arms, discarding the later rule with all its contents.Fix
Append the later
@supportsrule's children into the earlier one and re-minify the merged block, matching the@mediaarm and upstream lightningcss.Verification
New
describe("supports")block intest/js/bun/css/css.test.tscovers: non-minified output preserves both rules merged into one block, minified output for two and three adjacent same-condition rules, a different-condition pair stays as two rules, and the nested-inside-selector case from #24770.Full
css.test.ts(1124 tests) andtest/bundler/esbuild/css.test.ts(53 tests) pass.