Skip to content

Fix 4 failing Rust backend tests (markdown import, date nodes, OCC performance) #376

Closed

Description

@malibio

Problem

4 Rust backend tests are currently failing. These represent regressions or incomplete implementations that need investigation and fixes.

Test Failure Summary

Total: 321 passing, 6 ignored, 4 failing


Failure 1 & 2: Markdown Import Node Count Mismatch (2 tests)

Location: packages/core/src/mcp/handlers/markdown_test.rs

test mcp::handlers::markdown::markdown_test::tests::test_update_container_from_markdown_basic ... FAILED
test mcp::handlers::markdown::markdown_test::tests::test_update_container_from_markdown_empty_markdown ... FAILED

assertion `left == right` failed
  left: 1
 right: 2

Issue: Tests expect 2 nodes to be created/updated, but only 1 is created.

Files:

  • markdown_test.rs:1453 - basic markdown update test
  • markdown_test.rs:1558 - empty markdown update test

Root Cause: Likely related to recent changes in update_container_from_markdown implementation or how nodes are counted after markdown import.


Failure 3: Date Node Type Mismatch (1 test)

Location: packages/core/src/services/node_service.rs:2952

test services::node_service::tests::test_create_date_node ... FAILED

assertion `left == right` failed
  left: "text"
 right: "date"

Issue: Creating a date node returns type "text" instead of "date".

Root Cause: Date node creation logic changed - possibly related to:


Failure 4: OCC Performance Overhead (1 test)

Location: packages/core/src/mcp/handlers/nodes_test.rs:1523

test mcp::handlers::nodes::nodes_test::integration_tests::test_occ_performance_overhead ... FAILED

OCC overhead too high: 11.85ms average (expected < 5ms)

Issue: Optimistic Concurrency Control adds 11.85ms overhead, exceeds 5ms threshold.

Root Cause: Recent OCC implementation (#369) may have:

  • Added extra database queries
  • Introduced version checking overhead
  • Requires optimization or threshold adjustment

Reproduction

# Run all workspace tests
cargo test --workspace

# Run specific failing tests
cargo test --package nodespace-core test_update_container_from_markdown_basic
cargo test --package nodespace-core test_create_date_node
cargo test --package nodespace-core test_occ_performance_overhead

Acceptance Criteria

  • All 4 failing tests pass
  • Markdown import correctly creates expected node count
  • Date node creation returns type "date" not "text"
  • OCC performance overhead reduced to < 5ms OR threshold adjusted with justification
  • Root cause documented in commit message
  • No new warnings or clippy issues introduced
  • All tests pass: cargo test --workspace

Implementation Notes

For Markdown Import Tests:

  • Investigate update_container_from_markdown in markdown.rs
  • Check if container node is being counted in assertions
  • Review recent changes to markdown import logic
  • May need to adjust test expectations if behavior intentionally changed

For Date Node Test:

For OCC Performance Test:

  • Profile the OCC overhead to identify bottleneck
  • Consider:
    • Caching version checks
    • Batch version queries
    • Moving version check to after main operation
    • Adjusting threshold if 5ms is too strict

Priority

🔴 HIGH - Failing tests indicate regressions or incomplete implementations.


Related Issues


Estimated Effort

  • Markdown import fixes: 1-2 hours (investigation + fix)
  • Date node fix: 1-2 hours (investigate behavior change)
  • OCC performance: 2-3 hours (profiling + optimization OR threshold justification)

Total: 4-7 hours

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions