Skip to content

Commit 515dcdd

Browse files
committed
docs: publish canonical xerial conformance statement
1 parent 9a82792 commit 515dcdd

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

‎libsql-conformance/README.md‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,99 @@ This module runs a selected subset of the xerial `sqlite-jdbc` test sources agai
44
libSQL over the Hrana protocol. It is a compatibility check for the JDBC driver, not a
55
claim that a `jdbc:sqlite:` URL is served by a local SQLite file.
66

7+
## Conformance status
8+
9+
This section is the canonical answer to "have we reached conformance with
10+
xerial?". The short answer is: yes for the selected subset below, verified
11+
against the reference probe; no for full xerial parity, and full parity is
12+
not the goal. The exclusions are deliberate compromises of running SQLite
13+
semantics remotely over Hrana, grouped below. Per-test selection, rejection,
14+
and divergence reasons are
15+
recorded in [`../upstream-xerial_sqlite-jdbc.manifest`](../upstream-xerial_sqlite-jdbc.manifest);
16+
this statement does not duplicate them.
17+
18+
### Selected subset and reference probe
19+
20+
The suite vendors the pinned xerial `sqlite-jdbc` 3.53.4.0 test tree and
21+
selects the tests that exercise JDBC behavior through ordinary SQL, so the
22+
Hrana transport can satisfy them unchanged. The manifest selects 13 test
23+
classes plus the shared `Utils` support class: `ResultSetTest`,
24+
`InsertQueryTest`, `FetchSizeTest`, `CachedRowSetTest`, `JSON1Test`,
25+
`MetadataLeakTest`, `PreparedStatementThreadTest`,
26+
`ResultSetWithoutResultsTest`, `RSMetaDataTest`, `DBMetaDataTest`,
27+
`StatementTest`, `PrepStmtTest`, and `SavepointTest`. The remaining 26
28+
classes in the pinned tree stay upstream for the reasons in the manifest. Deliberate divergences
29+
in a selected test, where the Hrana connection lifecycle makes the original
30+
behavior impossible, are recorded as `# divergence:` lines in the same
31+
manifest.
32+
33+
The reference probe is the `xerial-control` Maven profile defined in
34+
[`pom.xml`](pom.xml): it runs the same vendored manifest against the pinned
35+
xerial 3.53.4.0 driver instead of the libSQL driver. Both drivers are on the test class path, so the control run removes
36+
every visible driver and registers the xerial driver explicitly, and the
37+
build rejects a hand-set `conformance.control.driver` so the probe can only
38+
be selected through the profile. Run it with:
39+
40+
```bash
41+
./mvnw -pl libsql-conformance -am -Pxerial-control verify
42+
```
43+
44+
Run the libSQL conformance suite itself, against the pinned sqld image,
45+
with:
46+
47+
```bash
48+
./mvnw -pl libsql-conformance -am verify
49+
```
50+
51+
Last green result: 272 tests, 7 skipped, with `SavepointTest` included. The
52+
parity queue (#54) closed at 268 tests, 7 skipped.
53+
54+
### Three-layer contract
55+
56+
When the layers disagree, the contract is:
57+
58+
1. Hrana 3 is the source of truth for transport, values, metadata,
59+
batching, transactions, and error reporting. The protocol is specified
60+
in [`../vendor/HRANA_3_SPEC.md`](../vendor/HRANA_3_SPEC.md); where
61+
xerial behavior would require a primitive Hrana does not expose, the
62+
Hrana behavior wins.
63+
2. `java.sql` is the source of truth for the JDBC surface. Where JDBC
64+
makes a feature optional or defines the observable behavior, the
65+
driver follows `java.sql`, even when xerial chooses differently.
66+
3. xerial is a behavioral reference and the conformance foundation, never
67+
a copy target. Its tests define the selected subset and the control
68+
probe; its driver internals, configuration surface, and native
69+
behaviors are not reproduced.
70+
71+
### Compromise categories
72+
73+
Full parity is impossible without changing what the driver is: a remote
74+
Hrana client with no local file, no shared connection, and no native
75+
library. The rejected classes in the manifest group into four compromise
76+
categories, each with a concrete example:
77+
78+
| Category | Why parity is impossible | Example |
79+
|---|---|---|
80+
| Native extension API | The test registers JVM callbacks or loads native code in-process; Hrana exposes no equivalent primitive, so this cannot be reversed without a new Hrana or native primitive. | `UDFTest` registers JVM user-defined functions through sqlite-jdbc's native extension API. |
81+
| sqlite-jdbc configuration surface | The test exercises xerial's own configuration, `DataSource`, loading, or source conventions instead of portable JDBC over SQL; libSQL provides no counterpart. | `SQLiteConfigTest` tests the `SQLiteConfig` object, not the JDBC API. |
82+
| Remote-model semantics | The test asserts local-file or in-process SQLite semantics (file locking and multi-connection waits, shared cache, native error wording and codes) that a single remote sqld server over Hrana cannot reproduce; see "Hrana over HTTP" in `../vendor/HRANA_3_SPEC.md` for the baton and stream-expiry model behind this. | `TransactionTest` asserts SQLite file-locking and multi-connection wait behavior. |
83+
| Build-flag dependence | The test passes only when the server binary is built with a compile-time option that the pinned sqld image does not guarantee; this is addressable by pinning the server build, not by driver work. | `MathFunctionsTest` requires the server binary to be compiled with `SQLITE_ENABLE_MATH_FUNCTIONS`. |
84+
85+
The first three categories are permanent: the class stays upstream unless
86+
the underlying Hrana, sqld, or sqlite-jdbc surface changes. Build-flag
87+
dependence is the exception: the class stays upstream only until the sqld
88+
build is pinned to enable the flag.
89+
90+
### Savepoint support
91+
92+
Savepoints were the last addressable JDBC-surface gap. The driver now
93+
implements `Connection.setSavepoint()`, `setSavepoint(String)`,
94+
`rollback(Savepoint)`, and `releaseSavepoint(Savepoint)` as SQLite
95+
`SAVEPOINT`, `RELEASE`, and `ROLLBACK TO` statements over Hrana, and
96+
`DatabaseMetaData.supportsSavepoints()` returns `true`. `SavepointTest` is
97+
selected, so no JDBC-surface gap remains. No new server primitive was
98+
needed.
99+
7100
## URL mapping
8101

9102
The conformance driver maps `jdbc:sqlite:` URLs to sqld namespaces so the vendored

0 commit comments

Comments
 (0)