Repository navigation
fix: Fix nested block duplication bumping parent stack - #10682
Open
matthewalberto wants to merge 1 commit into
Open
matthewalberto wants to merge 1 commit into
matthewalberto wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Welcome! It looks like this is your first pull request in Blockly, so here are a couple of tips:
- You can find tips about contributing to Blockly and how to validate your changes on our developer site.
- We use conventional commits to make versioning the package easier. Make sure your commit message is in the proper format or learn how to fix it.
- If any of the other checks on this PR fail, you can click on them to learn why. It might be that your change caused a test failure, or that you need to double-check the style guide.
Thank you for opening this PR! A member of the Blockly team will review it soon.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The basics
The details
Resolves
Fixes #10675.
Proposed Changes
Prevent duplicate blocks from triggering unintended stack adjustments during their initial render.
Defer bumping other blocks until after the duplicate has been positioned.
Preserve the initial render step so Blockly can calculate the duplicate's connection positions correctly.
Add regression tests covering duplication of nested blocks with children.
Reason for Changes
When duplicating a block nested inside another block, the duplicate initially appears directly on top of the original. Blockly is expected to move the duplicate down and to the right.
Previously, Blockly performed bumping during the initial render, before repositioning the duplicate. Because the duplicate's edges aligned with the original block's interior, the original stack was bumped instead, leaving the duplicate in its initial position.
Deferring bumping until after repositioning ensures that the correct blocks are moved.
Test Coverage
Full test suite: Added 4 regression tests. The original implementation fails 3 of the 4 new tests and passes 4044 tests overall. With this fix, all 4047 tests pass.
Mutation testing: All 7 deliberate breakages were caught. An additional test was added after one breakage escaped the initial run.
Lint and formatting: Clean on all 3 changed files. The only failure in the wider lint run is caused by Windows line endings in unrelated files; CI runs on Linux.
Not tested: Real-browser behavior, Linux locally, and alternative renderers.
Documentation
No documentation changes are needed.
Additional Information
Claude Code (Claude Opus 5.5) was used collaboratively throughout the process, including reproducing the bug, implementing the fix, writing the four regression tests, and performing validation checks. All PR description text was written independently by the human contributor.