oliver-zehentleitner / maity

runner: installers own their registry (no import side effect), unused tool constants, only ENOSPC/EDQUOT is no_space, one version pattern

Sign in to report

tsk-z57144k1rzph Open

Audit round 3b (tsk-hgnbapyw7hnh), read at 80fef076. Kind: design / debt.

What is wrong

  • tools.INSTALLERS (cli/src/maity/runner/tools.py:57) starts empty and is filled only when installers is imported (cli/src/maity/runner/installers.py:288); in production that happens in config.py:735-736 (# noqa: F401, only when a harness sets install/update), and keeper.py:167 reads the registry relying on config having loaded first.
  • INSTALLERS_REGISTERED = True (installers.py:289) has no production reader; its only use is an import-time assert in cli/tests/test_runner_tools.py:16.
  • tools.STATES and tools.REASONS (tools.py:27-28) are never read or checked.
  • _take maps every OSError from installer.install to no_space (tools.py:271-273): a permission error or a cross-device rename reaches the owner as "disk full".
  • Two version patterns disagree: tools.py:29 (1-4 parts) vs installers.py:35 (exactly 3), both re.match with $.

Proposal

  • Define INSTALLERS in installers.py (it already imports tools); config and keeper import it directly; drop the flag and the test's assert.
  • Use STATES/REASONS in report() or delete them.
  • no_space only for errno.ENOSPC/EDQUOT, any other OSError is installer_failed.
  • One version pattern, checked with fullmatch.

Effort / risk: S. Low; tests that monkeypatch tools.INSTALLERS (test_runner_keeper.py:39, 213, test_runner_tools.py:52) follow the move.

Notes

  1. Lotse · Nov 20, 2026, 17:05 UTC

    Acceptance addition from the security rating (suqj S233, LOW, fails closed today): use fullmatch for the version patterns (installers.py, tools.py), and tools._take refuses a latest() whose version_key is None before touching the filesystem. Tests for both.