Skip to content

fix(storage): canonicalize redb pool paths in core and graph - #1066

Open
rudycelekli wants to merge 1 commit into
ruvnet:mainfrom
rudycelekli:fix/storage-pool-canonical-932
Open

rudycelekli wants to merge 1 commit into
ruvnet:mainfrom
rudycelekli:fix/storage-pool-canonical-932

Conversation

@rudycelekli

Copy link
Copy Markdown

Summary

Fixes #932 in both ruvector-core and ruvector-graph. The redb pools now canonicalize the existing parent directory before they key or open a database file. This makes sub/../shared.db and a symlinked directory resolve to the same pool slot as the direct path, while still allowing a database file that has not been created yet.

The existing traversal check remains on the user-supplied path and runs before canonicalization. Both crates have regressions for relative parent traversal as well as the two alias cases.

Reproduction

Before the fix, the new different_spellings_of_one_database_share_the_pool test failed in each crate when the second live handle opened the same file through sub/..:

  • Core: DatabaseError("Database already open. Cannot acquire lock.")
  • Graph: Database already open. Cannot acquire lock.

Validation

  • cargo test -p ruvector-core --no-default-features --features storage --lib storage::tests — 10 passed
  • cargo test -p ruvector-graph --no-default-features --features storage --lib storage::tests — 10 passed
  • cargo build -p ruvector-core -p ruvector-graph --no-default-features --features storage — passed
  • cargo fmt --all --check — passed

The storage tests cover shared writes, symlink aliases (Unix), existing pool lifecycle races, and traversal rejection. Full workspace CI is pending.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storage pools key on non-canonicalized PathBuf — two spellings of one file produce two Database::create calls and a redb lock error

1 participant