CodeRabbit on https://github.com/kevinveenbirkenbach/backup-docker-to-local/pull/18:
dockerd overwrites the exit code of every failed exec start with 126
(https://github.com/moby/moby/issues/45795, still open). Where the docker
CLI does not map a missing executable to 127, has_tool() raised for a
pg_dumpall probe in a MariaDB container, so container_engine() never
reached mariadb-dump and main() dropped the volume from the generation.
BackupError now carries the failed command's stderr, and has_tool()
returns False for 127 or for 126 whose stderr carries the runtime's
'executable file ... not found' (runc and crun wording). Every other
126, such as the containerd io-pipe timeout of
https://github.com/infinito-nexus/core/actions/runs/46742115623, still
raises.
Tests: 126 with the runc and the crun message read as absent (mocked and
from a real child process); the io-pipe timeout now carries its stderr
and still raises. Unit suite 283 OK; ruff clean. Against the previous
has_tool the three new cases fail (3 errors).
🎯 Fix: 92 %
💥 Break: 3 %
💸 Tokens: 100 %
⏱️ Velocity: 100 %
🛡️ Security: 100 %
🏆 Score: 92
🚦 Gate: unit 283 OK + negative control; ruff clean
Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
has_tool() read every failed `<tool> --version` probe as "tool absent".
In Infinito.Nexus CI (https://github.com/infinito-nexus/core/actions/runs/46742115623,
job 143242383123) the second backup's `docker exec mariadb mariadb-dump
--version` hung and dockerd failed it with "DeadlineExceeded: failed to
start io pipe copy: unable to copy pipes: containerd". baudolo took that
for a missing mariadb-dump, cached the image as no database and copied
mariadb_data as plain files instead of dumping it; the disaster-recovery
drill then found no marker in the generation.
BackupError now carries the command's exit code, and has_tool() returns
False only on 127, the code docker exec sets when the runtime reports the
executable missing; any other failure re-raises, so the run fails loudly
before container_engine() caches anything. The probe test that encoded
the old behaviour is replaced by a not-found case (127 -> False), a
transient case (126 -> raises) and the same two from a real child
process; engine detection gains a test that a failed probe caches
nothing. Full unit suite: 275 tests OK. Against the old has_tool the
two raise cases fail.
🎯 Fix: 92 %
💥 Break: 5 %
💸 Tokens: 100 %
⏱️ Velocity: 100 %
🛡️ Security: 100 %
🏆 Score: 92
🚦 Gate: unit suite 275 OK + negative control; ruff clean; Docker integration suite not run
Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A finished generation cannot show whether a volume held a database, nor whether a dump was produced for it: under --only-sql a failed dump falls back to a file copy, and the resulting files/ tree looks like any other copy. The run knows both and threw the knowledge away as a printed warning, leaving every reader to guess from file names.
Each generation now carries a manifest.json stating its layout and, per volume, database / dumped / engine. baudolo.generation is the single place those names are spelled; restore/paths.py, backup/db.py and backup/volume.py stop repeating them. It is deliberately import-free so a consumer can read the manifest with nothing but json, on hosts where this package is not installed.
BREAKING CHANGE: BackupException is renamed BackupError. The rename is atomic across the ten modules that define or import it, three of which also carry the manifest change, so it lands in this commit rather than a separate one that could not import.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The backup built command strings and handed them to shell=True, so four interpolated values per dump - user, password, container, database - were each a way out of the command. validate_database covered one of them since the previous commit; now there is nothing to cover: every command is an argv list, and a value can only ever be an argument.
execute_to_file absorbs the atomic dump write. The shell redirect into <file>.tmp and the separate mv process become a Python file handle and os.replace, and a failing dump deletes its partial file instead of leaving it. PGPASSWORD moves out of the command string into the child's environment, where a process listing does not show it.
docker exec is built in one place, docker_exec_argv; db.py's three hand-built copies and the probe use it. The dead docker_volume_exists goes - never called, and the restore side owns the living twin. The rsync quoting in --link-dest falls away: inside an argv it would have become part of the path.
The snapshot module's injected runner changes type with it, which the three e2e drivers implement - the first conversion missed them, btrfs ran with no arguments, and the e2e caught it. Marked breaking for that contract: any external runner injected into volume_snapshot must now accept a list.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
36b2336 matched postgres and mariadb against the image's repository path. That name is not a property of the software: a dedicated Postgres inside an app's own stack is tagged <app>-database or postgis/postgis and carries no engine token at all, so it was never recognised, never dumped, and its data directory was copied as files without a single warning - the fallback notice hangs on found_db, which stayed false.
The container is now asked what it can run. pg_dumpall, mariadb-dump and mysqldump are probed by executing them, not by asking a shell for them, because a distroless image has no shell and would deny every tool it ships. The verdict is cached per image ID rather than per container, so replicas of one image cost a single probe.
Because the probe names the tool it found, the dump uses it instead of the hardcoded /usr/bin/mariadb-dump, which makes an image that ships only mysqldump dumpable rather than silently file-copied.
image_name and has_image are gone with their registry-host and tag stripping; the trap they worked around cannot occur when nothing reads the name. get_image_info stays, since the --images-* lists match exact references.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>