css: bound raw-token expansion when compiling nesting for older targets - #32453
Open
robobun wants to merge 8 commits into
Open
css: bound raw-token expansion when compiling nesting for older targets#32453robobun wants to merge 8 commits into
robobun wants to merge 8 commits into
Claude / Claude Code Review
completed
Jun 17, 2026 in 41m 17s
Code review found 3 potential issues
Found 4 candidates, confirmed 3. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 2 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/css/rules/style.rs:412 |
Token cap misses additional TokenList carriers: @container style() conditions and selector CustomFunction args |
| 🟡 Nit | src/css/rules/style.rs:392 |
Token charge skipped at multiplier==1, but top-level partition still clones declarations N times |
Annotations
Check warning on line 412 in src/css/rules/style.rs
claude / Claude Code Review
Token cap misses additional TokenList carriers: @container style() conditions and selector CustomFunction args
Beyond `CssRule::Unknown` (above), `self.declarations.token_weight()` also misses two more `TokenList` carriers in the same `sty.rules.deep_clone()` subtree that the Unknown-specific fix wouldn't cover: (1) `@container style(--foo: x x …)` — `StyleQuery::Feature(Box<Property::Custom>)` is deep-cloned via `ContainerRule::deep_clone` but the `Container` arm of `CssRuleList::minify` only recurses into `cont.rules` and never charges the condition (likewise `MediaFeatureValue::Env` fallbacks in `@med
Check warning on line 392 in src/css/rules/style.rs
claude / Claude Code Review
Token charge skipped at multiplier==1, but top-level partition still clones declarations N times
The new token charge sits inside the existing `if context.selector_expansion_multiplier > 1` guard, so a flat top-level rule (multiplier == 1) never charges — but `minify_style_arm` still partitions an N-selector incompatible list into N `decl_block_static` clones. A 2,000-selector `:user-valid` list with a ~10K-token `--foo` value (~50 KB input, chrome 80) clones ~1.4 GB of `Vec<TokenOrValue>` while `token_expansion_total` stays 0; `copies × weight = 20M` would correctly trip the new cap if it
Loading