Repository navigation
Give the create path a child's rootness instead of deriving it - #2857
Conversation
…#2849) insert_node_in_tx_no_invariant_dispatch recomputed a missing title with rootness unknown, which made compute_title look up the parent edge. Inside create_node_with_parent's transaction the node row is written before that edge, so every child read as a root and was titled with its own body text, overwriting the correct None the prepare step had computed. create_node_in_tx and insert_node_in_tx_no_invariant_dispatch now take is_root from their callers: false for a parented create, true for create_node and invariant-action creates (neither ever has a parent at insert time). The entity-resolution test that pinned the bug is inverted, and a unit test asserts roots are titled and children are not through both the standalone and _in_tx entry points. Both fail with the fix reverted. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Pragmatic Code Review: PR #2857Review Type: Initial review (the PR had no reviews or comments yet) Requirements Check (issue #2849)
Code Review FindingsCorrectness of the hardcoded
🟢 Pre-existing, out of scope: "create first, attach a parent later" paths still title the child
🟢 API shape: a bare
🟢 Nit: redundant
🟢 Test quality
Project rules
Recommendation: APPROVEThis is a small, well-scoped fix for a real correctness bug. The change is minimal: rootness is now passed in instead of looked up while the edge doesn't exist yet. The tests are targeted and confirmed to fail without the fix. All findings are optional 🟢 follow-ups or 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.
Address-review summaryThe review verdict was APPROVE, with three 🟢 suggestions. None of them changed the code:
No commits added. No re-review needed. |
Closes #2849
Problem
insert_node_in_tx_no_invariant_dispatchrecomputed a missing title viacompute_title(&node, None), which resolves rootness by looking up the parent edge. Insidecreate_node_with_parent's transaction the node row is written before the edge, so every child read as a root and was titled with its own body text — overwriting the correctNonethe prepare step had already computed. Body sentences leaked intonode_title_fts,title_match_nodes, the ADR-040 title boost and mention autocomplete.Fix (option 1 from the issue)
create_node_in_txandinsert_node_in_tx_no_invariant_dispatchtakeis_root: boolfrom the caller:create_node_with_parent→falsecreate_node_with_parent_in_tx→parent.is_none()create_nodeand invariant-action creates →true(neither has a parent at insert time)With rootness known, the recompute reproduces the prepare step's answer and can no longer overwrite a deliberate
None.Tests
entity_resolution_test: the pinning test is inverted toa_body_node_mentioning_the_name_is_not_an_entity— asserts the stored title isNoneandhits.is_empty().test_create_node_with_parent_titles_only_roots: roots titled, children NULL, through both the standalone and_in_txentry points.nodespace-coresuite passes; no existing title-dependent tests (mention autocomplete,title_match_nodes) needed changes. Pre-push gate passed.🤖 Generated with Claude Code