Skip to content

feat(install): improve logging, error handling, and bulk-loop resilience#126

Merged
tankdonut merged 1 commit into
mainfrom
install-logging-errors
Jun 28, 2026
Merged

feat(install): improve logging, error handling, and bulk-loop resilience#126
tankdonut merged 1 commit into
mainfrom
install-logging-errors

Conversation

@tankdonut

Copy link
Copy Markdown
Owner

Summary

Improves the tools.install task with better verbose logging, resilient bulk installs, and clearer error context.

Motivation

A review of tools.install found that: (1) one package failure aborted the entire bulk install, (2) download errors lost package context, (3) there was no --verbose mode or per-step status, and (4) the output style was inconsistent with the update/digests tasks. This addresses all four.

Changes

Logging & verbosity

  • --verbose flag on tools.install: echoes underlying shell commands (curl, tar, chmod, etc.) and shows curl's download progress meter
  • Switched the downloader's print() to logging.getLogger (info for download/verify steps)
  • Task layer uses rich.console (OK/SKIP/) for consistency with update.py and digests.py
  • Added [i/N] installing <name> progress header for bulk installs and a final Summary: X installed, Y failed

Error handling

  • Bulk install no longer aborts on a single failure — failed tools are collected and reported; remaining tools continue. Exits non-zero (Exit(1)) if any failed
  • Download errors wrapped with package name + URL: Failed to install '<name>' from <url>: <cause>. IntegrityError passes through unwrapped (already carries context)
  • check_required_tools error now names the package that needed the missing tool
  • --force removal switched from c.run('rm -rvf ...') to shutil.rmtree (removes a shell-interpolation surface)
  • metadata_cache.clear() moved into a finally block so it runs on success or failure

Integrity visibility

  • The downloader now logs a WARNING (always visible) when a binary is installed without an sha256 digest configured, rather than skipping verification silently

Files changed

  • tasks/lib/downloader.py — verbose/echo support, logging, verify-step visibility
  • tasks/tools/_install.py — package-context error wrapper, verbose passthrough, shutil.rmtree, rich console output
  • tasks/tools/install.py--verbose flag, resilient bulk loop, summary, finally cache clear
  • tests/test_install_task.py — 10 new tests (error wrapping, IntegrityError pass-through, verbose passthrough, force removal, already-installed skip, bulk-loop resilience, cache-clear-in-finally)
  • tests/test_sha256.py — updated fake_run signatures to accept the new echo= kwarg

Verification

  • ruff check + ruff format --check — clean
  • pytest164 passed (+13 new tests)
  • Coverage: _install.py 95%, install.py 94%

Checklist

  • Tests added for new behavior
  • Lint and format clean
  • No new dependencies introduced
  • No public API removed (check_required_tools gained an optional param; install_single_package gained optional verbose)

- Add --verbose flag that echoes shell commands and shows curl progress
- Bulk install no longer aborts on a single package failure; failed tools
  are collected and reported in a summary, exiting non-zero if any failed
- Wrap download errors with package name and URL context (IntegrityError
  passes through unchanged since it already carries context)
- Replace shell 'rm -rvf' on --force with shutil.rmtree
- Surface a warning when a binary is installed without an sha256 digest
- Move metadata_cache.clear() into a finally block
- Add rich.console status output (OK/SKIP/fail) matching update/digests
- Add [i/N] progress header and per-package status for bulk installs
- Add tests for error wrapping, verbose passthrough, force removal,
  already-installed skip, and bulk-loop resilience
@tankdonut tankdonut self-assigned this Jun 28, 2026
@tankdonut tankdonut merged commit b60d401 into main Jun 28, 2026
5 checks passed
@tankdonut tankdonut deleted the install-logging-errors branch June 28, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant