fix: harden table, vector, and runtime tests - #9
Open
belowzeroff wants to merge 3 commits into
Open
belowzeroff wants to merge 3 commits into
belowzeroff wants to merge 3 commits into
Conversation
belowzeroff
force-pushed
the
fix/table-head-tail-negative-counts
branch
from
September 18, 2026 18:32
73fe933 to
f392510
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes three small user-visible/runtime issues in the Rust bindings:
Table::headandTable::tailcounts by magnitude, matching the table transform docs.&[]for empty zero-copy vector slices before reading the core data pointer.RUST_TEST_THREADS=1, matching the single process runtime constraint documented by the test suite.User-visible bugs
head(-n)andtail(-n)returned the wrong sideFor a table whose
sizecolumn is[10, 20, 30, 40, 50], the docs sayheadandtailuse the magnitude ofn, whiletakeuses the sign.Before:
After:
This also handles
i64::MINwithout 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 readraw::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 whenlen == 0.CI could run runtime tests in parallel
The runtime is process-global and tests already document serialized execution. CI still ran
cargo test --workspacewithoutRUST_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 -- --checkcargo clippy --workspace --all-targets -- -D warningsenv RUST_TEST_THREADS=1 cargo test --workspace