Bugfix: Apply transformations to correct mesh when duplicated - #740
Conversation
📝 WalkthroughWalkthroughVariable descendant traversal now follows each connected ChangesVariable traversal
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
blocks/blocks.js (1)
755-768: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a regression test for sequential descendant traversal.
The supplied test in
tests/blocks.test.jsat Lines 120-156 does not cover a variable field in an input-connectedgetNextBlock()sibling or its nested inputs. Add a test that duplicates a block with two transformation blocks and verifies that both fields use the new variable ID.As per coding guidelines, include API tests in the implementation plan and run automated tests where possible.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@blocks/blocks.js` around lines 755 - 768, Add a regression test in the existing blocks duplication test area covering sequential descendants reached through an input connection: build two transformation blocks with a variable field, including nested input descendants, duplicate the root, and assert both copied fields reference the new variable ID rather than the original. Include the API test in the implementation plan and run the relevant automated tests.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@blocks/blocks.js`:
- Around line 755-768: Add a regression test in the existing blocks duplication
test area covering sequential descendants reached through an input connection:
build two transformation blocks with a variable field, including nested input
descendants, duplicate the root, and assert both copied fields reference the new
variable ID rather than the original. Include the API test in the implementation
plan and run the relevant automated tests.
Summary
Fixed a bug where if you duplicated a mesh which had >1 transformation applied (e.g. resize and rotate), the copy would have two transform blocks applied but the second would target the original mesh.
Previous behaviour:

AI usage
Claude Sonnet 5 found the bug and fixed. I identified it during manual testing.
Summary by CodeRabbit