# SQLite backup value fidelity: reproducible supplement

## Finding and denominator

A completed backup can faithfully copy a source that differs from the intended
application state. All 16 selected synthetic backups completed and every cold
destination returned integrity_check=ok. Only the intact WAL case matched both
the expected BLOB and marker. The checksum-neutral case retained altered
content with marker 2; rejection and main-only controls retained older values.

Two frozen captures x four designed inputs x two engine builds = 16 backups.
summary.json groups four matching observations per input, not population samples.
Builds: Ubuntu SQLite 3.45.1 and pinned upstream SQLite 3.51.0, one little-endian
Linux host, 4096-byte pages and a three-page database. No concurrent writer,
encrypted database, power loss or hardware failure was tested. These versions
identify observations, not current patch-status recommendations.

This is not an observed disk fault, random-error rate, new vulnerability or
independent-person replication. It does not show violation of SQLite's copying
contract. Two SQLite builds share implementation lineage.

## Method and acceptance

The direct C reader holds a read-only source transaction, reads the entire
128-byte BLOB and marker, copies with sqlite3_backup, closes the destination,
then reopens it. A separate process reads only the destination main file in an
empty directory, with no source WAL/SHM. Both backup_step=SQLITE_DONE and
backup_finish=SQLITE_OK were recorded, with zero remaining pages.
finish=OK alone does not establish completed copying.

Expected A x 128 and marker 2 come from fixture construction, not the recovered
database. Real acceptance needs a trustworthy reference bound to the intended
object and version. A digest beside mutable data is not authentication.
A correct later marker alone did not certify earlier content.

## Files and provenance

The original standalone bundle is retained unchanged:
https://hesela.dev/research/sqlite-wal-neutral/reproduce.zip

This combined supplement includes all exact original members, including its
manifest.json, plus backup code, 16 destination images and reports.
Root README.md/replay.py describe the original Python-mediated replay;
BACKUP_README.md describes the additional direct-C evidence.
backup-manifest.json hashes the combined packet. A manifest checks consistency
with itself, not authenticated origin.

Original source: 47197fd1b6f8997a2b9e180b031df2b335cde3e3.
Supplement source: d672f143e1a91df774b42b243d42d01ee1872ce8.
Native code, inputs and destination bytes are unmodified. Compiler workspace
paths are normalized to $AMALGAMATION, $READER and $BUILD in the public report;
source receipts omit internal raw-file paths. Measurements, versions, IDs and
hashes are unchanged. The manifest records the original report hash.

## Verify without compiling

From the extracted bundle root, with Python 3 and its standard library:

    python3 -B replay.py
    python3 -B backup/run.py --verify backup/evidence
    python3 -B -m unittest discover -s backup -p test_backup.py -v
    python3 -B -O -m unittest discover -s backup -p test_backup.py -v

The original replay uses the active Python-linked SQLite and identifies it
separately from the captured runtime. Supplemental evidence verification checks
frozen observations; it is not fresh native execution.

## Repeat the native experiment

Obtain the official SQLite 3.51.0 amalgamation from backup/sources.json.
Check its ZIP/source hashes and provide the directory with sqlite3.c/sqlite3.h:

    python3 -B backup/run.py --capture /tmp/new-wal-backup-evidence --amalgamation /path/to/sqlite-amalgamation-3510000
    SQLITE_AMALGAMATION=/path/to/sqlite-amalgamation-3510000 python3 -B -m unittest discover -s backup -p test_native.py -v

The output directory must not exist. Requirements: Linux, gcc, ldd and a system
libsqlite3.so.0 with WAL support. Both readers use the pinned API header;
runtime source IDs identify linked engines. A different system library is a
different observation, not exact reproduction of the captured system build.
Use only disposable synthetic fixtures: native.c is not a general backup tool.
These commands do not install or download packages. Tests include negative
controls. Both Python suites may also run under -O.

## Sources and reuse

- SQLite Backup API: https://www.sqlite.org/backup.html
- Step/finish: https://www.sqlite.org/c3ref/backup_finish.html
- Integrity check: https://www.sqlite.org/pragma.html#pragma_integrity_check
- WAL format: https://www.sqlite.org/fileformat2.html#walformat
- Pinned release: https://www.sqlite.org/releaselog/3_51_0.html

SQLite source is public domain. No new license grant is added to Hesela code or
data. Receipts retain source hashes and locators. Official documents explain
the contract; experimental artifacts supply the observations.
