Repository navigation
Remove the empty_to_none sentinel in daemon NodeService — proto-presence audit (B5) - #1245
Conversation
…tional (closes #1242) B5 from architectural audit #1228 — eliminates the empty_to_none() helper that silently collapsed proto3 "field unset" and "field set to empty string" into the same None, making intent explicit at the type level. Proto changes (11 fields converted from bare string to optional string): - CreateNodeRequest: parent_id, collection, lifecycle_status, id - UpdateNodeRequest: node_type, add_to_collection, remove_from_collection, lifecycle_status - SearchRequest: collection, collection_id - MoveNodeRequest: new_parent_id Each conversion documents why "" is not a legitimate client value. prost now generates Option<String> for all fields, and the daemon reads them directly without the empty_to_none helper — which is deleted. Consumer updates: - daemon/node_service.rs: remove all 10 empty_to_none call sites; delete helper - daemon/tests: update inline unit tests + integration tests to use Option<String> - cli/commands: use None instead of String::new() for absent optional fields - desktop-app/nodes.rs: use None/Some() correctly for all proto optional fields New test: - move_node_to_root_when_new_parent_id_unset: verifies new_parent_id=None moves node to root (documents the intentional sentinel semantics) Co-Authored-By: Claude <[email protected]>
Code Review — PR #1245 (B5: Remove empty_to_none sentinel)Overall: This is a clean, well-scoped cleanup that achieves its stated goal. The Acceptance Criteria Coverage
[Improvement] Proto comment for
|
malibio
left a comment
There was a problem hiding this comment.
Review complete. See the full analysis in the PR comment above. Key issue: new_parent_id proto comment claims "" = move to root but the handler no longer normalizes Some("") to None after the empty_to_none removal. Recommend adding .filter(|s| !s.is_empty()) and updating the proto comment before merge.
…node
The proto comment said 'unset or "" = move to root' but the daemon was only
handling None (unset). Fix: apply .filter(|s| !s.is_empty()) so both None and
Some("") map to root-move. Add integration test for the "" case.
Co-Authored-By: Claude <[email protected]>
…nce audit (B5) (#1245) * Remove empty_to_none sentinel: convert bare proto string fields to optional (closes #1242) B5 from architectural audit #1228 — eliminates the empty_to_none() helper that silently collapsed proto3 "field unset" and "field set to empty string" into the same None, making intent explicit at the type level. Proto changes (11 fields converted from bare string to optional string): - CreateNodeRequest: parent_id, collection, lifecycle_status, id - UpdateNodeRequest: node_type, add_to_collection, remove_from_collection, lifecycle_status - SearchRequest: collection, collection_id - MoveNodeRequest: new_parent_id Each conversion documents why "" is not a legitimate client value. prost now generates Option<String> for all fields, and the daemon reads them directly without the empty_to_none helper — which is deleted. Consumer updates: - daemon/node_service.rs: remove all 10 empty_to_none call sites; delete helper - daemon/tests: update inline unit tests + integration tests to use Option<String> - cli/commands: use None instead of String::new() for absent optional fields - desktop-app/nodes.rs: use None/Some() correctly for all proto optional fields New test: - move_node_to_root_when_new_parent_id_unset: verifies new_parent_id=None moves node to root (documents the intentional sentinel semantics) Co-Authored-By: Claude <[email protected]> * Address review: normalize new_parent_id empty string to None in move_node The proto comment said 'unset or "" = move to root' but the daemon was only handling None (unset). Fix: apply .filter(|s| !s.is_empty()) so both None and Some("") map to root-move. Add integration test for the "" case. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude <[email protected]>
Closes #1242