Skip to content

fix(value): guard collection access on atoms - #10

Open
belowzeroff wants to merge 1 commit into
RayforceDB:masterfrom
belowzeroff:fix/value-collection-access
Open

belowzeroff wants to merge 1 commit into
RayforceDB:masterfrom
belowzeroff:fix/value-collection-access

Conversation

@belowzeroff

Copy link
Copy Markdown

Summary

Guard collection-only accessors before calling vector/list FFI paths:

  • Value::get(idx) now returns a binding error when called on a non-vector/non-list value.
  • Value::is_null_at(idx) now returns false for non-vectors and out-of-range indexes before calling ray_vec_is_null.

User-visible bug

These are safe Rust APIs, so calling them on an atom should not reach C functions that expect vector/list layout.

Before this change, code like this could treat an atom as if it had collection storage:

let atom = Value::i64(42);
let _ = atom.get(0);
let _ = atom.is_null_at(0);

After this change:

atom.get(0)        -> Err(... value is not a vector or list ...)
atom.is_null_at(0) -> false

This keeps the existing is_null_at signature, avoiding an API break, while making the FFI boundary total for non-vector values.

Tests

  • Added collection_access_rejects_atoms regression coverage.
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • env RUST_TEST_THREADS=1 cargo test --workspace

@belowzeroff
belowzeroff force-pushed the fix/value-collection-access branch from e5ea748 to b15737d Compare September 18, 2026 18:31
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.

1 participant