Skip to content

Fix move_to appending to unpopulated destination's _children - #337

Merged
Flerpharos merged 1 commit into
mainfrom
fix/322-move-to-unpopulated-destination
Sep 11, 2026
Merged

Fix move_to appending to unpopulated destination's _children#337
Flerpharos merged 1 commit into
mainfrom
fix/322-move-to-unpopulated-destination

Conversation

@Flerpharos

Copy link
Copy Markdown
Collaborator

Fixes #322

move_to was appending the moved node to destination._children unconditionally, even when destination._populated was False. Since the next _ensure_populated() call replaces _children wholesale, that append was pointless at best and left _children non-empty while _populated was still False in the meantime — an inconsistent internal state. The guard now only appends when the destination is already populated (mirroring how create() handles it), leaving population of an unpopulated destination to the next _ensure_populated() call.

Guard the local _children append in move_to so it only runs when the
destination is already populated, mirroring create(). When unpopulated,
the next _ensure_populated() call replaces _children wholesale anyway,
so appending first just leaves _children non-empty while _populated is
still False, an inconsistent state discarded on the next fetch.

Fixes #322

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Flerpharos
Flerpharos merged commit a8c3c07 into main Sep 11, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

move_to into an unpopulated destination silently drops the node

1 participant