- _preflight_existing_file probes an EXISTING file with a mode=ro URI
connection before the read-write open, so a corrupt file is detected
BEFORE WAL mode persists or sidecars appear; the preflight is inside
the same ConfigEntryNotReady classification as open()/migrations
- corruption classification now prefers sqlite_errorcode (SQLITE_CORRUPT/
SQLITE_NOTADB primary-byte match, locale-independent, Python 3.11+)
with message fallback including 'database disk image is malformed'
- the early-return path (existing runtime record) routes through
_async_open_database and reopens when db is None OR not connected
- new migration-stage corruption test: valid header + damaged page
4096+, asserts main file byte-identical AND no -wal/-shm sidecars
left behind; vacuous test replaced with pytest.raises form