Repository navigation
test(jdbc): pin isFirst across cursor boundaries - #140
Merged
Merged
Conversation
Assert isFirst is true only on the first row and false before the first row and after the last, including the single-row case. Current production behavior already satisfies java.sql, so no code change. xerial 3.53.4.0 reports true after the last row of a single-row result because isFirst() is row == 1 and next() leaves row unchanged on SQLITE_DONE. That difference is recorded as a reference note and not copied.
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.
Fixes #75
Contract line: Hrana 3 is the source of truth for transport, values, metadata, batching, transactions, and error reporting.
java.sqlis the source of truth for the JDBC surface. xerial/sqlite-jdbc is a behavioral reference and conformance foundation, never a copy target.What changed
LibsqlResultSetNavigationTestnow pinsisFirst()at every cursor position:falsetruefalsefalsefalsebefore,trueon its row,falseafter the endfalseNo production change.
LibsqlResultSet.isFirst()is alreadycurrentRowIndex == 0 && !rows.isEmpty(), which is exactly thejava.sqlrule. The plan's Build box says to change code only if the current behavior violates that rule, so this PR only adds the boundary pins.Divergence: no red test at trunk
Lane 1 expects the new cases to fail at trunk. They cannot: trunk already returns
falsebefore the first row and after the last for both multi-row and single-row results. Running the new test file againstorigin/mainproduction code givesTests run: 13, Failures: 0(log:/tmp/xerial-parity-i75/lane-1-regression.log). This is the intended outcome of the plan, not a skipped lane: the test pins an invariant that already held.Reference note: xerial after-last difference
Probe against xerial 3.53.4.0 (
/tmp/xerial-parity-i75/XerialIsFirstProbe.java):Reason: xerial's
isFirst()isrow == 1, and itsnext()setspastLastRow = trueonSQLITE_DONEwithout incrementingrow. After a single-row result is exhausted,rowis still 1, so xerial reportstrue. That violates thejava.sqlrule, so it is recorded here and deliberately not copied.Evidence at head 29d1be0 (base c2038d1)
-pl libsql-jdbc test: 249 tests, 0 failures, BUILD SUCCESS.verify: 123 tests, 0 failures (1 skipped), BUILD SUCCESS.-Pxerial-control verify: control run completed, 100 tests, 0 failures (1 skipped), BUILD SUCCESS.spotless:check: BUILD SUCCESS.test: BUILD SUCCESS.ResultSetTestvia-Dit.test=ResultSetTest: 21 tests, 0 failures.-pl libsql-jdbc -am package -DskipTests: driver jar built.Logs:
/tmp/xerial-parity-i75/lane-{1..10}-*.log.Perf (
time ./mvnw -pl libsql-jdbc test, three interleaved runs): trunk median 2.04s, head median 2.05s, +0.5%, within the 10% rule. Head is test-only, so no hot-path change.Lane notes
isFirst,getRow, getters) rather than the whole class../mvnw -pl libsql-conformance -am -Dit.test=ResultSetTest verify.