Skip to content

[winml] [P1] Bare sys.exit(N) calls in command modules; no documented exit-code contract #509

Description

@zhenchaoni

Severity: P1
Command: winml


Category: Exit-Code Contract — exit codes must be documented and consistent so CI/scripts can branch on them.

Repro: Run several failure modes and observe the exit codes.

uv run winml export                                # missing required option
uv run winml inspect -m bogus/x                    # bogus model id
uv run winml exprt                                 # typo
uv run winml --version                             # success
uv run winml perf -m model.onnx --module NoSuchClass --iterations 3 --warmup 1
uv run winml quantize -m model.onnx --precision banana -o bad.onnx

Actual: 4 distinct exit codes observed across the CLI with no documented meaning:

  • winml export (no args) → 2 (Click usage error).
  • winml inspect -m bogus/x1 (generic).
  • winml exprt2.
  • winml --version0.
  • winml perf --module NoSuchClass3 (undocumented; only path that emits 3).
  • winml quantize --precision banana1 but stdout reads Success! Model quantized (contradiction).

Expected: A documented exit-code table in CONTRIBUTING.md and winml --help, e.g.:

0  success
1  negative result (e.g. eval below threshold)
2  usage error (bad flag, conflicting flags, missing input)
3  hardware/EP unavailable
4  network / Hub failure
5  I/O failure
70+ internal error

Replace every sys.exit(N) in command modules with raise click.ClickException(...) or a typed ModelKitError. Never combine Success! stdout with non-zero exit.

Why it matters: CI pipelines and shell scripts use exit codes to decide whether to publish, retry, alert, or block a release. With four distinct codes and no contract, every consumer has to read the source.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingqualityUse for quality control related issuestriagedIssue has been triaged

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions