Repository navigation
Description
Status: See Issue #611 First
This issue was based on incorrect diagnosis of the root cause.
Issue #611 addresses the broader serialization inconsistency that may be causing the symptoms described here. Fixing #611 Phase 1 should resolve the 35+ test failures, and we can then re-evaluate if there are any remaining Thing-type deserialization issues specific to get_node().
Original Diagnosis (May Be Incorrect)
Fix get_node() to properly deserialize hub node records by omitting SurrealDB Thing-typed fields that cause deserialization failures.
Original Problem Statement
The get_node() method in SurrealStore queries hub nodes with SELECT * FROM node:\{id}`;`, which returns Thing-typed fields that cannot deserialize to Rust structs. This causes silent deserialization failures in downstream systems.
Thing Types That Fail to Deserialize (Original Theory)
- id field (SurrealDB Record ID / Thing type)
- mentions field (array - array of Thing types)
- mentioned_by field (array - array of Thing types)
What We Actually Discovered
During investigation of this issue, we found:
- Query field name mismatch:
packages/core/src/db/surreal_store.rs:1843usestype = $node_typebut the schema field isnodeType - This breaks 35+ tests - all the tests mentioned in this issue description
- Not a Thing type issue (yet): The immediate problem is query field names don't match schema field names
- Broader architecture issue: Database schema uses camelCase (nodeType) but should use snake_case (node_type) per naming standards
Investigation Results
Test baseline on main:
- 502 passing, 35 failing (not the "42 failing" mentioned in original issue)
Attempted fixes based on original Thing-type hypothesis:
- OMIT id, mentions, mentioned_by from SELECT queries
- Made SurrealNode.id Optional with skip_deserializing
- Result: Made things worse (501 passing, 36 failing)
Actual problem found:
- The
identifier-naming-conventions.mddoc clearly states database fields should be snake_case - Current schema has camelCase fields (nodeType, createdAt, modifiedAt)
- Queries inconsistently use
type,nodeType, ornode_type - The query using bare
typecan't find records because that field doesn't exist
Recommended Approach
Step 1: Fix Issue #611 Phase 1 (Do This First)
Work on Issue #611: Standardize database schema to snake_case - fix serialization inconsistency
Phase 1 quick fix:
- Update
query_nodes()to usenodeTypefield name (matches current schema) - Update any other queries using incorrect field names
- Should fix all 35+ failing tests immediately
Step 2: Re-evaluate This Issue (After #611 Phase 1)
After #611 Phase 1 is complete:
- Re-run tests to see if any Thing-type deserialization issues remain
- If get_node() still has issues with Thing types, continue with this issue
- If not, close this issue as resolved by Standardize database schema to snake_case - fix serialization inconsistency #611
Step 3: Issue #611 Phase 2 (Long-term)
Complete database schema migration to snake_case for consistency and standards compliance.
Original Issue Content (For Reference)
Thing Types That May Fail to Deserialize
The original theory was that these fields fail to deserialize:
- id field (SurrealDB Record ID / Thing type)
- mentions field (array - array of Thing types)
- mentioned_by field (array - array of Thing types)
When these fields are included in SELECT results, serde_json may not be able to deserialize them to the Node struct, causing the query to appear to succeed but return empty/null results.
Original Impact Assessment
- 15+ mention system tests failing - can't deserialize nodes with mention relationships
- 6+ markdown export tests failing - depends on get_node() working
- 4+ search/embedding tests failing - depends on get_node() working
- Any system that calls
get_node()and expects mentions to be populated
Note: These may actually be failing due to the query field name issue in #611, not Thing-type deserialization.
Related Issues & Documentation
- Issue Standardize database schema to snake_case - fix serialization inconsistency #611 - Fix query field names and schema migration (WORK ON THIS FIRST)
- docs/architecture/development/standards/identifier-naming-conventions.md - Naming standards that identify the current violations
- Issue Extend SchemaService to support user-defined schema creation with automatic database generation #562 - Original schema creation implementation
- PR --title #606 - Recent fix for spoke record persistence
- Commit 629d84e - Applied OMIT pattern to spoke queries
Next Actions
- ✅ Issue Standardize database schema to snake_case - fix serialization inconsistency #611 updated with comprehensive scope and phased approach
- ⏳ Work on Issue Standardize database schema to snake_case - fix serialization inconsistency #611 Phase 1 (quick fix for query field names)
- ⏳ Re-evaluate this issue after Standardize database schema to snake_case - fix serialization inconsistency #611 Phase 1 complete
- ❓ Determine if Thing-type deserialization is still an issue
Activity
Fix get_node() deserialization: OMIT Thing-typed fields in hub node q…
malibio commentedon Nov 22, 2025
Closing as resolved by #611 (PR #613).
The original diagnosis was incorrect - the failures were not due to Thing-type deserialization issues, but rather field name mismatches (camelCase vs snake_case).
PR #613 addresses:
Test results improved from 503 passing to 507 passing. Remaining failures are tracked in #614 and #615.