fix(cache): fall back to TRUNCATE journal mode when WAL is unsupported
PR #34499 added an up-front WSL-1 check that uses TRUNCATE instead of WAL
for the SQLite cache DBs, because WSL-1's filesystem translation layer
doesn't support WAL's shared-memory locking (which surfaces as
SQLITE_PROTOCOL, "database lock protocol error"). That heuristic relies on
sniffing the kernel string and only covers WSL-1.
This adds a behavior-based fallback so any environment where WAL isn't
supported by the underlying filesystem (e.g. some network mounts, future
kernel strings the heuristic misses) still gets a persistent, file-backed
cache instead of degrading to an in-memory one. When the first on-disk open
fails with SQLITE_PROTOCOL while attempting WAL, we reopen the same file
with TRUNCATE journal mode before any destructive recovery (delete) or the
in-memory fallback.
The journal mode is now threaded through create_combined_sql /
initialize_connection / open_connection_and_init, and the up-front WSL-1
detection just selects the initial mode via default_journal_mode().
Refs #26441
Co-Authored-By: Divy Srivastava <me@littledivy.com>