Skip to content

fix(sona+ruvector-graph): disk-first persistence and finite-weight validation - #375

Closed
kiki-kanri wants to merge 3 commits into
ruvnet:mainfrom
kiki-kanri:graph-sona-fixes
Closed

kiki-kanri wants to merge 3 commits into
ruvnet:mainfrom
kiki-kanri:graph-sona-fixes

Conversation

@kiki-kanri

Copy link
Copy Markdown
Contributor

Summary

Two reliability-focused improvements for sona and ruvector-graph:

  • sona: Add NaN/Inf validation to MicroLoRA::set_weights with transaction pattern documentation and comprehensive tests
  • ruvector-graph: Reorder edge operations (create_edge, delete_edge, delete_edges_batch) to persist to storage BEFORE updating in-memory state, ensuring storage failures cannot leave the graph in a partially mutated state

Changes

feat(sona): add NaN/Inf validation to MicroLoRA::set_weights

Validate weights are finite before mutation to prevent loading corrupted weights into internal state. Add transaction pattern docs explaining the validation-then-commit approach. Includes tests for NaN/Inf detection in both down_proj and up_proj, plus test ensuring original state is preserved on validation failure.

refactor(ruvector-graph): reorder edge ops to disk-first for storage failure safety

Reorder create_edge, delete_edge, and delete_edges_batch to persist to storage BEFORE updating in-memory edges and indexes. On storage failure, memory and indexes remain coherent — caller receives an Err without partial mutations.

Commits

  • 55853249 feat(sona): add NaN/Inf validation to MicroLoRA::set_weights
  • 55420091 refactor(ruvector-graph): reorder edge ops to disk-first for storage failure safety

…failure safety

Reorder create_edge, delete_edge, and delete_edges_batch to persist to storage
BEFORE updating in-memory edges and indexes. On storage failure, memory and
indexes remain coherent — caller receives an Err without partial mutations.
Validate weights are finite before mutation to prevent loading corrupted
weights into internal state. Add transaction pattern docs explaining the
validation-then-commit approach. Includes tests for NaN/Inf detection in
both down_proj and up_proj, plus test ensuring original state is preserved
on validation failure.
@ruvnet

ruvnet commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Status check (2026-11-09), thanks @kiki-kanri. Neither half is on main yet: MicroLoRA::set_weights still doesn't reject NaN/Inf, and GraphDB::create_edge/delete_edge/delete_edges_batch still mutate memory before storage. #1435 (open, just rebased) also changes crates/ruvector-graph/src/graph.rs, so this will be rebased after #1435 lands to avoid two overlapping rebases of the same file. Leaving this open for now.

@ruvnet

ruvnet commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Thanks @kiki-kanri. Now that #1435 has merged, this is rebased as #1472 and credited to you via Co-Authored-By. Your create_edge hunk dropped out because #1435 landed the same disk-first ordering. delete_edge now holds the map entry across the storage call, and the new doc example imports MicroLoRA so it compiles as a doctest. This PR will close once #1472 merges.

@ruvnet

ruvnet commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Landed in #1472 (merge 25acde1, on main), credited to you via Co-Authored-By: MicroLoRA::set_weights rejects NaN/Inf, and delete_edge/delete_edges_batch are disk-first. Thanks @kiki-kanri! Closing as superseded.

@ruvnet ruvnet closed this Nov 10, 2026
@kiki-kanri

Copy link
Copy Markdown
Contributor Author

ok thanks!

vitaly-z pushed a commit to vitaly-z/ruvector that referenced this pull request Nov 11, 2026
…edge deletes

Port of ruvnet#375 onto main after ruvnet#1435.

ruvector-sona: `MicroLoRA::set_weights` now rejects NaN/Inf in either
projection before mutating state, so loading corrupt weights from disk or
another system cannot poison the adapter. Adds tests for NaN/Inf in each
projection and for state preservation on a failed load; the new doc example
imports `ruvector_sona::MicroLoRA` so it compiles as a doctest.

ruvector-graph: `delete_edge` and `delete_edges_batch` persisted the deletion
after removing the edge from memory and indexes, so a storage error left
memory and disk disagreeing. Both now persist first and only then mutate
memory and indexes. `delete_edge` holds the DashMap entry across the storage
call, matching how ruvnet#1435 made `create_edge` disk-first; the batch path drops
exactly the removed values from the indexes. ruvnet#375's `create_edge` hunk is
dropped because ruvnet#1435 already landed the same ordering. Adds a test that
single and batch deletes (with missing and repeated IDs) leave no type or
adjacency membership behind.

Co-Authored-By: kiki-kanri <a470666@gmail.com>
Co-Authored-By: claude-flow <ruv@ruv.net>
vitaly-z pushed a commit to vitaly-z/ruvector that referenced this pull request Nov 11, 2026
Ships ruvnet#1472 (from ruvnet#375): MicroLoRA::set_weights rejects NaN/Inf; GraphDB
edge deletes are disk-first.

ruvector-graph: add homepage https://ruv.io, docs.rs link, 5 keywords (the
crates.io limit) and categories. README install snippets said 0.1.1; now
"2.3". The quickstart used `Graph`/`GraphConfig` and struct-literal nodes,
none of which exist; rewritten against GraphDB/NodeBuilder/EdgeBuilder and
run against this tree. `cargo publish --dry-run` passes; packaged file list
matches 2.3.4.

ruvector-sona: version only (metadata and quickstart were updated in 0.2.4).

CHANGELOG entry for both.

Co-Authored-By: claude-flow <ruv@ruv.net>
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.

2 participants