Add PostCSS CSS hygiene guard for deprecated syntax and bare colors
Please comment to claim before starting; check current assignees and linked PRs.
Context
Neo already enforces vendor-prefix discipline (buildScripts/util/check-css-vendor-prefixes.mjs, tested by test/playwright/unit/buildScripts/checkCssVendorPrefixes.spec.mjs and wired into .github/workflows/pr-baseline.yml) plus eight theme-architecture guards (theme-census, check-theme-palette, check-theme-surfaces, check-theme-property-prefix, check-theme-class-prefix, check-theme-coverage, check-theme-radius-literals, check-theme-var-references). However, none of those guards currently catch obsolete WebKit syntax (-webkit-gradient, -webkit-fill-available, -webkit-overflow-scrolling), deprecated CSS 2.1 clip: rect(...), double-semicolon typos (;;), !important inside theme custom-property declarations, or Sass-compiled multi-decimal percentage rgb(...) literals. This leaf adds a dedicated PostCSS CSS hygiene guard under #23186 so cleaned-up patterns cannot regress.
The Problem
Our audit across resources/css/ found legacy patterns that silently pass every existing CI check:
-webkit-gradient(...)(4files),-webkit-fill-available(1file),-webkit-overflow-scrolling(1file) — explicitly left out ofcheck-css-vendor-prefixes.mjs(which focuses onautoprefixer-owned properties and prefix-after-standard cascade bugs).- Deprecated
clip: rect(...)(8files underresources/css/src/). - Double-semicolon declaration typos (
;;incalendar/view/week/Component.css:90andgrid/header/Button.css:87). !importantinside theme custom-property declarations (resources/css/theme-classic/util/HighlightJsLineNumbers.css:5,12).- Sass-compiled high-precision percentage
rgb(91.2429971989%, ...)literals (60occurrences acrossapps/colors/GridContainer.css,theme-classic/, andtheme-neo/).
Without an AST-level PostCSS guard (with an explicit shrinking baseline ratchet), contributors and agents can accidentally re-introduce these legacy patterns in future PRs.
The Architectural Reality
buildScripts/util/check-css-vendor-prefixes.mjs provides the exact architectural blueprint:
- Exports
SCAN_SURFACE = Object.freeze(['resources/css/**/*.css'])(consumed bypr-baseline.ymlchange classification). - Parses every CSS file via
postcss(themeCss.mjs'scssFiles()helper) and exports pure check functions for unit testing intest/playwright/unit/buildScripts/. - Runs via
package.json(check-css-*script) and.github/workflows/pr-baseline.ymlbaseline matrix. - Existing guards like
check-theme-radius-literals.mjsandcheck-theme-coverage.mjsuse explicit, stale-failing baseline allowlists (if an allowlisted file is fixed and no longer violates, the guard fails until the stale allowlist entry is removed, ratcheting debt strictly downward).
Because sibling cleanup leaves under #23186 may land before or after this guard, using a strictly ratcheting baseline allowlist lets this guard land immediately without waiting on every CSS cleanup PR — rejecting any new violation on day 1 and forcing each cleanup PR to remove its cleared entries.
Design authority: buildScripts/util/check-css-vendor-prefixes.mjs (existing PostCSS CI guard architecture) and operator direction (2026-12-03, Epic #23186: prevent legacy CSS regressions without micro-PR churn).
The Fix
- Create
buildScripts/util/check-css-hygiene.mjs:- Export
SCAN_SURFACE = Object.freeze(['resources/css/**/*.css'])and pure PostCSS AST checker functions (mirroringcheck-css-vendor-prefixes.mjs). - Flag the following offence kinds with
file:line,kind, and actionable guidance:obsolete-webkit-syntax:-webkit-gradient(...)in any declaration value,-webkit-fill-availablein any value, and-webkit-overflow-scrollingproperty.deprecated-clip:clip: rect(...)declarations (suggestclip-path: inset(50%)).double-semicolon: empty/trailing;;declarations in raw source (decl.raws.between/ empty tokens or PostCSS source slice check, ignoring strings/comments).important-custom-property:!importanton any--neo-*custom property declaration insideresources/css/theme-*/.sass-percentage-rgb: high-precision Sass-emittedrgb(NN.NNNN%, ...)literals (3+decimal places in percentagergb()).
- Include a minimal, explicit
HYGIENE_BASELINEmap keyed by<repo-relative-file>|<kind>for any pre-existing offences still open at the time the PR lands; fail CI if a baseline entry is stale (no longer present) so sibling PRs ratchet the baseline strictly toward zero.
- Export
- Wire CLI & CI:
- Add
"check-css-hygiene": "node ./buildScripts/util/check-css-hygiene.mjs"topackage.jsonscripts (and the aggregate check list alongsidecheck-css-vendor-prefixes.mjs). - Register the check in
.github/workflows/pr-baseline.ymlbeside"CSS vendor prefixes".
- Add
- Add unit tests:
- Add
test/playwright/unit/buildScripts/checkCssHygiene.spec.mjscovering every offence kind (positive hits, clean modern alternatives likelinear-gradient(...)andclip-path: inset(50%), comment/string non-matches, stale-baseline detection, and a live pass on the repository).
- Add
Contract Ledger
| Target Surface | Source of Authority | Proposed Behavior | Fallback | Docs | Evidence |
|---|---|---|---|---|---|
npm run check-css-hygiene (buildScripts/util/check-css-hygiene.mjs) |
package.json + this ticket |
Parses resources/css/**/*.css with PostCSS; exits 0 when zero un-baselined offences and zero stale baseline entries exist; exits 1 otherwise |
None (new opt-in baseline guard; pre-existing debt tracked in shrinking allowlist) | Inline module JSDoc + buildScripts/README.md if check list documented there |
test/playwright/unit/buildScripts/checkCssHygiene.spec.mjs |
.github/workflows/pr-baseline.yml |
PR baseline matrix | Runs check-css-hygiene.mjs on PRs touching SCAN_SURFACE (resources/css/**/*.css) |
Standard pr-baseline job failure output with file:line fix instructions |
Workflow step name "CSS hygiene" |
prBaseline.spec.mjs + CI green run |
Acceptance Criteria
- [ ]
buildScripts/util/check-css-hygiene.mjsexportsSCAN_SURFACEand pure PostCSS AST checkers catchingobsolete-webkit-syntax,deprecated-clip,double-semicolon,important-custom-property, andsass-percentage-rgb, with zero false positives inside CSS comments or quoted strings. - [ ] Any remaining unfixed pre-existing files at PR time are recorded in an explicit ratcheting baseline allowlist that fails when an allowlisted entry becomes stale (or the allowlist is empty if all sibling leaves have already landed).
- [ ]
package.jsonexposesnpm run check-css-hygieneand.github/workflows/pr-baseline.ymlinvokes it alongsidecheck-css-vendor-prefixes.mjs. - [ ]
test/playwright/unit/buildScripts/checkCssHygiene.spec.mjspasses vianpx playwright test --config=test/playwright/playwright.config.unit.mjs test/playwright/unit/buildScripts/checkCssHygiene.spec.mjsandtest/playwright/unit/buildScripts/prBaseline.spec.mjsstays green. - [ ]
npm run check-css-hygieneandnpm run check-css-vendor-prefixesboth exit0against the current repo.
Out of Scope
- Fixing the underlying CSS files in
resources/css/(owned by sibling cleanup leaves under #23186; this PR only adds the guard, tests, and CI wiring). - Enforcing physical-vs-logical RTL CSS properties globally (many canvas/splitter/3D/dock rules legitimately require physical
left/right, so a blanket static ban would create noisy false positives).
Avoided Traps
- Do not use naive regex scanning on raw file text for
clip: rector;;— comments and data URLs cause false positives. Use PostCSS AST traversal (just likecheck-css-vendor-prefixes.mjs). - Do not break
prBaseline.spec.mjs(which validates.github/workflows/pr-baseline.ymlentries andSCAN_SURFACEexports). - Do not prohibit
-webkit-box-reflectitself; only forbid the obsolete-webkit-gradient(...)value inside it (linear-gradient(...)stays valid).
Related
- Refs #23186
Live latest-open + closed sweep: checked latest 20 open issues (including #23185, #23180, #23179), open/closed CSS/RTL searches (53 open issues, red band), A2A in-flight claims, query_raw_memories + ask_knowledge_base, and own assignments at 2026-12-03T02:43Z; no duplicate exists.
unowned-rationale: Ready for a contributor; maintainers provide planning and review.
Origin Session ID: d3b824ff-9083-4a90-af0d-da54110872be
Retrieval Hint: "check-css-hygiene PostCSS CI guard pr-baseline deprecated clip rect webkit-gradient double semicolon"
I would like to claim this. I will add buildScripts/util/check-css-hygiene.mjs with the ratcheting HYGIENE_BASELINE, the check-css-hygiene npm script, the Playwright unit spec, and the pr-baseline.yml wiring.
Thanks for claiming this, @Beehtrix, and welcome back! Assigned to you — you can start now.
Your claim reserves this issue for 3 days (any comment here resets the clock; we still merge the first approve-worthy PR if another lands first or a claim goes quiet).
An automatic reply. How claims work