oliver-zehentleitner / maity

cli + runner: maity-runner main shares one public error-to-exit mapping with maity instead of a copy that calls maity.cli private helpers

Sign in to report

tsk-j7f8dfd7ehfw Proposed

Audit round 6 (tsk-hgnbapyw7hnh), read at 046a4d3b. Kind: duplication / design (reach into private helpers).

What is wrong

  • cli/runner/src/maity_runner/cli.py:49-87 copies maity's _main (cli/src/maity/cli.py:7281-7334): the same exception tuple (StateError, FactsError, HubError, CredentialFormatError, ToolError, OSError), the maintenance mapping (maintenance_until to exit 7), the "does not run on Windows, run it inside WSL" text and the placed-session refusal.
  • It calls the private maity_cli._utf8_streams (:50) and maity_cli._explain (:77).
  • maity's own win32 check for the runner subcommand (cli/src/maity/cli.py:7281-7286) is now reached only by the agents'-side ops and the moved-command lines; on Windows it hides the "moved to maity-runner" line.

Proposal

  • A public helper in maity.cli (or a small module) that maps an exception to its message and exit code, plus public utf8_streams and explain; both mains use them. Drop the win32 check in front of the moved-command lines.

Effort / risk: M. Low to medium; exit codes are pinned by tests.