Conversation
Previously, `session.move("/a", "/a/c")` silently succeeded but produced an
unrepresentable move: `/a` would need to be both an ancestor and a descendant
of itself. Rendering the resulting tree dropped the whole subtree.
Reject these moves up front with `MoveIntoSelfOrDescendant`. Also introduce
`MoveDestinationParentMissing` to give a move-specific message when the
destination's parent doesn't exist (previously surfaced as the generic
`AncestorNodeNotFound`).
Hypothesis coverage gap: `valid_moves` deliberately excluded `source` and its
descendants from destination candidates, so these malformed moves were never
generated. Add `invalid_moves`, `tree_and_invalid_moves`, and
`tree_and_mixed_moves` strategies that produce moves tagged with the expected
rejection reason (or `None` for valid moves), covering self, descendant,
missing-parent, overwrite, and source-missing cases.
li-em
reviewed
Apr 29, 2026
| from __future__ import annotations | ||
|
|
||
| import itertools | ||
| import posixpath |
Member
There was a problem hiding this comment.
can we use pathlib.PurePosixPath instead?
https://docs.python.org/3/library/pathlib.html#pathlib.PurePosixPath
(which is likely overkill, and posixpath is already better than f-strings from before, so just a suggestion, not a strong requirement)
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.
Fixed two bugs with move.
Added a descriptive error message for each of these to help the user.
Also we didn't have any hypothesis tests exercising invalid move paths so I've added those - which would have caught the above bugs.