Skip the colour regexp on comma-free shorthands, return sanitized media types as-is: −7% objects, −4% CPU #195
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 292 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.340
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #195"
general
weight: 0.35
grosser
The smaller sister of #194, two independent bits that are each too small for a PR of their own.
Shorthands first.
expand_dimensions_shorthand!ranRE_COLOUR, the alternation of every named colour, over each margin, padding and border value, only to collapse the spaces around commas insidergb()/hsl(). Without a comma that replacement is the identity, so it's now skipped when the value has no,, along with thedupit no longer needs.create_dimensions_shorthand!,compute_dimensions_shorthandandcreate_shorthand_properties!also stop building throwaway arrays, enumerators andzippairs: they read the four sides directly and compare them with==.Then media types.
add_rule_set!sanitizes the media types of every rule. For:all, or any symbol already in sanitized form, that meantto_s,gsub,strip!andto_symjust to get the same symbol back. Such a symbol is now returned as-is.UNSANITIZED_MEDIA_QUERY_RXlists exactly what the slow path would change: blank, padded, or not separated by single spaces. Two crumbs ride along:calculate_specificitycounts ids withcount('#'), andparse_selectors!maps in place.Median of 8 interleaved runs, Ruby 4.0.9, premailer 1.30.0, nokogiri 1.19.4:
| | objects | CPU |
|---|---|---|
| our 336 transactional emails through premailer | 13,592 → 12,666 (−7%) | −4% |
| Mastodon's mailer CSS, parsed then merged | 40,702 → 37,496 (−8%) | −5% |
| premailer's own test files | 28,502 → 26,590 (−7%) | −5% |
|
rake benchmark, complex.css | 8,459 → 7,941 (−6%) | ≈ |All three corpora give byte-for-byte identical output. The 360,000-input differential fuzz against master covers shorthands,
sanitize_media_queryon strings and symbols, specificity and selector parsing, with no difference found. Both new tests fail on master: creating margin and padding shorthands takes 39 objects there and 25 here, sanitizing:alltakes 3 there and 0 here. The suite passes on Ruby 3.3 and 4.0, and RuboCop is clean.Two heads-ups. Only CHANGELOG.md conflicts with #194, and I'll rebase whichever lands last. #184 also touches
parse_selectors!, which makes one trivial line to resolve.Pre-Merge Checklist
---
🤖 Generated with Claude Code, but prompted, read, and verified by @czj, a caring human :)