Repository navigation
Conversation
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.
lizschwab
left a comment
There was a problem hiding this comment.
Thanks for taking this on! I took a look at your PR and had a few small changes I'd like to see applied. There are four comments that start with "Nit"; these are nit-picks and can be applied if you like but I would not hold back an approval on them. The rest should be addressed.
I pulled down the changes and tested them locally using the repro steps in the bug ticket. They do resolve the issue (see screen recording below).
Screen.Recording.2026-11-13.at.3.28.39.PM.mov
As a side note, the PR comments read a bit like an LLM either drafted them or polished them. In the future, it would help us out if these comments be written in your own words. If you need to use an LLM for translation or spelling/grammar check, that's fine, but for writing your pull request summary we'd prefer more natural language. Please see our AI policy for more details.
| workspace.connectionDBList.forEach((db) => db?.endBulkUpdates()); | ||
| } | ||
| for (const block of blocks) { | ||
| for (const block of bumpNeighbours ? blocks : []) { |
There was a problem hiding this comment.
This is a little difficult to read. I would prefer something more like
if (bumpNeigbours) { for (const block of blocks) {...} }
| // After appending the block to the workspace, it will be bumped from its neighbors | ||
| // However, the algorithm for deciding where to paste a block depends on | ||
| // the starting position of the copied block, so we'll pass those coordinates along | ||
| // The algorithm for deciding where to paste a block depends on the starting |
There was a problem hiding this comment.
I don't see a need to change this comment with these changes.
| let block; | ||
| try { | ||
| block = append(copyData.blockState, workspace) as BlockSvg; | ||
| // Finish any renders queued before the paste, so that the render below |
There was a problem hiding this comment.
I don't think this comment is needed.
| this.workspace, | ||
| coordinate, | ||
| ); | ||
| this.clock.runAll(); |
| this.workspace, | ||
| coordinate, | ||
| ); | ||
| this.clock.runAll(); |
| // After appending the block to the workspace, it will be bumped from its neighbors | ||
| // However, the algorithm for deciding where to paste a block depends on | ||
| // the starting position of the copied block, so we'll pass those coordinates along | ||
| // The algorithm for deciding where to paste a block depends on the starting |
There was a problem hiding this comment.
I don't see a need to change this comment with these changes.
| let block; | ||
| try { | ||
| block = append(copyData.blockState, workspace) as BlockSvg; | ||
| // Finish any renders queued before the paste, so that the render below |
There was a problem hiding this comment.
This comment is not needed.
Use an if around the bump loop, restore the original paste comment, drop the extra comment and the clock.runAll() calls the tests do not need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I pushed the changes, cheers. |
lizschwab
left a comment
There was a problem hiding this comment.
This looks good to me. I pulled down the latest changes and tested again.
lizschwab
left a comment
There was a problem hiding this comment.
Thanks for addressing my feedback so far. There's an additional change we would like to see before merging in.
| let block; | ||
| try { | ||
| block = append(copyData.blockState, workspace) as BlockSvg; | ||
| renderManagement.triggerQueuedRenders(); |
There was a problem hiding this comment.
I checked in with @gonfunko, who is more familiar with this code, and we feel that this call to triggerQueuedRenders() and the one on line 55 are both hack fixes for a different issue. Please remove these and update the tests. It's fine if you need to add a clock tick to get any tests working; I asked for them to be removed when they weren't doing anything to change the outcome of the tests, but you may need them to get the tests passing. There's one test that appears to be addressing an edge case that these calls are meant to fix which you may need to simply remove.
There was a problem hiding this comment.
I removed both calls, then reverted render_management.ts back to main. I also removed the connection-positions test, but kept the other 3 tests with ticks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arningequality/kolibri#15894 merged Nov 2026; commit count 3,500 -> 4,000 (counted 4,024)
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.