Repository navigation
Backend: Allow blank text nodes in validation - #504
Merged
malibio merged 2 commits intoNov 14, 2025
Merged
Conversation
…s (issue #484) **Root Cause:** PR #501 (SurrealDB migration) introduced a regression in the dev-proxy `create_node` HTTP handler. It expected a full `Node` struct with `createdAt`, `modifiedAt`, and `version` fields, but the frontend correctly sends partial node data (via `BackendAdapter.createNode()`) without timestamps, expecting the backend to add them automatically. **Symptoms:** - All 9 integration tests in `blank-node-creation.test.ts` failed with HTTP 422 - Error: "Unprocessable Entity" during database initialization - Even non-blank sentinel nodes failed (proves it wasn't a blank content issue) **Historical Behavior (Pre-Migration):** - **Tauri commands**: Accept `CreateNodeInput` (no timestamps) → add in backend - **MCP handlers**: Accept `MCPCreateNodeParams` (no timestamps) → add in backend - **NodeOperations**: Creates full `Node` with timestamps at lines 675-689 **The Bug:** Dev-proxy broke this contract by accepting `Json<Node>` instead of partial data. **The Fix:** 1. Created `CreateNodeRequest` struct matching `CreateNodeInput` (no timestamps) 2. Updated `create_node` handler to accept `CreateNodeRequest` 3. Handler now adds `createdAt`, `modifiedAt`, `version` before calling NodeService 4. Matches established pattern from Tauri/MCP handlers **Impact:** - ✅ All 9 blank node integration tests now pass - ✅ No regressions to existing 1538 passing tests - ✅ Restores correct HTTP API contract (matches desktop mode behavior) **Testing:** ```bash bun run test:db src/tests/integration/blank-node-creation.test.ts # Result: Test Files 1 passed (1), Tests 9 passed (9) ✅ ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Enhanced the CreateNodeRequest struct documentation with: - Clear field semantics for all 9 fields - Validation process explanation (two-stage validation) - JSON example showing typical usage - Explicit notes on special cases (blank content, deterministic IDs, mentions vs mentioned_by) This addresses Finding 2 from the code review - improving API contract clarity at the critical HTTP endpoint boundary between frontend and backend. Severity: 🟡 Important (Documentation improvement) Related: Issue #484
Collaborator
Author
Code Review Feedback Addressed✅ Implemented (1 recommendation)🟡 Finding 2: Enhanced
⏭️ Skipped (2 recommendations)🟡 Finding 1: Version Initialization Edge Case
🟢 Suggestion: Extract Conversion Helper Method
Summary: Addressed 1/3 recommendations using sound engineering judgment. Skipped 2 recommendations that would add unnecessary complexity without current benefits. Tests: All quality checks pass ✅ (cargo clippy, cargo fmt, eslint, svelte-check) Status: Ready for final review or merge |
malibio
deleted the
feature/issue-484-blank-text-nodes-http-validation
branch
November 14, 2025 23:47
malibio
added a commit
that referenced
this pull request
Feb 4, 2026
* Fix: Dev-proxy HTTP endpoint regression - accept partial node requests (issue #484) **Root Cause:** PR #501 (SurrealDB migration) introduced a regression in the dev-proxy `create_node` HTTP handler. It expected a full `Node` struct with `createdAt`, `modifiedAt`, and `version` fields, but the frontend correctly sends partial node data (via `BackendAdapter.createNode()`) without timestamps, expecting the backend to add them automatically. **Symptoms:** - All 9 integration tests in `blank-node-creation.test.ts` failed with HTTP 422 - Error: "Unprocessable Entity" during database initialization - Even non-blank sentinel nodes failed (proves it wasn't a blank content issue) **Historical Behavior (Pre-Migration):** - **Tauri commands**: Accept `CreateNodeInput` (no timestamps) → add in backend - **MCP handlers**: Accept `MCPCreateNodeParams` (no timestamps) → add in backend - **NodeOperations**: Creates full `Node` with timestamps at lines 675-689 **The Bug:** Dev-proxy broke this contract by accepting `Json<Node>` instead of partial data. **The Fix:** 1. Created `CreateNodeRequest` struct matching `CreateNodeInput` (no timestamps) 2. Updated `create_node` handler to accept `CreateNodeRequest` 3. Handler now adds `createdAt`, `modifiedAt`, `version` before calling NodeService 4. Matches established pattern from Tauri/MCP handlers **Impact:** - ✅ All 9 blank node integration tests now pass - ✅ No regressions to existing 1538 passing tests - ✅ Restores correct HTTP API contract (matches desktop mode behavior) **Testing:** ```bash bun run test:db src/tests/integration/blank-node-creation.test.ts # Result: Test Files 1 passed (1), Tests 9 passed (9) ✅ ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Address review: Add comprehensive documentation to CreateNodeRequest Enhanced the CreateNodeRequest struct documentation with: - Clear field semantics for all 9 fields - Validation process explanation (two-stage validation) - JSON example showing typical usage - Explicit notes on special cases (blank content, deterministic IDs, mentions vs mentioned_by) This addresses Finding 2 from the code review - improving API contract clarity at the critical HTTP endpoint boundary between frontend and backend. Severity: 🟡 Important (Documentation improvement) Related: Issue #484 --------- Co-authored-by: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Feb 5, 2026
* Fix: Dev-proxy HTTP endpoint regression - accept partial node requests (issue #484) **Root Cause:** PR #501 (SurrealDB migration) introduced a regression in the dev-proxy `create_node` HTTP handler. It expected a full `Node` struct with `createdAt`, `modifiedAt`, and `version` fields, but the frontend correctly sends partial node data (via `BackendAdapter.createNode()`) without timestamps, expecting the backend to add them automatically. **Symptoms:** - All 9 integration tests in `blank-node-creation.test.ts` failed with HTTP 422 - Error: "Unprocessable Entity" during database initialization - Even non-blank sentinel nodes failed (proves it wasn't a blank content issue) **Historical Behavior (Pre-Migration):** - **Tauri commands**: Accept `CreateNodeInput` (no timestamps) → add in backend - **MCP handlers**: Accept `MCPCreateNodeParams` (no timestamps) → add in backend - **NodeOperations**: Creates full `Node` with timestamps at lines 675-689 **The Bug:** Dev-proxy broke this contract by accepting `Json<Node>` instead of partial data. **The Fix:** 1. Created `CreateNodeRequest` struct matching `CreateNodeInput` (no timestamps) 2. Updated `create_node` handler to accept `CreateNodeRequest` 3. Handler now adds `createdAt`, `modifiedAt`, `version` before calling NodeService 4. Matches established pattern from Tauri/MCP handlers **Impact:** - ✅ All 9 blank node integration tests now pass - ✅ No regressions to existing 1538 passing tests - ✅ Restores correct HTTP API contract (matches desktop mode behavior) **Testing:** ```bash bun run test:db src/tests/integration/blank-node-creation.test.ts # Result: Test Files 1 passed (1), Tests 9 passed (9) ✅ ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Address review: Add comprehensive documentation to CreateNodeRequest Enhanced the CreateNodeRequest struct documentation with: - Clear field semantics for all 9 fields - Validation process explanation (two-stage validation) - JSON example showing typical usage - Explicit notes on special cases (blank content, deterministic IDs, mentions vs mentioned_by) This addresses Finding 2 from the code review - improving API contract clarity at the critical HTTP endpoint boundary between frontend and backend. Severity: 🟡 Important (Documentation improvement) Related: Issue #484 --------- Co-authored-by: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Feb 26, 2026
* Fix: Dev-proxy HTTP endpoint regression - accept partial node requests (issue #484) **Root Cause:** PR #501 (SurrealDB migration) introduced a regression in the dev-proxy `create_node` HTTP handler. It expected a full `Node` struct with `createdAt`, `modifiedAt`, and `version` fields, but the frontend correctly sends partial node data (via `BackendAdapter.createNode()`) without timestamps, expecting the backend to add them automatically. **Symptoms:** - All 9 integration tests in `blank-node-creation.test.ts` failed with HTTP 422 - Error: "Unprocessable Entity" during database initialization - Even non-blank sentinel nodes failed (proves it wasn't a blank content issue) **Historical Behavior (Pre-Migration):** - **Tauri commands**: Accept `CreateNodeInput` (no timestamps) → add in backend - **MCP handlers**: Accept `MCPCreateNodeParams` (no timestamps) → add in backend - **NodeOperations**: Creates full `Node` with timestamps at lines 675-689 **The Bug:** Dev-proxy broke this contract by accepting `Json<Node>` instead of partial data. **The Fix:** 1. Created `CreateNodeRequest` struct matching `CreateNodeInput` (no timestamps) 2. Updated `create_node` handler to accept `CreateNodeRequest` 3. Handler now adds `createdAt`, `modifiedAt`, `version` before calling NodeService 4. Matches established pattern from Tauri/MCP handlers **Impact:** - ✅ All 9 blank node integration tests now pass - ✅ No regressions to existing 1538 passing tests - ✅ Restores correct HTTP API contract (matches desktop mode behavior) **Testing:** ```bash bun run test:db src/tests/integration/blank-node-creation.test.ts # Result: Test Files 1 passed (1), Tests 9 passed (9) ✅ ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * Address review: Add comprehensive documentation to CreateNodeRequest Enhanced the CreateNodeRequest struct documentation with: - Clear field semantics for all 9 fields - Validation process explanation (two-stage validation) - JSON example showing typical usage - Explicit notes on special cases (blank content, deterministic IDs, mentions vs mentioned_by) This addresses Finding 2 from the code review - improving API contract clarity at the critical HTTP endpoint boundary between frontend and backend. Severity: 🟡 Important (Documentation improvement) Related: Issue #484 --------- Co-authored-by: Claude <[email protected]>
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.
Closes #484