Skip to content

Testing guide, DROP by name (F70) and older SQLite versions in CI - #137

Open
qiaoyuang wants to merge 16 commits into
release/2.7.0from
feature/new-features-2.7.0
Open

qiaoyuang wants to merge 16 commits into
release/2.7.0from
feature/new-features-2.7.0

Conversation

@qiaoyuang

@qiaoyuang qiaoyuang commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

The first part of 2.7.0, from feature/new-features-2.7.0: a guide to testing, dropping a table or a view by its name (F70), and the native tests on older SQLite versions in CI, whose SQLite libraries CI now builds. Every item has its entry in CHANGELOG.md. This is the first run of the CI changes, which can't run on a feature branch.

Roadmap and documentation

  • F70 and F71 join the roadmap (04995f2). Both come from MyMovie's move to 2.6.0: F70, High, to drop what has no class any more in a migration; F71, Low, reads that depend on a page in pagingSource, for a one-to-many relation, which no user needs yet.
  • A guide to testing, in English and Chinese, against a real SQLite on each platform (bf9c299). What it says was measured first: Robolectric's SQLite is 3.32.2 at every SDK level up to 34, 3.44.3 at 36 and 3.50.6 at 37, so the SDK level chooses the framework code, not the SQLite version; the --add-exports JVM argument is needed at SDK 36 and 37; each Robolectric test has a data directory of its own; and sqllin-processor added to kspJvmTest or kspAndroidHostTest generates the tables of the @DBRow classes of the test source sets, which only the platform's test source set can use. It ends with a recipe for testing a migration.
  • The guide to getting started says that the createSQL of a table with a converted column is computed when it's read; the guide to advanced queries, that a page of pagingSource is one SELECT, and what to do with a one-to-many relation (bf9c299).

New feature

  • F70: DROP_TABLE(name), DROP_TABLE_IF_EXISTS(name), DROP_VIEW(name) and DROP_VIEW_IF_EXISTS(name), experimental, so that a migration can drop a table or a view whose class is gone, as DROP_INDEX(name) and DROP_TRIGGER(name) do an index and a trigger. The kind is in the name, as SQLite's DROP TABLE fails for a view. (7958510)

Fixes

  • B1: PRAGMA_COMPILE_OPTIONS() failed with "This SQLite doesn't have PRAGMA compile_options" on a SQLite before 3.16.0 that has the PRAGMA, whose column is named compile_option there, rather than compile_options, by which SQLlin told whether it has it. It came with the PRAGMA in 2.6.0 (F30), and the first run of the job of SQLite 3.9.2 found it. Android's SQLite, built without the PRAGMA, still fails, as documented. (484f9ae)
  • B2: an INSERT of entities that bind more than 999 values failed with "too many SQL variables" on a SQLite before 3.32.0, as on Android before API 31, as all the values were bound to one statement. It now runs in batches of at most 999 values, whatever the SQLite, in a transaction, so that it inserts all or none, as one statement does, but INSERT_OR_FAIL, which keeps the rows before the one that fails. Its SQL, which a trigger writes into its body, is still one statement. An IN of a list that long still fails there, which its documentation now says, and the roadmap has F72, Low, to write such a list as literals. (47f6641)
  • B3: a join with a view, or with a derived table, failed with "no such column" on a SQLite before 3.20.0, as on Android before API 28, which names the columns of a query that reads a view or derived table it flattens as they are written, as person.name, while SQLlin reads them by its properties' names. Each column a join selects is now named with AS, as person.name AS name. Measured with the sqlite3 shell of 3.9.2 to 3.22.0: the threshold is 3.20.0, and with AS every version names them right. It came with the joins of relations in 2.5.0. (5f22329)
  • B4: on Android 13 and 14, a scope that changed the schema while queries were observed failed with "the connection is read-only" after its statements had run: the tracker of observed queries ran CREATE TEMP TRIGGER IF NOT EXISTS outside a transaction, which does nothing where the trigger exists, so that the framework ran it on a connection that reads, which has no TEMP objects. It now writes them in a transaction, and creates its TEMP table only where it isn't. Found by the first run on emulators, reproduced on Robolectric at SDK 33 and 34, which the Android tests on Robolectric now run at too. (86c7eb0)
  • Documentation: Android 7.0 and 7.1 can't hold lower and upper, ICU's, in an index, as their SQLite 3.9 doesn't mark them deterministic, while the guide gave lower(name) as the example of an expression index: the guides say so, and to use COLLATE NOCASE there. Found by the first run on emulators. (12b2a07)

CI

  • The SQLite libraries are built in CI (292d7e8). libs/linux/libsqlite3.a and libs/windows/libsqlite3.a are removed. scripts/build-sqlite.sh builds them from the sources of sqlite.org, whose SHA-256 it checks, with zig; for 3.51.1 it gives the bytes of the removed ones. The action .github/actions/sqlite caches them, and builds them on a miss with the zig of PyPI. On Windows, the tests now link the library in libs before that of MSYS2.

  • The native tests run on older SQLite versions (3582647): the new job test-on-older-sqlite runs those of sqllin-driver and sqllin-dsl on Linux, linked with SQLite 3.9.2, 3.18.2, 3.22.0 and 3.28.0, those of Android API 24, 26, 28 and 30, which no test ran on, and checks that the test binary holds that version. The tests of what depends on the version now ask for it: RENAME COLUMN, the tree of a query plan, the CHECK constraints that integrity_check verifies, a rename that rewrites the views, and the date and time functions in an index, which the guide to SQL functions now says.

  • The Android tests run on emulators, by hand (4936245, 0c81692, 2c7d22e): the new workflow emulator.yml runs the device tests of sqllin-driver and sqllin-dsl-test on emulators of API 24, 30, 34 and 37, one of each path of the Android driver and of each version of Android's own SQLite that SQLlin's APIs need, which Robolectric doesn't run. It runs from the Actions tab once it is on the default branch, and by the label emulator-test of a pull request before. Each module keeps one class of Android tests, run by AndroidJUnit4, which both Robolectric and the device compile.

  • Shorter runs on emulators (e6ae70b): the emulator runs with -no-snapshot-save, as it saved a snapshot nothing read, and the job of the first level writes the Gradle cache, which a pull request only read, so that later runs reuse the build's outputs: building the test APKs went from 140–212 to 62–95 seconds, and a job from 4–5.5 to 2.7–3.5 minutes. No AVD cache: with KVM an emulator boots in about 30 seconds, and the repository's caches were at the 10 GB GitHub keeps.

  • The cache of Kotlin/Native is keyed by the Kotlin version (1c37e99), rather than by every build script, whose each change stored another copy of 700–850 MB on each system.

Testing

  • Locally, sqllin-dsl-test passes jvmTest (120 tests) and testAndroidHostTest on Robolectric API 26, 34 and 37 (360), and sqllin-driver its JVM (13) and Android (40) tests.
  • The native tests haven't run. The development machine is an Intel Mac without any VM. They are compiled for macosArm64, linuxX64 and mingwX64, and the Linux test binaries are linked with SQLite 3.9.2.
  • What the job of older versions would meet was looked for on the JVM, with the SQLite of sqlite-jdbc 3.14.2 to 3.28.0; what is left there is those releases' own. Six tests stop at such a message on 3.14.2, so the job of 3.9.2 may still find more.
  • The first run of CI passed every job, the Windows one, which builds its library with Git Bash, Python and the zig of PyPI, included, but that of 3.9.2, which failed in testMorePragmas on B1. With B1, testMorePragmas passes on the JVM with sqlite-jdbc 3.15.1, where it failed so without it; the rest of it, after compile_options, hasn't run on 3.9.2 yet. testInsertManyRows of B2 fails with "too many SQL variables" without the fix on sqlite-jdbc 3.14.2.1, whose SQLite takes 999 parameters, and passes with it. testJoinColumnNames of B3, and the join of testSubquery, fail with "no such column" without the fix on sqlite-jdbc 3.18.0 and pass with it; the second run of CI passed every job, the one of 3.9.2 included.
  • The first run on emulators passed on API 30 and 37, and found B4 on API 34 and the documentation fix on API 24. With them, the next two runs passed on all four levels: sqllin-driver 14 tests, one skipped below Android P, and sqllin-dsl-test 120.

🤖 Generated with Claude Code

qiaoyuang and others added 11 commits November 12, 2026 23:32
Both come from MyMovie's move to 2.6.0.

F70, High: drop a table or a view by its name. Its migration drops a
table whose class is gone, which DROP_IF_EXISTS can't name, so it
borrows another table's withName. DROP_INDEX and DROP_TRIGGER already
take names; the kind goes in the name, DROP_TABLE and DROP_VIEW, as a
bare name can't tell which it is, and DROP TABLE fails on a view.

F71, Low: reads that depend on a page in the PagingSource of F13, for
a one-to-many relation that queries need as rows. MyMovie no longer
needs it, having made its relation a converted column, and such a
source can be written on the tokens of F66 today, so it waits for a
user. The item records what the discussion settled: the reads are for
a whole page and return an item for each row, their tokens join the
page's, and they must not be skipped for what the page holds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The guide to testing, in English and Chinese, is about testing against
a real SQLite on each platform. What it says was measured first:

- Robolectric 4.17 runs SQLite 3.32.2 at every SDK level up to 34,
  3.44.3 at 36 and 3.50.6 at 37, so the level of @config chooses the
  framework code, not the SQLite version: a statement that needs a newer
  SQLite passes at sdk 24, and DROP COLUMN fails at sdk 34. What depends
  on the version needs an emulator or a device.
- Without --add-exports=java.base/jdk.internal.access, the tests of SDK
  36 and 37 fail on JDK 21, and those of 34 and lower pass.
- Robolectric gives each test a data directory of its own, so a host
  test only has to close its database, where a JVM or native test has to
  delete the file too.
- sqllin-processor added to kspJvmTest or kspAndroidHostTest generates
  the tables of the @DBRow classes of the test source sets, and only
  those. The code that uses such a table has to be in the platform's
  test source set: in commonTest it fails with an unresolved reference,
  as the table belongs to the platform's compilation.
- observe in the test's own context, with runCurrent, shows that nothing
  is emitted, and PRAGMA_TABLE_INFO of a table that doesn't exist returns
  an empty list, which the recipe for a migration test checks with. Both
  ran as a test on the JVM.

The guide to getting started now says that the createSQL of a table
with a converted column is computed when it is read, so the generated
code holds no CREATE statement to search for. The guide to advanced
queries says that a page of pagingSource is one SELECT, what to do with
a one-to-many relation, and not to skip its read for what a page holds,
or its table is in no token.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A migration drops a table whose class is gone, for which there is no
table object to give to DROP or DROP_IF_EXISTS. MyMovie's upgrade to
its version 3 had to borrow another table's withName to name one.

DROP_TABLE(name), DROP_TABLE_IF_EXISTS(name), DROP_VIEW(name) and
DROP_VIEW_IF_EXISTS(name) take the name, as DROP_INDEX and DROP_TRIGGER
do, and are experimental. The kind is in the function's name, as a bare
name can't tell a table from a view, and SQLite's DROP TABLE fails for a
view, and DROP VIEW for a table, with IF EXISTS too. A blank name is
rejected as the statement is built, as withName rejects one, so that no
statement of its scope runs. The statements are the ones DROP builds, so
they are schema changes to the observed queries, as before.

testDropByName covers a migration that drops a table and a view by their
names, what doesn't exist, the other kind, an FTS table and blank names.
sqllin-dsl-test passes jvmTest (118) and testAndroidHostTest (236, on
Robolectric API 26 and 37); the native tests are compiled for
macosArm64, linuxX64 and mingwX64, and not run, as this machine can't.

The guide to modifying the database, in English and Chinese, describes
them in a new section, and the guide to testing drops its table so.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
libs/linux/libsqlite3.a and libs/windows/libsqlite3.a, which the native
tests on Linux and Windows link, were binaries in the repository, built
on one machine, with nothing in the repository that told how.

scripts/build-sqlite.sh builds one from the sources of a SQLite version
that sqlite.org publishes, whose SHA-256 it checks, with zig, which
compiles for both targets on any host. It keeps the options and targets
of the libraries that were in libs: for SQLite 3.51.1 it gives their
bytes, on this machine with the zig of Homebrew and with that of PyPI,
which CI installs. It takes the autoconf sources, as sqlite.org has no
amalgamation of some patch releases, as 3.18.2, and the sqlite3.c of
both is the same file.

The composite action .github/actions/sqlite restores the library from
the cache, or builds it: a version's library only changes when the
script or the action does, which the key holds, so neither zig nor the
sources are downloaded otherwise. The Linux and Windows jobs build
3.51.1 with it. The libraries are removed and libs is ignored; whoever
runs those tests on a Linux or Windows machine runs the script.

.gitattributes keeps the script's line endings, as the checkout of a
Windows runner would make them CRLF, which bash doesn't run. On Windows
the tests now look for the library in libs before the directory of
MSYS2, as they do on Linux before the system's, so that they link the
SQLite that was built for them.

What ran here: the script, for both targets and five versions. The
workflow can only run in CI, which doesn't run on this branch.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
No test ran on a SQLite older than 3.32.2, which Robolectric has at
every SDK level up to 34, while Android has 3.9 at API 24, SQLlin's
minimum. The new job test-on-older-sqlite runs the native tests of
sqllin-driver and sqllin-dsl on Linux, linked with SQLite 3.9.2, 3.18.2,
3.22.0 and 3.28.0, those of Android API 24, 26, 28 and 30, which the
action of the commit before builds, and checks that the test binary
holds that version. It tells what those versions take, not what
Android's build of them or its framework does.

The tests of what depends on the version now ask for it, as those of
the newer PRAGMAs did: RENAME COLUMN (3.25.0), the tree of a query plan
(3.24.0), the CHECK constraints that integrity_check verifies (3.18.0),
a rename that rewrites the views that read the table (3.26.0, and a
legacy one always before 3.25.0), and the date and time functions in an
index (3.20.0), which the guide to SQL functions now says.

This machine can't run a Linux binary, so what the job will meet was
looked for on the JVM, with the SQLite of older releases of sqlite-jdbc,
3.14.2 to 3.28.0, which the tests don't run on otherwise. What is left
there is those releases' own: their error messages, and functions that
only they bundle. Six tests stop at such a message on 3.14.2, so the job
of 3.9.2 may still find more. The Linux tests link 3.9.2 here.

Two things found so that aren't fixed, and are marked KNOWN ISSUE where
the tests go around them:

- Before SQLite 3.20.0, Android 7.0 to 8.1, the result columns of a
  join that reads a view, or a derived table that SQLite flattens, are
  named with their tables, as person_with_id.name, so SQLlin, which
  looks them up as name, can't read the rows. testSubquery runs that
  join from 3.20.0 on.
- An INSERT binds the values of all its rows in one statement, and a
  SQLite before 3.32.0, Android before API 31, takes 999 parameters by
  default. testPragmas and testMorePragmas insert their 300 rows 100
  at a time.

sqllin-dsl-test passes jvmTest (118) and testAndroidHostTest (236), and
sqllin-driver its 13 and 27; the native tests are compiled.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The first run of the job of SQLite 3.9.2 failed in testMorePragmas:
PRAGMA_COMPILE_OPTIONS() threw "This SQLite doesn't have PRAGMA
compile_options." A PRAGMA that a SQLite may lack is checked by the
name of its first column, as one that SQLite lacks returns no columns,
and before SQLite 3.16.0 the column of compile_options is named
compile_option. Measured with the SQLite of sqlite-jdbc: 3.8.11, 3.14.2
and 3.15.1 name it compile_option, and 3.16.1 and 3.18.0
compile_options; the source of 3.9.2 sets compile_option, and that of
3.18.2 the PRAGMA's name. The other PRAGMAs that SQLlin reads by name
have the same columns in 3.9.2 as in 3.51.1.

The check now takes a list of names, and compile_options both. It came
with the PRAGMA in 2.6.0 (F30). Android's SQLite is built without the
PRAGMA, which fails as before, and the Apple systems that SQLlin
supports have newer versions, so it met a SQLite that an app links on
Linux or Windows.

On the JVM with sqlite-jdbc 3.15.1, testMorePragmas fails with the
error of CI without the fix and passes with it. sqllin-dsl-test passes
jvmTest (118) and testAndroidHostTest (236); the native tests are
compiled. Whether the rest of testMorePragmas passes on 3.9.2, which
the failure kept from running, the next run of CI tells.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An INSERT of entities bound the values of all its rows to one
statement, and a SQLite before 3.32.0, as Android's before API 31,
takes 999 parameters in a statement by default, so that 334 rows of 3
columns failed there with "too many SQL variables". The job of SQLite
3.9.2 would have met it in testPragmas, which inserts 300 rows of 4.

Where the rows bind more than 999 values, the statement now runs as
batches of rows that bind at most 999 each, whatever the SQLite: the
limit is a compile-time option that a connection can lower, which not
every platform can read, and the error has no code of its own to retry
on. The batches run in a transaction, so that all the rows are inserted
or none, as one statement does, nested in the scope's own; but those of
INSERT OR FAIL, which keeps the rows a statement inserted before the one
that fails, and so the batches before. The statement's SQL is still one
statement of all the rows, which a trigger writes into its body, where
nothing is bound, and which the log shows. A row is never split.

An IN of a list binds its values too, and can't be split, as ORDER BY,
LIMIT and aggregates would change. Its documentation, and the guide to
advanced queries, now say that a list of more than 999 values fails
before SQLite 3.32.0, and the roadmap has F72, Low, to write such a
list into the SQL as literals.

testInsertManyRows inserts 12,000 rows of 3 columns, 36,000 values, more
than any SQLite takes by default, and 400 rows whose last conflicts, in
the second batch: INSERT and INSERT_OR_ABORT insert none of them,
INSERT_OR_FAIL keeps 399, INSERT_OR_IGNORE skips the last, and
INSERT_OR_ROLLBACK in a transaction undoes the statement before too.
Without the transaction the first batch's 333 rows stay, and with one
around INSERT OR FAIL its 399 rows go, which the test fails on. On the
JVM with sqlite-jdbc 3.14.2.1, whose SQLite takes 999 parameters, it
fails with "too many SQL variables" without the fix and passes with it;
newer releases of sqlite-jdbc raise the limit. testPragmas and
testMorePragmas insert their 300 rows in one INSERT again.

sqllin-dsl-test passes jvmTest (119) and testAndroidHostTest (238); the
native tests are compiled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SQLite only names a result column as the SQL says where it has AS, and
before 3.20.0, as on Android before API 28, the columns of a query that
reads a view, or a derived table, that SQLite flattens into it were
named as they are written. SQLlin writes the columns of a join with
their relations' names, as person.name, and reads a row's columns by
its properties' names, so such a join failed with "no such column".

Measured with the sqlite3 shell of 3.9.2, 3.18.2, 3.19.3, 3.20.0,
3.20.1, 3.21.0 and 3.22.0, on the SQL SQLlin writes: up to 3.19.3, a
join with a simple view or a simple derived table names its columns
book.name and adult_person.age, as do its UNION and its DISTINCT, and
from 3.20.0 on, name and age. Joins of tables, a view or derived table
with an aggregate, which isn't flattened, the column that USING merges,
which SQLlin writes without a relation, a view defined by such a join,
and the SELECT * that pagingSource wraps a page in, were named right on
every version; and with AS, every one of them is.

Each column that a join selects, in a projection or among result
columns, is now named as its property with AS, as person.name AS name,
which is the name the row is read by. Its name is the same as before
where SQLite named it right, so a derived table or a view defined by a
join keeps its columns. It came with the joins of relations in 2.5.0.

testJoinColumnNames joins book with a view, in a projection, in result
columns, with DISTINCT, in a UNION and in a LEFT OUTER JOIN, and
testSubquery runs its join with a flattened derived table on every
version again. On the JVM with sqlite-jdbc 3.18.0 both fail with "no
such column" without the fix, and pass with it. The jobs of SQLite 3.9.2
and 3.18.2 in CI run them on Linux.

The guide to advanced queries, in English and Chinese, says why the
columns of a join have AS, and its examples show the SQL.

sqllin-dsl-test passes jvmTest (120) and testAndroidHostTest (240); the
native tests are compiled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Android tests only ran on Robolectric, whose SQLite is 3.32.2 at
every SDK level up to 34 and 3.50.6 at 37, so Android's own build of
its SQLite versions never ran under the framework. sqllin-driver and
sqllin-dsl-test now have device tests, as they did before the tests
moved to Robolectric, which the workflow of the next commit runs.

Each module keeps one class of Android tests, rather than a second list
of them for devices: it moves to src/androidSharedTest, which both the
host and the device tests compile, and runs with AndroidJUnit4 rather
than RobolectricTestRunner. AndroidJUnit4 hands it to Robolectric on the
JVM, where @config keeps its SDK levels, and runs it on the device
otherwise, where @config does nothing, which robolectric's annotations
let the device tests compile. The device tests are in the source set
tree of the host tests, so the driver's ones compile its commonTest.

testLookasideConfig, which reads OpenParams, ran only at SDK 37 by its
@config, and is skipped below Android P on a device.

Robolectric runs the same tests as before, by name: sqllin-driver 27
and sqllin-dsl-test 240. The device test APKs build and hold the test
classes, the common ones and the generated tables; the tests haven't run
on a device, as this machine can't run the emulator. assemble and
publishing build no device tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The new workflow emulator.yml runs the device tests of sqllin-driver
and sqllin-dsl-test on emulators of API 24, 30, 34 and 37, one of each
path the Android driver takes, as it branches at P and at TIRAMISU, and
of each version of Android's SQLite that SQLlin's APIs are documented
to need: 3.9, 3.28, 3.39 or 3.42, and 3.50. The levels in between are
covered otherwise: their SQLite by the native tests on Linux on older
versions, 3.32.2 by Robolectric, and their paths by these levels.

It only runs by hand, as emulators are slow: from the Actions tab, with
the levels to run on, once it is on the default branch, where GitHub
looks for a workflow to dispatch, and by the label emulator-test of a
pull request, which runs it before. The levels run in parallel, and one
failing doesn't stop the others.

The emulators are the x86_64 default images, made from scratch each
time, without the AVD cache that the workflow before Robolectric had:
it costs a minute or two of each run, which only runs by hand. API 37's
packages are named android-37.0, which the matrix uses. Both modules run
in one Gradle invocation with --continue, so that a failure of the
first neither stops the second nor goes unnoticed, as the earlier
workflow's "./gradlew A & ./gradlew B" let the first fail. The run
prints the level and the version of the image's sqlite3, and uploads the
reports whether it passes or not.

Checked here: the YAML, the matrix of the levels given, and the names of
the platform and system image packages of each level, by sdkmanager. It
hasn't run yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guide to testing, in English and Chinese, says that SQLlin's
workflow emulator.yml runs its Android tests on emulators of API 24,
30, 34 and 37, which tells what Android's own build of SQLite and its
framework do, where the native tests on older SQLite versions only tell
what those versions take. The change log says how to run it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qiaoyuang qiaoyuang added the emulator-test Runs the Android tests on emulators (emulator.yml) label Nov 21, 2026
qiaoyuang and others added 3 commits November 21, 2026 21:38
The first run of the Android tests on emulators failed on API 34 in
testObserve, testView and testObserveRestoresTracking: "Cannot execute
this statement because it might modify the database but the connection
is read-only", thrown by a scope after its statements had run.

The tracker of the observed queries keeps a TEMP table and TEMP
triggers, which only the connection that created them has. After a
schema change, refresh runs CREATE TEMP TRIGGER IF NOT EXISTS for each
tracked table again, outside a transaction, and the trigger exists, so
the statement does nothing on that connection. From Android 13 on, a
database in WAL mode reads through several connections, and the
framework runs a statement that SQLite reports read-only, as one that
does nothing, on one that reads outside a transaction: there the
trigger doesn't exist, so the statement would create it, which the
framework refuses. restoreLostObjects did the same, and so did track's
CREATE TEMP TABLE IF NOT EXISTS of the log once it existed.

Reproduced on Robolectric, whose framework code is Android's: the three
tests fail at SDK 33 and 34, and pass at 36 and 37, and at 26, where a
database has one connection. The JVM and Kotlin/Native have one too.

refresh, which only runs after a scope that changed something and so
can write, now reads and writes the TEMP objects in one transaction,
which runs on the connection that writes, in place of the two it began
to read them. track can't begin one, as a transaction on Android takes
the write lock, which a read-only database refuses: BEGIN IMMEDIATE
fails there with "attempt to write a readonly database", measured with
SQLite 3.22. It creates the log only where it isn't, before it tracks a
table first, so that the statement does something, and creates it again
where a rollback took it, as one of a blocking scope on another thread
can on the JVM and Kotlin/Native, when inserting a row into it fails.

The Android tests on Robolectric now run at SDK 34 too, between 26 and
37, so that CI runs the framework code of several connections on every
pull request: sqllin-driver 40 and sqllin-dsl-test 360 pass. It came
with observed queries in 2.5.0, and restoring the tracking in 2.6.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first run of the Android tests on emulators failed on API 24 in
testExpressionIndex: CREATE UNIQUE INDEX ... ON product(lower(name))
failed with "non-deterministic functions prohibited in index
expressions". Android's SQLite takes lower and upper from ICU, and the
ICU extension of SQLite 3.9, Android 7.0 and 7.1's, registers them
without SQLITE_DETERMINISTIC, which that of 3.18.2 has; an index can
only hold a deterministic function. The job of SQLite 3.9.2 on Linux
passed, as that SQLite has no ICU.

SQLlin can't tell, so nothing changes in it, but the guide to modifying
the database, in English and Chinese, gave lower(name) as the example of
an expression index. It now says that Android 7.0 and 7.1 can't hold
lower and upper in an index, and to give the column of the index the
collation NOCASE there, which every version takes, but which only
ignores the case of the ASCII letters. So do the guide to SQL functions
and the documentation of lower and upper.

testExpressionIndex accepts that failure, and only it, by its message,
and then checks the other expression index without the one of lower.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first run spent most of each job, 147 to 185 seconds, building the
test APKs, and 80 to 104 running the emulator: on API 34, 34 seconds to
install the SDK and the system image, 28 to boot with KVM, 24 for the
tests, and 8 more saving a snapshot as the emulator stopped.

The snapshot was saved for nothing, as each run creates the AVD from
scratch, so the emulator runs with -no-snapshot-save, as the workflow
before Robolectric did for its tests.

setup-gradle restores its cache read-only on a pull request, which is
how this workflow runs before it is on the default branch, so the build
never stored its outputs, and each run compiled everything again. The
job of the first level now writes the cache, which the next run, of
each level, reads the outputs of the unchanged tasks from, as the
build cache is on; the others still only read it, so that it is stored
once, not once for each level.

No cache of the AVDs, which the workflow before Robolectric had: with
KVM, a snapshot would save about 20 seconds of the boot of each job,
while the cache of each level would take hundreds of megabytes of the
repository's, which Kotlin/Native, Gradle and Robolectric fill for the
other workflows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qiaoyuang qiaoyuang added emulator-test Runs the Android tests on emulators (emulator.yml) and removed emulator-test Runs the Android tests on emulators (emulator.yml) labels Nov 21, 2026
qiaoyuang and others added 2 commits November 21, 2026 23:55
The cache of ~/.konan, Kotlin/Native's compiler and the dependencies it
downloads, was keyed by the hash of every build script, so that each
change of one stored another copy on each system: Windows 849 MB, macOS
738 MB and Linux 703 MB, measured. The repository's caches were at
10,143 MB, the limit GitHub keeps by default, beyond which it evicts the
least recently used, as the caches of Gradle the other jobs read.

What the cache holds only changes with the Kotlin version, which keys it
now, read from gradle/libs.versions.toml, without the CR that a checkout
on Windows ends its lines with, which would leave the version empty: a
step fails then, rather than keying every version alike. Without
restore-keys, so that the cache of a new version doesn't keep the files
of the one before; the first run of a new version downloads them once
on each system. The jobs of one system share it, those of the native
tests on older SQLite versions and of publishing included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It said that a property without a column in the cursor is skipped, but
CommonCursor.getColumnIndex throws for a column the rows don't have, as
its documentation says and as the cursors of Android, the JVM and
Kotlin/Native do, so that such a property fails, as the result of a
SELECT that doesn't fit its type should, which B3 showed: a join named
its columns otherwise before SQLite 3.20.0, and the rows couldn't be
read. The checks of a negative index only guard a cursor that would
return one. Only the comment changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emulator-test Runs the Android tests on emulators (emulator.yml)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant