Skip to content

Complete SurrealDB migration - Advanced features #481

Closed

Description

@malibio

Context

Issue #470 completed 90% of the SurrealDB migration, but some advanced features require complex SurrealDB implementations that are temporarily stubbed out with graceful degradation.

This issue tracks implementing the remaining 10% of advanced features properly in SurrealDB.

What's Working (90%)

✅ Core CRUD operations
✅ Node creation, reading, updating, deletion
✅ Hierarchy operations (parent-child, move, reorder)
✅ Mentions and relationships
✅ Schema management
✅ Basic querying and filtering
✅ Property updates

What Needs Implementation (10%)

1. Version-Checked Operations

Current: Updates ignore version checks (optimistic locking disabled)
Needed: Implement conditional updates based on version field in SurrealDB

// NodeService::update_node_with_version_check
// Currently: Falls back to regular update without version check
// Should: Only update if version matches (optimistic locking)

2. Embedding Staleness Tracking

Current: No-op (embeddings regenerated on next batch)
Needed: Track which nodes need embedding regeneration after content changes

// NodeService methods affected:
// - mark_embedding_stale()
// - get_nodes_with_stale_embeddings()

3. Complex Query Operations

Current: Simplified or stubbed
Needed: Implement SurrealDB equivalents for:

  • Queries with mention joins
  • Embedding staleness filtering
  • Complex multi-table operations

4. Embedding Services Integration

Current: Embedding generation/updates temporarily disabled
Needed: Full integration with SurrealStore

  • embedding_service.rs - Uses DatabaseService (needs SurrealStore)
  • embedding_processor.rs - Uses DatabaseService (needs SurrealStore)

Acceptance Criteria

  • Version-checked updates implemented with optimistic locking
  • Embedding staleness tracking working
  • Complex queries migrated to SurrealDB syntax
  • Embedding services fully integrated with SurrealStore
  • All tracing::warn TODO messages removed
  • Full test coverage for advanced features
  • Zero performance regressions

Implementation Notes

SurrealDB Features to Use:

  • Conditional updates: UPDATE ... WHERE version = $expected_version
  • Transactions for atomicity
  • Graph relations for complex queries
  • Native JSON operations for property filtering

Testing:

  • Add integration tests for version conflicts
  • Test embedding staleness workflow end-to-end
  • Performance benchmarks for complex queries

Related Issues

Priority

Medium - Core functionality works, these are optimizations and advanced features. Can be implemented incrementally as needed.


Note: This is technical debt from the incomplete Epic #461 migration, now being addressed systematically.

Activity

  1. added
    enhancement
    on Nov 12, 2025
  2. malibio commented on Nov 13, 2025

    @malibio
    CollaboratorAuthor

    Test Baseline ():

    ✅ 764 tests passing
    ⏭️ 26 tests skipped (database mode tests - in-memory baseline)

    Test Distribution:

    • Unit tests: All passing
    • Integration tests: All passing
    • Performance tests: All passing
    • Browser tests: All passing

    No test failures detected - Clean baseline for issue #481 implementation.

    Starting work on completing SurrealDB migration advanced features.

  3. self-assigned this
    on Nov 13, 2025
  4. 23 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backendenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions