fix(packages): decide install/uninstall success by exit status (#28) #29

Merged
christianmanivong merged 1 commits from fix/bugs-2026-11-02 into main 2026-11-02 08:40:47 +00:00
Owner

What

install_package() and uninstall_package() decide success by the package manager's exit status alone. The command is sent with the _RC_MARKER suffix the driver already uses for manage_service() and apply_updates(), and the result goes through the same _status_result() helper: status 0 is a success, any other status (or no status at all) a failure, with the cleaned output kept as output (or a message naming the status when the output is empty).

Why

Both methods searched the output for "error:", "failed", "not found" and "unknown package". opkg's dependency failure (Collected errors: / Cannot install package …) contains none of them and came back as a success, so a failed ensure_package("lldpd") read as done; a successful install of a package or file whose name contains "failed" came back as a failure.

Tests

Fixtures only. New tests/unit/test_packages.py, written first and failing on main: an opkg dependency failure with status 255 is no success; an apk install naming failed-login-notify with status 0 is a success; a marker behind a progress bar is still read; no status / a non-zero status without output are failures; opkg remove refused and apk del done. Full suite 230 passed, coverage 70 % (floor 65), ruff format/check clean, mypy clean.

Closes #28

## What `install_package()` and `uninstall_package()` decide success by the package manager's exit status alone. The command is sent with the `_RC_MARKER` suffix the driver already uses for `manage_service()` and `apply_updates()`, and the result goes through the same `_status_result()` helper: status 0 is a success, any other status (or no status at all) a failure, with the cleaned output kept as `output` (or a message naming the status when the output is empty). ## Why Both methods searched the output for "error:", "failed", "not found" and "unknown package". opkg's dependency failure (`Collected errors:` / `Cannot install package …`) contains none of them and came back as a success, so a failed `ensure_package("lldpd")` read as done; a successful install of a package or file whose name contains "failed" came back as a failure. ## Tests Fixtures only. New `tests/unit/test_packages.py`, written first and failing on main: an opkg dependency failure with status 255 is no success; an apk install naming `failed-login-notify` with status 0 is a success; a marker behind a progress bar is still read; no status / a non-zero status without output are failures; `opkg remove` refused and `apk del` done. Full suite 230 passed, coverage 70 % (floor 65), ruff format/check clean, mypy clean. Closes #28
christianmanivong added 1 commit 2026-11-02 07:38:47 +00:00
fix(packages): decide install/uninstall success by exit status
driver / standard (pull_request) Successful in 26s
driver / lint (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 59s
driver / lowest (pull_request) Successful in 28s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m21s
CI / driver (pull_request) Successful in 3m14s
driver / publish (pull_request) Skipped
58ee774250
install_package and uninstall_package searched the output for keywords.
opkg's dependency failure ("Collected errors:") contains none of them and
read as success; a successful install naming a "failed" file read as a
failure. Append the exit-status marker and let the status alone decide.

Closes #28
christianmanivong merged commit f81d2cd89f into main 2026-11-02 08:40:47 +00:00
christianmanivong deleted branch fix/bugs-2026-11-02 2026-11-02 08:40:47 +00:00
Sign in to join this conversation.