From 67b9b675194d3c26432a4da156f680d3368f767e Mon Sep 17 00:00:00 2001 From: cesnimda Date: Thu, 19 Nov 2026 14:09:20 +0100 Subject: [PATCH] test(release): qualify SQLite archive producers on Windows --- .../evidence/sqlite-archive-format/README.md | 13 ++++++++ scripts/test-deploy-backup.py | 31 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/docs/release-readiness/evidence/sqlite-archive-format/README.md b/docs/release-readiness/evidence/sqlite-archive-format/README.md index 5bbd8919..544e3b51 100644 --- a/docs/release-readiness/evidence/sqlite-archive-format/README.md +++ b/docs/release-readiness/evidence/sqlite-archive-format/README.md @@ -12,3 +12,16 @@ The existing deployment verifier now calls a small Python standard-library strea This checks **format**, not SQLite integrity or usefulness: a signature-only regular file satisfies this bounded predicate. It does not validate arbitrary other archive members, select an authoritative database among multiple compatible paths, prove WAL consistency, restore records, verify keys/tombstones/off-host encryption, qualify RPO/RTO or replace recovery rehearsal. MariaDB's dump path is unchanged. Actual Linux/container/host deployment remains NOT RUN. No release/security approval is granted. Rollback restores verify_volume_backup and removes the helper/associated fixture changes on this isolated branch. No data rollback is required. Original release worktree and A3 application branch remain untouched by this package. + +## Host archive producer compatibility, 19 November 2026 + +The test at `BackupDatabaseMemberTests.test_host_tar_producer_with_database_and_sidecar` uses the deployment command's `tar czf … -C data .` arguments with a temporary synthetic volume. It creates a real SQLite database with one row and closes the connection. The host tar command archives it alongside an inert file named `jobtracker.db-wal`. The production Python validator accepts the archive, and a read-only comparison confirms the database member matches the source bytes. A second archive containing only the sidecar name is rejected. + +| Windows producer | Verification | Result | +| --- | --- | --- | +| Git for Windows GNU tar 1.35 | Full backup suite, Python 3.12.10 / SQLite 3.49.1 | 30 methods passed in 12.486 seconds | +| Windows bsdtar 3.8.9 / libarchive 3.8.9 | Focused producer method with the same positive and negative cases | Passed in 0.192 seconds | + +The focused run overlaps the full suite. To repeat, put the desired tar directory first on PATH and run `python scripts/test-deploy-backup.py BackupDatabaseMemberTests.test_host_tar_producer_with_database_and_sidecar -v`. The test resolves the absolute producer path before invocation. Source baseline `5718d9521be0935e1c0364a775ed8ce7d0702f43`. The validator and deployment script are unchanged. + +Linux/Alpine producer qualification remains blocked on a pre-existing isolated Linux environment. WSL listed only a stopped Docker Desktop distribution. This fixture's sidecar exercises filename classification only. Live WAL consistency, restore, deployment, permissions, encryption and recovery-set completeness remain open. diff --git a/scripts/test-deploy-backup.py b/scripts/test-deploy-backup.py index b7ea64e4..d4b0cf04 100644 --- a/scripts/test-deploy-backup.py +++ b/scripts/test-deploy-backup.py @@ -423,6 +423,37 @@ class BackupSqlTrailerTests(unittest.TestCase): class BackupDatabaseMemberTests(unittest.TestCase): + def test_host_tar_producer_with_database_and_sidecar(self): + producer = shutil.which('tar') + self.assertIsNotNone(producer, 'The host tar command is required for producer qualification.') + with tempfile.TemporaryDirectory() as temporary: + folder = Path(temporary) + volume = folder / 'data' + volume.mkdir() + database = volume / 'jobtracker.db' + connection = sqlite3.connect(database) + try: + with connection: + connection.execute('CREATE TABLE synthetic (id INTEGER PRIMARY KEY)') + connection.execute('INSERT INTO synthetic VALUES (1)') + finally: + connection.close() + (volume / 'jobtracker.db-wal').write_bytes(b'fixture sidecar name only') + for case in ('database-and-sidecar', 'sidecar-only'): + with self.subTest(case=case): + if case == 'sidecar-only': + database.unlink() + archive = case + '.tar.gz' + subprocess.run([producer, 'czf', archive, '-C', 'data', '.'], + cwd=folder, check=True, capture_output=True, timeout=15) + result = subprocess.run([sys.executable, ROOT / 'scripts/validate-sqlite-backup.py', archive], + cwd=folder, capture_output=True, timeout=15) + self.assertEqual(0 if database.exists() else 1, result.returncode, result.stderr) + if database.exists(): + with tarfile.open(folder / archive, 'r:gz') as bundle: + with bundle.extractfile('./jobtracker.db') as archived: + self.assertEqual(database.read_bytes(), archived.read()) + def verify_archive(self, member_name, truncated_tar=False, member_type=tarfile.REGTYPE, contents=None): source = (ROOT / 'deploy/deploy.sh').read_text(encoding='utf-8') functions = []