Skip to content

fix(conformance): persist file URLs across close and reopen - #67

Merged
magnusp merged 1 commit into
mainfrom
fix/43-conformance-file-persistence
Oct 21, 2026
Merged

magnusp merged 1 commit into
mainfrom
fix/43-conformance-file-persistence

Conversation

@magnusp

@magnusp magnusp commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Closes #43. Part of #54.

What changed

  • File URLs now map to a namespace derived from the normalized absolute path. Relative paths are resolved against the process working directory and normalized before hashing, so a relative path and the equivalent absolute path address the same namespace.
  • Path namespaces are retained after the last connection closes and reaped when the shared sqld container stops at suite end. Empty paths and :memory: remain isolated per-connection namespaces.
  • URL query strings are ignored when deriving the namespace, so URL pragmas such as ?journal_mode=WAL do not change the namespace. This limitation is documented.
  • Added XerialFileUrlPersistenceTest: it closes every connection, reopens the same file URL, and reads the table. A second test writes through an absolute path and reads through the equivalent relative path.
  • Added libsql-conformance/README.md documenting the URL mapping, persistence, and suite scope.

Contract decision

I used the preferred retention design from Steering rather than the documented-ephemerality escape hatch. sqld keeps a namespace after its last connection closes, so retaining the path namespace until suite end is workable and gives the vendored tests SQLite-like close-and-reopen behavior. This is harness integrity, not an xerial parity decision; no xerial contract was changed.

Evidence

Run with mise exec --:

  • Before the fix: ./mvnw -pl libsql-conformance -am -Dit.test=XerialFileUrlPersistenceTest verify
    • Result: BUILD FAILURE, 2 tests, 2 errors. Both new tests failed with SQLite error: no such table: persisted / SQLite error: no such table: mapped, proving the namespace was deleted on close and relative/absolute paths diverged.
  • After the fix: the same command
    • Result: BUILD SUCCESS, 2 tests, 0 failures, 0 errors.
  • ./mvnw -pl libsql-conformance -am verify
    • Result: BUILD SUCCESS, 117 tests, 0 failures, 0 errors, 1 skipped (the pre-existing @Disabled InsertQueryTest case).
  • ./mvnw -pl libsql-jdbc -am test
    • Result: BUILD SUCCESS, 80 tests, 0 failures, 0 errors.
  • ./mvnw spotless:apply
    • Result: BUILD SUCCESS, no files changed.

Deviations

None from the xerial contract. Harness limitation: URL pragmas remain ignored, now documented in the conformance README.

@magnusp
magnusp force-pushed the fix/43-conformance-file-persistence branch from d7e39fa to 5e02480 Compare October 21, 2026 22:34
@magnusp
magnusp force-pushed the fix/43-conformance-file-persistence branch from 5e02480 to 21a5da2 Compare October 21, 2026 22:38
@magnusp
magnusp merged commit 506f595 into main Oct 21, 2026
5 checks passed
@magnusp
magnusp deleted the fix/43-conformance-file-persistence branch October 21, 2026 22:42
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.

Conformance file URLs do not persist across close and reopen

1 participant