Consolidate @supports gating checks and fix ungated color-mix() in components - #565
Consolidate @supports gating checks and fix ungated color-mix() in components #565jackgranatowski wants to merge 2 commits into
Conversation
Full-tree audit follow-up: patch the latent holes where a future PR could drift or degrade without any gate noticing. Generated-artifact gates: - artifacts.json: add configurator/src/data/classes.generated.json (was emitted by sync-api.mjs but absent from outputs, so unguarded). - artifacts.json: register demos/ (full-api-demo*.html, ultimate-override.css) as a guarded artifact; the committed copies had drifted since v0.7.0. - check-artifacts.js: fail loudly when a declared output is not git-tracked, instead of a git-diff no-op silently passing an ignored path. Browser-compat @supports gating: - components.css: wrap the .sf-btn--secondary/--ghost hover color-mix() tint in @supports; it was an ungated modern expression in a plain declaration. - tests: fix the P7 old-engine scanner (char/paren-based) so an @supports prelude containing braces (the @Property feature-query form) is stripped correctly; the old line-based scanner only passed by last-wins luck. - tests: extend P2 to all core/optional source files and P7 to every declaration (not just --sf-* custom props); share one scanner via tests/supports-helpers.js so the two can't drift. Tooling robustness / hidden coupling: - extract.js + gen-class-reference.js: fail with an actionable message when a registry-sources.js file lacks a FILE_META/title entry, not an opaque TypeError. - gen-class-reference.js: reuse lib/parse.js stripComments/stripStrings instead of a divergent inline copy; drop the dead prefix field. - lib/parse.js: handle backslash escapes in stripStrings/maskStrings. Boundary + housekeeping: - add tests/configurator-data-contract.test.js pinning the shape of the vendored configurator data files. - package.json: drop lightningcss from devDependencies (kept in optionalDependencies); resync lock. - docs: clarify build-derived rows in the CLAUDE.md version table; mark analysis/ and reports/full-api-audit/ ownership/status. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mxc1F7deC8GbWntXZ4gXkG
|
Warning Review limit reached
Next review available in: 48 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: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (18)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoConsolidate @supports gating scanner; fix ungated color-mix() in components.css
AI Description
Diagram
High-Level Assessment
Files changed (17)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
12 rules 1.
|
Address Qodo review on PR #565: stripSupports() in tests/supports-helpers.js brace/paren-counted without skipping quoted strings, so a `{`, `}`, `(` or `)` inside a string literal (content values, url("data:…(…)…"), etc.) could perturb the depth/paren counters and strip the wrong region — leaking a gated declaration or removing an ungated one across both P2 and P7. - Add a backslash-aware skipString() and apply it in all three scan contexts (the top-level copy loop, the prelude paren scan, the body brace scan), so string contents never trigger @supports detection or affect counting. Mirrors findMatchingBrace() in scripts/bundle.js. - Text outside removed @supports blocks is preserved verbatim (strings are not globally rewritten), so P7's declaration extraction on the stripped output is unchanged. - Add tests/supports-helpers.test.js pinning the prelude-brace, string-brace, prelude-string-paren, and string-embedded-@supports cases. No change to stripping of the current bundle/source (still 0 ungated). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mxc1F7deC8GbWntXZ4gXkG
|
This PR was already merged into The web merge succeeded at the git level but the request errored before GitHub could flip the PR status, leaving it stuck as "Open". Because the code is already in Generated by Claude Code |
Revert "Merge pull request #565" (re-merge as fresh PR)
Summary
Consolidates the fragmented @supports-gating validation logic into a shared, robust scanner (
tests/supports-helpers.js), expands P2 coverage fromtokens.cssalone to all source CSS files, and fixes an ungatedcolor-mix()declaration inoptional/components.cssthat violated the framework's modern-expression gating policy.Key changes
New shared scanner (
tests/supports-helpers.js): ImplementsstripSupports()andfindUngatedModernExpressions()helpers that are character-based, parenthesis-aware, and comment-stripped. Replaces the line-based scanner in P7 that historically miscounted braces inside@supportsprelude expressions (e.g.,@propertyfeature queries).Expanded P2 coverage (
tests/tier1-p2-coverage.test.js): Now scans allcore/*.cssandoptional/*.cssfiles (not justtokens.css), catching modern expressions used directly in component/utility rules, not only in colour tokens. Uses the shared scanner so P2 and P7 can never drift.New P7 whole-bundle guard (
tests/tier1-p7-oldengine.test.js): Adds a second check that scans every declaration in the built bundle (custom properties AND plain properties), complementing the existing custom-property-only checks.Fixed ungated color-mix() (
optional/components.css): Wrapped the.sf-btn--secondary:hoverand.sf-btn--ghost:hovercolor-mix()background declarations in an@supportsblock, with explanatory comment linking to the framework-wide gating policy.New contract test (
tests/configurator-data-contract.test.js): Validates that generated configurator data files (api-index.generated.json,classes.generated.json,bundles.generated.json,token-registry.generated.json) maintain their required schema — required keys present on every row, non-empty catalogues. Catches silent shape changes that would break the vendored plugin.Improved error messages: Added
metaFor()helper inscripts/lib/api-index/extract.jsthat fails loudly when a source file is added toregistry-sources.jsbut lacks aFILE_METAentry, instead of the opaqueCannot read properties of undefinedcrash. Same pattern applied toscripts/gen-class-reference.jswithFILE_TITLES.Enhanced string literal handling (
scripts/lib/parse.js): FixedstripStrings()andmaskStrings()regexes to honour backslash escapes (e.g.,content: "\"") so escaped quotes inside strings don't end the match early.Artifact tracking safeguard (
scripts/check-artifacts.js): Added validation that declared artifact outputs are git-tracked; untracked/ignored files now fail loudly instead of silently bypassing the freshness check.Updated artifact registry (
scripts/artifacts.json): Addedclasses.generated.jsonand the full-api demos (demos/generate.mjsoutputs) to the tracked artifacts list.Documentation updates: Clarified version-sync ownership in
CLAUDE.md, added status headers toreports/full-api-audit/REPORT.mdandanalysis/gap-analysis.mdexplaining their manual/historical nature, and improved comments inscripts/gen-class-reference.jsandscripts/lib/parse.js.Removed unused dependency: Removed
lightningcssfrompackage.jsondevDependencies (no longer used in the build).Implementation notes
stripSupports()scanner is character-based and tracks parenthesis depth to correctly identify the body-opening{at depth 0, avoiding the historical P7 bug where braces inside@supportsprelude expressions (like@propertyfeature queries) were miscounted.@supportstext cannot steer the scan.https://claude.ai/code/session_01Mxc1F7deC8GbWntXZ4gXkG