fix(backup): treat only a missing executable as an absent dump tool
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>
This commit is contained in:
1 parent
2a36d01f95
commit
ab717debf1
4 files changed
+91
-8
No files matched your search
@@ -25,7 +25,17 @@ SYNC_BYTES = 1 << 16
|
||||
|
||||
|
||||
class BackupError(Exception):
|
||||
"""Generic exception for backup errors."""
|
||||
"""Generic exception for backup errors.
|
||||
|
||||
Args:
|
||||
message: what failed.
|
||||
returncode: the exit code of the command that failed, None when the
|
||||
error did not come from a command's exit.
|
||||
"""
|
||||
|
||||
def __init__(self, message: str, returncode: int | None = None) -> None:
|
||||
super().__init__(message)
|
||||
self.returncode = returncode
|
||||
|
||||
|
||||
def _child_env(env: Mapping[str, str] | None) -> dict[str, str] | None:
|
||||
@@ -36,7 +46,8 @@ def _fail(command: Sequence[str], returncode: int, out: bytes, err: bytes) -> No
|
||||
raise BackupError(
|
||||
f"Error in command: {' '.join(command)}\n"
|
||||
f"Output: {out}\nError: {err}\n"
|
||||
f"Exit code: {returncode}"
|
||||
f"Exit code: {returncode}",
|
||||
returncode,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user