Skip to content

fix: harden table, vector, and runtime tests - #9

Open
belowzeroff wants to merge 3 commits into
RayforceDB:masterfrom
belowzeroff:fix/table-head-tail-negative-counts
Open

belowzeroff wants to merge 3 commits into
RayforceDB:masterfrom
belowzeroff:fix/table-head-tail-negative-counts

Conversation

@belowzeroff

Copy link
Copy Markdown

Summary

This PR fixes three small user-visible/runtime issues in the Rust bindings:

  • Normalize Table::head and Table::tail counts by magnitude, matching the table transform docs.
  • Return &[] for empty zero-copy vector slices before reading the core data pointer.
  • Run CI tests with RUST_TEST_THREADS=1, matching the single process runtime constraint documented by the test suite.

User-visible bugs

head(-n) and tail(-n) returned the wrong side

For a table whose size column is [10, 20, 30, 40, 50], the docs say head and tail use the magnitude of n, while take uses the sign.

Before:

head(-2) -> [40, 50]
tail(-2) -> [10, 20]
take(-2) -> [40, 50]

After:

head(-2) -> [10, 20]
tail(-2) -> [40, 50]
take(-2) -> [40, 50]

This also handles i64::MIN without overflowing.

Empty typed slices could read an invalid FFI data pointer

Rust requires slice::from_raw_parts(ptr, 0) to receive a non-null, aligned pointer even for an empty slice. The binding previously read raw::data(...) before constructing an empty slice, which made empty core vectors depend on the exact pointer returned by the C core.

The binding now returns Ok(&[]) before reading the data pointer when len == 0.

CI could run runtime tests in parallel

The runtime is process-global and tests already document serialized execution. CI still ran cargo test --workspace without RUST_TEST_THREADS=1, allowing integration tests to race runtime creation and fail with an already-live runtime.

The test step now sets RUST_TEST_THREADS=1.

Tests

  • 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/table-head-tail-negative-counts branch from 73fe933 to f392510 Compare September 18, 2026 18:32
@belowzeroff belowzeroff changed the title fix table count handling and runtime test stability fix: harden table, vector, and runtime tests Sep 18, 2026
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