Repository navigation
Validate node type and compute title in upsert create branch; drop test- id exemption - #3038
Conversation
…st- id exemption (closes #3013, closes #3012) - Extract ensure_known_node_type from prepare_create_node_with_parent and apply it in upsert_node_with_parent's create branch, checked before the missing parent is auto-created so a rejected call leaves nothing behind. - upsert_node_with_parent's create branch now computes the title instead of hardcoding None. - Remove the shipped "test-" prefix carve-out from caller-supplied id UUID validation; no test relied on it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Pragmatic Code Review — Initial ReviewSummary: This is a small, focused change and it improves the code. Both issues are fixed as specified. Pulling the type check out into Requirements Check
Findings🟡
🟡 The upsert create branch has no UUID validation for the caller's node id — follow-up
🟡 The upsert create branch skips the rest of the create-path validation, and its doc comment claims a "single transaction" that isn't there — follow-up
🟢 Moving the existence check earlier adds no real race risk. Races fail the same way as before: a concurrent create hits a primary-key conflict, a concurrent delete fails the update. It also saves one store round-trip. 🟢 The title normalization is equivalent. Properties are always 🟢 Test nit: the title test uses 🟢 Nit: the deprecated Recommendation: APPROVE |
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.
…t rootness - prepare_create_node_with_parent now checks the node type before ensure_date_exists, so a rejected create leaves no date container behind (same rule the upsert path now follows); regression test added. - Upsert create-branch title test also asserts a text child stays untitled, pinning the is_root = false choice. - Correct upsert_node_with_parent's doc comment: its steps are separate store writes, not a single transaction. Deferred to a follow-up issue (changes gRPC behavior beyond #3012/#3013): UUID validation of the upsert node id, routing upsert's create branch through the create_node_with_parent pipeline, removing _root_id. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Review feedback addressed (121e9c7)✅ Addressed
⏭️ Deferred to #3040. These change gRPC-facing behavior beyond #3012 and #3013:
🟢 No action needed on the existence-check race or the title-normalization equivalence (both confirmed fine). Core suite green; pre-push gate (test:all + daemon build + e2e) passed. Re-review: not needed. The changes are a statement reorder, a comment fix and added tests. |
Closes #3013
Closes #3012
#3013 —
upsert_node_with_parentcreate branchprepare_create_node_with_parentintoensure_known_node_type, and applied it toupsert_node_with_parentwhen the node doesn't exist yet. The check runs before the missing parent is auto-created, so a rejected call leaves no orphan date node behind.compute_title(always non-root) instead of hardcodingtitle: None.#3012 —
test-id exemptionprovided_id.starts_with("test-")carve-out from caller-supplied id validation. Non-date/non-schema ids must be UUIDs. No test relied on it (fullnodespace-coresuite green).Tests
test_upsert_node_with_parent_create_branch_computes_titletest_upsert_node_with_parent_create_branch_rejects_unknown_type(also asserts no parent left in the store)test_create_node_with_parent_rejects_test_prefixed_idPre-push gate (test:all + daemon build + e2e) passed.
🤖 Generated with Claude Code