Skip to content

test(conformance): fail the prepared-statement race test on runtime errors (#118) - #129

Merged
magnusp merged 1 commit into
mainfrom
fix/i118-thread-test
Oct 22, 2026
Merged

magnusp merged 1 commit into
mainfrom
fix/i118-thread-test

Conversation

@magnusp

@magnusp magnusp commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Fixes #118.

Contract: Hrana 3 is the source of truth for transport, values, and metadata; java.sql is the source of truth for the JDBC surface; xerial/sqlite-jdbc is a behavioral reference and conformance foundation, never a copy target.

Protocol basis is protocol-neutral. Hrana over HTTP requires serialized requests per stream and consumes a baton once, so this test guards the client's serialization obligation.

Change

PreparedStatementThreadTest.testRace now captures the query and close outcomes separately, awaits both futures, tolerates only an SQLException cause, and rethrows every other failure. The test methods declare ExecutionException so the rethrow is real.

Red and green evidence

Injected throw new NullPointerException("injected runtime race failure") into the query future in a scratch copy, and updated only the scratch checksum. The injection was removed before the commit.

  • Old divergence (rethrow only AssertionError) with the injection: Tests run: 2, Failures: 0, Errors: 0 and BUILD SUCCESS. /tmp/xerial-parity-i118/red-old-divergence.log
  • New divergence with the same injection: Tests run: 2, Failures: 0, Errors: 2, both failed with ExecutionException: java.lang.NullPointerException: injected runtime race failure, BUILD FAILURE. /tmp/xerial-parity-i118/red-new-divergence.log
  • New divergence without the injection: Tests run: 2, Failures: 0, Errors: 0, BUILD SUCCESS. /tmp/xerial-parity-i118/green-targeted.log

Divergence recorded

# divergence: src/test/java/org/sqlite/PreparedStatementThreadTest.java -- upstream swallows every ExecutionException, which hides assertion failures and runtime exceptions from the close/execute race; Hrana serializes requests per stream, so the conformance copy awaits both futures and tolerates only an SQLException cause, and any runtime failure fails the test as the Java equivalent of the native crash it guards (#51, #118).

The # upstream hash is unchanged. The current hash in CHECKSUMS.sha256 moves to 8e63f29bec87782e5705ebff748389cb9f5fe3a68d755c730a2beaccde9712a4.

Verification

All lanes at head 81e315f07394ecd683d6740f5846e2669e247636.

  • ./mvnw -pl libsql-conformance -am verify -Dit.test=PreparedStatementThreadTest: pass, 2 of 2 tests.
  • ./mvnw -pl libsql-conformance -am verify: pass, 115 tests, 1 pre-existing skip.
  • ./mvnw -pl libsql-conformance -am -Pxerial-control verify: pass, 100 tests, 1 pre-existing skip.
  • tools/export-upstream --verify: pass.
  • ./mvnw spotless:check: pass.
  • ./mvnw test: pass, BUILD SUCCESS.
  • ./mvnw -pl libsql-conformance -am package -DskipTests: pass.

Files changed are the vendored test, upstream-xerial_sqlite-jdbc.manifest, and upstream-xerial_sqlite-jdbc/CHECKSUMS.sha256.

Base 8e9aaf6746eb48b34639455ecb8657488f08e5f8, head 81e315f07394ecd683d6740f5846e2669e247636.

…rrors (#118)

Tolerate only an SQLException cause in the vendored race helper and await both futures before rethrowing, so a runtime failure cannot pass silently. Record the narrower divergence and update the checksum.
@magnusp
magnusp merged commit 5401ce9 into main Oct 22, 2026
5 checks passed
@magnusp
magnusp deleted the fix/i118-thread-test branch October 22, 2026 21:43
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.

Vendored PreparedStatementThreadTest passes when the race throws a runtime exception

1 participant