Repository navigation
Enforce the container-type check in move_node_unchecked (closes #3011) - #3085
Conversation
move_node_unchecked skipped the can_have_children() check that move_node enforces, so the unchecked variant could park a node under a leaf type. Extract the shared hierarchy rules (date immovable, parent exists and is a container, no cycle) into validate_move, called by both variants so they differ only in OCC. Correct the doc comment that claimed import/type- conversion use, and add a regression test. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Pragmatic Code Review: PR #3085Review Type: Initial Review SummaryA small, well-scoped fix. The hierarchy rules for a move (date nodes can't move, the parent must exist and be a container, no cycles) now live in one private helper, Requirements Check
Code Review Findings
RecommendationAPPROVE. This is a net improvement: it closes the gap in the check, removes about 30 lines of duplicated validation, and leaves the docs accurate. All findings are optional nits. |
malibio
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: APPROVE (posted as a comment — GitHub blocks self-approval). Full findings in the review comment above.
… callers Skipped: lighter type-only parent lookup in validate_move — move_node already paid the get_node cost and moves aren't batched; revisit if bulk moves route through it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Address-review summary
Re-review: NOT needed — the only change is a one-line doc comment; no logic changed. 🤖 Generated with Claude Code |
Summary
move_node_uncheckedskipped thecan_have_children()check thatmove_nodeenforces, so the unchecked variant could place a node under a leaf type (query, code-block, …).validate_move(date nodes are immovable, parent must exist and be a container, no cycles). Both variants now call it, so they differ only in OCC.move_node_uncheckeddoc comment: it claimed imports/type-conversion use, but it has no production caller (the import path usescreate_node_with_parent).# Errorsdocs.test_move_node_unchecked_rejects_non_container_parent.Testing
cargo test -p nodespace-core— all green, including the integration tests that callmove_node_uncheckedCloses #3011
🤖 Generated with Claude Code