Skip to content

🔴 Migrate gp-storage FFI from Kùzu (kuzu_*) to LadybugDB (lbug crate) #18

@web3guru888

Description

@web3guru888

Summary

Migrate gp-storage FFI bindings from Kùzu (kuzu_*) to LadybugDB (lbug_*). KuzuDB was archived in October 2025 — no further security patches or development.

Findings

Affected Files

File References Nature
rust/gp-storage/src/ffi.rs 131 refs CRITICAL: Hand-rolled C FFI — all kuzu_* struct/function names
rust/gp-storage/src/safe.rs 87 refs CRITICAL: Safe Rust wrappers around FFI
rust/gp-storage/src/lib.rs 3 refs Module declarations with kuzu-ffi feature gate

Migration Path

LadybugDB is 95%+ API compatible with Kùzu. The C API symbols changed prefix:

  • kuzu_database_init()lbug_database_init()
  • kuzu_connection_init()lbug_connection_init()
  • kuzu_query_result_*lbug_query_result_*
  • etc.

Two Options

  1. Rename FFI symbolssed s/kuzu_/lbug_/g on ffi.rs + safe.rs, update link directive. ~1 day.
  2. Replace with lbug crate — Drop hand-rolled FFI entirely, use the published lbug = "0.16" crate. More work but cleaner long-term. ~2-3 days.

Recommendation: Option 2 (replace with crate)

  • Published crate (lbug) has safe Rust API, no unsafe FFI needed
  • Maintained by community — we don't carry FFI maintenance burden
  • Future LadybugDB updates are just cargo update
  • Breaking change from kuzu's API: ~5% of calls need adjustment (documented in migration report)

Testing

  • All 694 existing tests must pass
  • Add integration test with LadybugDB persistent database
  • Verify Cypher DDL schema from kuzu-schema-design.md works unchanged

References

Estimated Effort

  • Option 1 (rename): 1 day
  • Option 2 (replace with crate): 2-3 days ← recommended
  • Testing: 1 day

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions