Theme: Make chroma capacity caching deterministic - #82505
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughUpdated theme color tokens, default color ramps, generated fallback values, and chroma cache quantization. Added a regression test and changelog entry for cache-order-independent ramp generation. ChangesTheme color system
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This update makes color-ramp cache results independent of cache population order and refreshes the corresponding theme token outputs. No current merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (4 skipped: 4 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
packages/theme/prebuilt/css/design-tokens.cssESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. packages/theme/prebuilt/js/design-token-fallbacks.mjsESLint skipped: the matched ESLint configuration already failed (missing-dependency). packages/theme/src/color-ramps/lib/default-ramps.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency).
Comment |
There was a problem hiding this comment.
These are the main code changes, the rest is either tests or regenerated snapshots / prebuilt assets
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
🤖 PR meta 🤖📦 Bundle sizeSize Change: -228 B (0%) Total Size: 8 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
|
Follow up to #82294 (comment).
What?
Make the
taperChromacapacity cache deterministic while keeping its rounded cache buckets.Why?
The cache key rounds lightness, hue, and the chroma cap, but trunk calculates the cached value from the first unrounded input in that bucket. The same ramp can therefore get a different result depending on which theme populated the cache first.
How?
Calculate each cached chroma capacity at the rounded lightness and hue represented by its key. Keep the hard chroma cap exact. A regression test checks that an unrelated input in the same bucket cannot change a later result. Generated ramps and token files are rebuilt from the corrected calculation.
Performance
The existing
background ramp snapshotsunit test was run in a separate process 11 times on each revision.929bded78c7)8182a53b855)An exact-key prototype had a 541 ms median across nine runs, 117% slower than trunk on the same workload. Calculating at the rounded point fixes the order dependence without losing the useful cache hits.
Testing Instructions
npm run test:unit:vitest -- packages/theme/src/color-ramps/test.Testing Instructions for Keyboard
Not applicable. This change has no user interface.
Use of AI Tools
OpenAI Codex helped isolate the change, write the regression test, measure performance, regenerate derived files, and draft this description. The author reviewed the implementation and results.