Repository navigation
[kyo-test, kyo-data, kyo-flow, kyo-system, kyo-sql] Conformance suites published as -conformance artifacts - #2015
Merged
Merged
Conversation
…s published as -conformance artifacts ## Problem kyo checks several contracts that more than one implementation must satisfy: `FlowStore`, `FileSystem`, the SQL backend SPI, and `Dolt`. Their suites lived in test sources, which no artifact publishes, so an implementation written outside kyo could not prove itself against the leaves kyo's own implementations pass. Each had also grown its own shape: - FlowStore's suite sat in kyo-flow's tests, runnable only there. - FileSystem's suites were a mix of classes and traits in kyo-system's tests, with no class per capability tier for an implementation to extend. - The SQL battery was 30 classes in the unpublished kyo-sql-tests, fed by descriptors discovered through a test-only `META-INF/services` registry, with a registration step per platform. DoltLite, a complete SQL backend, was not held to it at all. - `Dolt` had two suites that had drifted: 12 identical leaves, 3 reworded pairs, and 11 leaves only one engine ran. Publishing a suite as an ordinary artifact meets three obstacles: - sbt runs only test classes the consumer compiles, never a concrete suite inside a dependency jar, so a published suite has to be abstract. - Frame derivation is refused in package `kyo` outside `src/test/`, so a suite in a module's main sources does not compile. - kyo-test runs a leaf by its full name path. Two leaves under one path both ran the last body and the other never ran, silently. A suite assembled from several traits is exactly where that happens. ## Solution Each contract external code can implement ships its suite in a published, cross-built `<module>-conformance` module that depends only on the contract module and `kyo-test-api`. The suite is an abstract class per capability tier, with topics mixed in as traits; an implementation subclasses it in its test sources. - `kyo-flow-conformance`: `FlowStoreConformanceTest`. - `kyo-system-conformance`: `FileSystemReadConformanceTest` (with the lock suite, since `FileSystem.Read` declares locking), `FileSystemWriteConformanceTest` (write and channel suites) and `FileSystemWatchConformanceTest`. kyo-system-doltfs runs the read and write tiers. - `kyo-sql-conformance`: `SqlConformanceTest`, mixing the 28 existing suites plus the backend-neutral leaves of `SqlEndToEndTest` and `SqlRunTest`. The descriptor becomes the public `SqlConformanceBackend`, which carries the engine's own `kyo.db.Backend`; every client is opened through it, so a consumer needs no registry, service file or platform registration. Container provisioning leaves the published contract (a provisioning failure is a panic), and `reachable` defaults to true. The descriptors are a constructor parameter, since leaves register during construction: ```scala class MyEngineConformanceTest extends SqlConformanceTest(Seq(new MyEngineConformanceBackend)) ``` In kyo: - kyo-sql-tests runs the battery over Postgres, MySQL, SQLite and Dolt, with their descriptors moved in from the backend modules' test trees. The services files, the test registry and the per-platform descriptor registration are gone. A leaf asserts every one of the four is reachable, since the battery cancels a comparison it has one engine for, and another that their ids are distinct. - `.run` renders SQL at compile time for the dialects on the compile classpath and at run time when there are none, so the published battery always renders at run time. kyo-sql-tests compiles a second copy of the leaf traits, generated into `kyo.folded`, and runs the four engines through it, so compile-time SQL still executes against every engine. The published classes run from the SQLite external-package subclass and from DoltLite. - DoltLite runs the battery from its own module: its engine exports the same `sqlite3_*` symbols as SQLite, so one Native binary cannot link both. It cancels where the engine is not published. SQLite and DoltLite share their capability answers through `SqliteLineageConformanceBackend` in the driver's tests, over a temp database that now works on every platform. - Every tier has a subclass declared outside package `kyo`, proving a consumer needs no package-private access. - `SqlBackendNeutralitySourceTest` scans every file of kyo-sql-conformance. - `Dolt` stays closed (`private[kyo]` constructor), so its two suites become one `DoltConformanceTest` trait in kyo-sql-dolt-api's tests, run by both engines. The differences are three declared capabilities asserted from both sides (`recordsAuthor`, `recordsCommitOrder`, `keepsConflictsPastMerge`). Every leaf about version control runs on both; the three about DoltLite's own URL, statement API and platform stay in `DoltLiteClientTest`. File remotes come from the fixture, so DoltLite's are scoped temp directories. Supporting changes: - kyo-test's runner refuses duplicate leaf paths: a path registered more than once fails once, naming the count, and none of its bodies runs. - `FindEnclosing` exempts `*Test.scala`/`*Spec.scala` under `-conformance/<platform>/src/main/`, extracted as `isExempt` and tested. - kyo-sql: with no dialect on the compile classpath, `.run` falls back to `.runDynamic` by splicing the caller's query tree. An inline operator that called another inline member on `this` (`like`, `notLike`, `ilike`, `notIlike`, `++`, `substring`, and `+`/`-`/`*` with a value) left a type tree with no position there, which `-Xcheck-macros` rejects. The operators spell the cast directly and `liftedAs` moves to the `Sql` object. kyo-sql-conformance is the first module to compile queries with no dialect. - A battery leaf spelled PostgreSQL's `SERIAL` inline and passed on SQLite only through its NULL-in-primary-key allowance; DoltLite enforces NOT NULL. The descriptor gains `narrowAutoIncrementPrimaryKey`. - The Dolt cherry-pick leaf picked onto the picked commit's own parent, where a content-addressed engine answers the original hash when the second matches. The branch now moves first, and the leaf asserts the new parent. Docs: a root CONTRIBUTING "Conformance Suites" section and a note on unique leaf paths; kyo-flow, kyo-system and kyo-sql READMEs document their artifact; kyo-sql and kyo-system CONTRIBUTING describe the battery's location, its two compiled copies, the neutrality scan, the tiers and the shared Dolt suite. ## Notes - JVM, with Postgres, MySQL and Dolt in containers: the kyo backends battery 714 passed; DoltLite 188 passed, 3 cancelled; the SQLite external-package subclass 188 passed, 3 cancelled (comparison leaves with one engine); `DoltConformanceTest` 23 on each engine; `SqlEndToEndTest`, the neutrality scan, `SqliteAttachTest` and the no-dialect test green. The folded copy's class files carry MySQL's rendered SQL as constants; the published ones carry none. - FileSystem: every read tier runs 31 leaves (12 read, 19 lock) and every write tier 8, on the host, the read-only user backend, the external-package subclasses and doltfs, JVM. FlowStore passes on JVM, JS, Wasm and Native. The SQL and Dolt suites were run on the JVM and compile on JS, Native and Wasm; running them there is left to CI. - The no-dialect reproduction failed for every listed operator before the fix. The duplicate-path test failed before the runner change. - A list-only scan of all 1686 JVM kyo-test suites found no existing duplicate path. - Every leaf registered on main in a touched test file was traced to the new tree and its body compared. Six names are not found verbatim, all deliberate: the three Dolt leaves each merged into its counterpart with the union of both assertions, the two `SqlTestBackendsTest` leaves went with the discovery registry they tested (the distinct-id guard now sits on the aggregate), and the FileSystem declaration leaf now asserts each tier's composition instead of that five `classOf` values fit in a `Chunk`. - On JS and Wasm the SQLite and DoltLite batteries now run instead of reporting their descriptor unreachable, which CI exercises for the first time. - kyo-compat keeps its source bundle, the shape its per-binding `CIO` requires.
Two scaladoc links in kyo-sql-conformance pointed at kyo-sql test classes, which the published module cannot see, so scaladoc failed the release probe. The prose now names what those tests cover instead of linking them, and the battery's headers say a backend is listed rather than registered or discovered, since SqlConformanceTest takes its backends as a constructor argument.
This was referenced Oct 30, 2026
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.
Problem
kyo checks several contracts that more than one implementation must satisfy:
FlowStore,FileSystem, the SQL backend SPI, andDolt. Their suites lived in test sources, which no artifact publishes, so an implementation written outside kyo could not prove itself against the leaves kyo's own implementations pass. Each had also grown its own shape:META-INF/servicesregistry, with a registration step per platform. DoltLite, a complete SQL backend, was not held to it at all.Dolthad two suites that had drifted: 12 identical leaves, 3 reworded pairs, and 11 leaves only one engine ran.Publishing a suite as an ordinary artifact meets three obstacles:
kyooutsidesrc/test/, so a suite in a module's main sources does not compile.Solution
Each contract external code can implement ships its suite in a published, cross-built
<module>-conformancemodule that depends only on the contract module andkyo-test-api. The suite is an abstract class per capability tier, with topics mixed in as traits; an implementation subclasses it in its test sources.kyo-flow-conformance:FlowStoreConformanceTest.kyo-system-conformance:FileSystemReadConformanceTest(with the lock suite, sinceFileSystem.Readdeclares locking),FileSystemWriteConformanceTest(write and channel suites) andFileSystemWatchConformanceTest. kyo-system-doltfs runs the read and write tiers.kyo-sql-conformance:SqlConformanceTest, mixing the 28 existing suites plus the backend-neutral leaves ofSqlEndToEndTestandSqlRunTest. The descriptor becomes the publicSqlConformanceBackend, which carries the engine's ownkyo.db.Backend; every client is opened through it, so a consumer needs no registry, service file or platform registration. Container provisioning leaves the published contract (a provisioning failure is a panic), andreachabledefaults to true. The descriptors are a constructor parameter, since leaves register during construction:In kyo:
.runrenders SQL at compile time for the dialects on the compile classpath and at run time when there are none, so the published battery always renders at run time. kyo-sql-tests compiles a second copy of the leaf traits, generated intokyo.folded, and runs the four engines through it, so compile-time SQL still executes against every engine. The published classes run from the SQLite external-package subclass and from DoltLite.sqlite3_*symbols as SQLite, so one Native binary cannot link both. It cancels where the engine is not published. SQLite and DoltLite share their capability answers throughSqliteLineageConformanceBackendin the driver's tests, over a temp database that now works on every platform.kyo, proving a consumer needs no package-private access.SqlBackendNeutralitySourceTestscans every file of kyo-sql-conformance.Doltstays closed (private[kyo]constructor), so its two suites become oneDoltConformanceTesttrait in kyo-sql-dolt-api's tests, run by both engines. The differences are three declared capabilities asserted from both sides (recordsAuthor,recordsCommitOrder,keepsConflictsPastMerge). Every leaf about version control runs on both; the three about DoltLite's own URL, statement API and platform stay inDoltLiteClientTest. File remotes come from the fixture, so DoltLite's are scoped temp directories.Supporting changes:
FindEnclosingexempts*Test.scala/*Spec.scalaunder-conformance/<platform>/src/main/, extracted asisExemptand tested..runfalls back to.runDynamicby splicing the caller's query tree. An inline operator that called another inline member onthis(like,notLike,ilike,notIlike,++,substring, and+/-/*with a value) left a type tree with no position there, which-Xcheck-macrosrejects. The operators spell the cast directly andliftedAsmoves to theSqlobject. kyo-sql-conformance is the first module to compile queries with no dialect.SERIALinline and passed on SQLite only through its NULL-in-primary-key allowance; DoltLite enforces NOT NULL. The descriptor gainsnarrowAutoIncrementPrimaryKey.Docs: a root CONTRIBUTING "Conformance Suites" section and a note on unique leaf paths; kyo-flow, kyo-system and kyo-sql READMEs document their artifact; kyo-sql and kyo-system CONTRIBUTING describe the battery's location, its two compiled copies, the neutrality scan, the tiers and the shared Dolt suite.
Notes
DoltConformanceTest23 on each engine;SqlEndToEndTest, the neutrality scan,SqliteAttachTestand the no-dialect test green. The folded copy's class files carry MySQL's rendered SQL as constants; the published ones carry none.SqlTestBackendsTestleaves went with the discovery registry they tested (the distinct-id guard now sits on the aggregate), and the FileSystem declaration leaf now asserts each tier's composition instead of that fiveclassOfvalues fit in aChunk.CIOrequires.