test(jni): characterize DataSource open preconditions and count precision - #9636
Open
jackylee-ch wants to merge 1 commit into
Open
test(jni): characterize DataSource open preconditions and count precision#9636jackylee-ch wants to merge 1 commit into
jackylee-ch wants to merge 1 commit into
Conversation
…sion The eight argument checks in DataSource.open guard the JNI boundary: each runs before the native call, so losing one does not raise IllegalArgumentException but sends a null or a negative length into native code. None of their messages was asserted anywhere in the test tree. RowCount and ByteSize are two precision ladders over the same three cases, and only Exact was covered. An Unknown that returned a value instead of an empty OptionalLong would let a caller read a non-empty file as zero rows. Asserts each check by message so a refactor that keeps the check but reclassifies the failure is still caught, and opens a real file for the positive case. Signed-off-by: jackylee <qcsd2011@gmail.com>
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.
DataSource.openguards the JNI boundary with eight argument checks, and none of their messages wasasserted anywhere. Dropping one does not surface as an
IllegalArgumentException: a null name or anegative length crosses into native code instead.
RowCountandByteSizewere only ever exercisedin their
Exactform, soUnknownsilently returning a value would let a caller read a non-emptyfile as zero rows.
Test only, one new file. Each check is asserted by message, and the positive case opens a real file
so a future tightening cannot over-reject.
Verified non-vacuous: nine mutations of
DataSource.java— neutralising each of the sevenJava-reachable checks, and making each
Unknown.asOptional()return a value — each fail exactly thetest that claims to pin them, and the source reverts clean.
:vortex-jni:testgoes 72 → 84; the onefailure in both runs is a pre-existing local one (
TestMinimal.testSelectionIndicesMustBeSortedAndUnique,stale local dylib), not from this change.
spotlessCheckandjavadocpass.The eighth check,
invalid data source pointer, is only reachable if native returns 0, so it is notcovered here.
AI assistance
Written with agentic AI assistance. Per the AI-generated-tests rule I confirmed these assertions
fail when the behaviour they describe is removed, rather than only that they pass.