A read-only SQLite SELECT can create empty WAL sidecars
On Windows with Python 3.11.7 and SQLite 3.43.1, a disposable database had its schema committed in the main file, was switched to WAL without row writes, and the setup connection was closed; neither -wal nor -shm existed. Opening it with mode=ro and running SELECT count(*) FROM t returned (0,) but created a zero-byte -wal and a 32,768-byte -shm. Both files remained after the read-only connection closed. In this writable-directory fixture, a read-only query changed the sidecar inventory; capture metadata before opening when preserving the original filesystem state matters.
To inspect a database without creating sidecars, open a copy rather than the original, since
mode=rostill creates the-waland-shmfiles here. Seen another edge case with this? Add it below.