Skip to content

Fail closed on SQLite snapshot sidecars - #1

Merged
lukisch merged 1 commit into
mainfrom
agent/cleanup-sqlite-push-sidecars
Jul 30, 2026
Merged

Fail closed on SQLite snapshot sidecars#1
lukisch merged 1 commit into
mainfrom
agent/cleanup-sqlite-push-sidecars

Conversation

@lukisch

@lukisch lukisch commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What changed

  • force backup snapshots into SQLite DELETE journal mode before redaction, scanning, verification, hashing, and publication
  • detect and remove the complete adjacent SQLite artifact family, including unknown future sidecar suffixes
  • clean snapshot, sidecar, manifest, and atomic manifest-temp artifacts on backup, scanner, quick-check, and manifest failures
  • add SyncConfig.from_bytes(payload, source_path=...); from_file() delegates to it so callers can hash and parse the exact same bytes without parallel config semantics
  • document the closed-snapshot invariant and exact-byte config API

Root cause

SQLite's backup API preserves the source database's persistent WAL journal mode. Later operations on the temporary backup could therefore create .partial-wal and .partial-shm files. The old cleanup removed only the main .partial file, so sidecars survived both successful publication and error paths.

Impact

A pushed transit now contains exactly one closed snapshot plus its manifest. Unmanifested SQLite sidecars fail closed and are removed. WAL source data remains included through SQLite's online backup API; no live database files are copied.

Validation

  • python -m unittest discover -s tests -v — 26 passed
  • python -m pytest -q — 26 passed
  • python -m ruff check sqlite_transit_sync tests — passed
  • python -m compileall -q sqlite_transit_sync tests — passed
  • python -m sqlite_transit_sync --help — passed
  • git diff --check — passed

Regression coverage includes WAL-backed success, credential-scanner failure, forced quick-check failure, manifest plus manifest-temp failure, backup failure, and an unknown future sidecar suffix. All tests use synthetic temporary databases; no live data is involved.

@lukisch
lukisch force-pushed the agent/cleanup-sqlite-push-sidecars branch from 2eaabce to 2e6065b Compare July 30, 2026 06:16
@lukisch
lukisch marked this pull request as ready for review July 30, 2026 06:22
@lukisch
lukisch merged commit 061baff into main Jul 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant