stormlog.exit_codes

Process exit-code contract shared by every Stormlog command line.

The table is fixed so that automated consumers (CI jobs, agents, the TUI command runner) can branch on the code without parsing output. Values the platform already owns keep their meaning: argparse exits 2 on a usage error, Python exits 1 on an uncaught exception, and the shell reports a SIGINT-terminated process as 128 + 2.

Codes are never renumbered or reused. A new outcome takes the next free value below 128; values from 128 upward stay reserved for signals.

Functions

completed_with_findings(risk_detected)

Map a completed diagnosis to FINDINGS or OK.

exit_code_for_status(status)

Return the exit code the contract pairs with a verdict status.

verdict_status(exit_code)

Return the verdict status string that the contract pairs with exit_code.

Classes

ExitCode(value[, names, module, qualname, ...])

Deterministic process exit codes for Stormlog commands.

class stormlog.exit_codes.ExitCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Deterministic process exit codes for Stormlog commands.

OK = 0

The command completed, no findings reached failure severity, gates passed.

ERROR = 1

An unexpected failure; any output written may be incomplete.

USAGE = 2

Invalid command line, or the installation cannot serve the request.

FINDINGS = 3

The command completed but detected memory risk, OOM, or leak findings.

GATE_FAILED = 4

The command completed but a configured budget or tolerance was exceeded.

INVALID_INPUT = 5

An input artifact or asset is missing, unreadable, or unsupported.

INTERRUPTED = 130

Stopped by SIGINT before completion.

stormlog.exit_codes.completed_with_findings(risk_detected)[source]

Map a completed diagnosis to FINDINGS or OK.

Parameters:

risk_detected (bool)

Return type:

ExitCode

stormlog.exit_codes.exit_code_for_status(status)[source]

Return the exit code the contract pairs with a verdict status.

Raises:

ValueError – if status is not a verdict status.

Parameters:

status (str)

Return type:

ExitCode

stormlog.exit_codes.verdict_status(exit_code)[source]

Return the verdict status string that the contract pairs with exit_code.

Raises:

ValueError – if exit_code is not part of the contract.

Parameters:

exit_code (int)

Return type:

str