Conversation
Merge origin/main into origin/dev
* fix: shape gradient interpolation issue * chore: update
docs: changelog 2.8.11
📝 WalkthroughWalkthroughThis PR releases version 2.8.11 as a patch, addressing a shape gradient interpolation issue. Changes include version bumps across multiple packages, updates to changelogs documenting the fix, modifications to Husky hook scripts, and refactoring of gradient computation logic to properly handle edge cases. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/effects-core/src/utils/color.ts (1)
50-62: Optional: the fallback initialization on Line 51 is unreachable.In the
elsebranch,stops[0].time < key < stops[stops.length - 1].time, so with sorted stops at least one adjacent pair(s0, s1)must satisfys0.time <= key <= s1.timeand the loop will always assigncolor. The pre-loopcolor = stops[stops.length - 1].color.toArray();is effectively dead defensive code and can be dropped (declaringlet color: number[];is sufficient since TS will be satisfied once the loop provably assigns — or an explicit unreachable assertion could be used). Non-blocking.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/effects-core/src/utils/color.ts` around lines 50 - 62, Remove the unreachable defensive initialization before the loop: declare color without assigning (e.g., let color: number[];) instead of setting color = stops[stops.length - 1].color.toArray(); then rely on the for-loop that checks adjacent stop pairs (using stops, key, s0.time/s1.time and interpolateColor) to assign color and break; this removes the dead fallback assignment while keeping the same interpolation logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/effects-core/src/utils/color.ts`:
- Around line 50-62: Remove the unreachable defensive initialization before the
loop: declare color without assigning (e.g., let color: number[];) instead of
setting color = stops[stops.length - 1].color.toArray(); then rely on the
for-loop that checks adjacent stop pairs (using stops, key, s0.time/s1.time and
interpolateColor) to assign color and break; this removes the dead fallback
assignment while keeping the same interpolation logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 926cffd4-4077-4f2b-b3f5-b2d6ef65b581
⛔ Files ignored due to path filters (1)
packages/effects-core/src/plugins/shape/shaders/shape.frag.glslis excluded by!**/*.glsl
📒 Files selected for processing (23)
.husky/commit-msg.husky/pre-commitCHANGELOG-zh_CN.mdCHANGELOG.mdpackages/effects-core/package.jsonpackages/effects-core/src/math/value-getters/value-getter.tspackages/effects-core/src/utils/color.tspackages/effects-core/src/utils/image-data.tspackages/effects-helper/package.jsonpackages/effects-threejs/package.jsonpackages/effects-webgl/package.jsonpackages/effects/package.jsonplugin-packages/alipay-downgrade/package.jsonplugin-packages/downgrade/package.jsonplugin-packages/editor-gizmo/package.jsonplugin-packages/ffd/package.jsonplugin-packages/ktx2/package.jsonplugin-packages/model/package.jsonplugin-packages/multimedia/package.jsonplugin-packages/orientation-transformer/package.jsonplugin-packages/rich-text/package.jsonplugin-packages/spine/package.jsonplugin-packages/stats/package.json
💤 Files with no reviewable changes (2)
- .husky/commit-msg
- .husky/pre-commit
There was a problem hiding this comment.
Pull request overview
This PR merges changes from origin/main into origin/feat/2.9, bumping package versions and updating gradient interpolation behavior in both CPU-side utilities and the shape fragment shader.
Changes:
- Bump multiple workspace packages/plugins from
2.8.10to2.8.11. - Fix gradient interpolation/clamping logic across TS utilities/value-getters and the shape fragment shader.
- Update changelogs for
2.8.11and adjust Husky hook scripts.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| plugin-packages/stats/package.json | Version bump to 2.8.11 |
| plugin-packages/spine/package.json | Version bump to 2.8.11 |
| plugin-packages/rich-text/package.json | Version bump to 2.8.11 |
| plugin-packages/orientation-transformer/package.json | Version bump to 2.8.11 |
| plugin-packages/multimedia/package.json | Version bump to 2.8.11 |
| plugin-packages/model/package.json | Version bump to 2.8.11 |
| plugin-packages/ktx2/package.json | Version bump to 2.8.11 |
| plugin-packages/ffd/package.json | Version bump to 2.8.11 |
| plugin-packages/editor-gizmo/package.json | Version bump to 2.8.11 |
| plugin-packages/downgrade/package.json | Version bump to 2.8.11 |
| plugin-packages/alipay-downgrade/package.json | Version bump to 2.8.11 |
| packages/effects/package.json | Version bump to 2.8.11 |
| packages/effects-webgl/package.json | Version bump to 2.8.11 |
| packages/effects-threejs/package.json | Version bump to 2.8.11 |
| packages/effects-helper/package.json | Version bump to 2.8.11 |
| packages/effects-core/src/utils/image-data.ts | Update gradient texture generation logic (clamping/interpolation) |
| packages/effects-core/src/utils/color.ts | Adjust gradient stop handling and clamped lookup behavior |
| packages/effects-core/src/plugins/shape/shaders/shape.frag.glsl | Fix shape gradient interpolation/clamping in fragment shader |
| packages/effects-core/src/math/value-getters/value-getter.ts | Clamp gradient value getter for empty/out-of-range times |
| packages/effects-core/package.json | Version bump to 2.8.11 |
| CHANGELOG.md | Add 2.8.11 entry and minor formatting fix |
| CHANGELOG-zh_CN.md | Add 2.8.11 entry and punctuation/formatting fix |
| .husky/pre-commit | Remove Husky header; leave lint-staged invocation |
| .husky/commit-msg | Remove Husky header; leave commitlint invocation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| PATH=$PATH:/usr/local/bin:/usr/local/sbin | ||
| npx commitlint --edit "$1" |
There was a problem hiding this comment.
The hook file no longer has a shebang. Git executes hooks as standalone executables; without a shebang (e.g. #!/usr/bin/env sh) this can fail with an “Exec format error” on POSIX systems. Add the shebang back (and ensure the file remains executable) so the hook reliably runs across environments.
| PATH=$PATH:/usr/local/bin:/usr/local/sbin | ||
| npx lint-staged |
There was a problem hiding this comment.
The hook file no longer has a shebang. Git executes hooks as standalone executables; without a shebang (e.g. #!/usr/bin/env sh) this can fail with an “Exec format error” on POSIX systems. Add the shebang back (and ensure the file remains executable) so the hook reliably runs across environments.
Summary by CodeRabbit
Release Notes – Version 2.8.11
Bug Fixes
Chores