Repository navigation
Conversation
…om the names The exit codes were a table in exit_codes.py, but 79 exits in the package still ended the process with a literal number: sys.exit(2), raise SystemExit(3), a conditional with a 1 arm, parser.exit(2, ...), and a code=2 keyword to the save and write helpers that exit with it. cli_output kept its own numbers. A literal reads the same to Python, but only the name says what the 2 means, and a renumbering of the table would not reach it. Each exit now names its constant (EXIT_USAGE, EXIT_FAILURE, EXIT_INCONCLUSIVE, EXIT_INVALID, EXIT_INFRA), and cli_output.EXIT_OF_ERROR is built from those names. The values are unchanged: an AST comparison of each changed module against intel/main, with the names folded to their values, is identical. tests/test_exit_codes_named.py fails on main (79 literal exits, a literal EXIT_OF_ERROR) and passes here. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
There was a problem hiding this comment.
🟡 Changes recommended
The package-wide guard misses qualified and aliased exit calls, keyword status arguments, and literal codes returned by local entry points, allowing unnamed nonzero exit codes to pass.
3 open issues
What changed in this PR
3 new findings.
This PR centralizes exit-code references across dokimi’s CLI while preserving their numeric values.
Changes:
- Replaces literal exit codes with named constants.
- Builds
EXIT_OF_ERRORfrom those constants. - Adds AST guards and documents the naming convention.
| File | Description |
|---|---|
dokimi/tests/test_exit_codes_named.py |
Adds exit-code naming guards. |
dokimi/dokimi/commands/tools.py |
Names artifact rejection exits. |
dokimi/dokimi/commands/tasks.py |
Names task failure exits. |
dokimi/dokimi/commands/tasks_generate.py |
Names generation failure exits. |
dokimi/dokimi/commands/run.py |
Names gate failure exits. |
dokimi/dokimi/commands/report.py |
Names empty-report failure exit. |
dokimi/dokimi/commands/repo.py |
Names repository command exits. |
dokimi/dokimi/commands/repo_skill_reach.py |
Names skill-reach failure exits. |
dokimi/dokimi/commands/repo_run.py |
Names execution and task-check exits. |
dokimi/dokimi/commands/repo_reach.py |
Names reach failure exits. |
dokimi/dokimi/commands/redteam.py |
Names failed-verdict exit. |
dokimi/dokimi/commands/questions.py |
Names question artifact failures. |
dokimi/dokimi/commands/orchestrate.py |
Names pipeline failure exit. |
dokimi/dokimi/commands/memory.py |
Names lint failure exit. |
dokimi/dokimi/commands/llms_txt.py |
Names documentation check failure. |
dokimi/dokimi/commands/leak.py |
Names failed-verdict exit. |
dokimi/dokimi/commands/judge_reliability.py |
Names output and strict-gate exits. |
dokimi/dokimi/commands/ingest.py |
Names ingestion error exits. |
dokimi/dokimi/commands/headroom.py |
Names artifact rejection exit. |
dokimi/dokimi/commands/evaluate.py |
Names evaluation error exits. |
dokimi/dokimi/commands/delivery.py |
Names failure and inconclusive exits. |
dokimi/dokimi/commands/context.py |
Names context check failures. |
dokimi/dokimi/commands/catalog.py |
Names catalog failure exits. |
dokimi/dokimi/commands/catalog_eval.py |
Names catalog evaluation failure. |
dokimi/dokimi/commands/benchmark.py |
Names benchmark failure exits. |
dokimi/dokimi/commands/baseline_regression.py |
Names regression failure exit. |
dokimi/dokimi/commands/_shared.py |
Names shared helper exits. |
dokimi/dokimi/commands/_output.py |
Names artifact rejection exit. |
dokimi/dokimi/cli.py |
Names usage error exits. |
dokimi/dokimi/cli_output.py |
Uses constants in the error table. |
dokimi/docs/quickstart.md |
Documents exit-code constants. |
dokimi/changelog.d/20261204_120000_napetrov_arch-r6-7.md |
Records the naming refactor. |
Review effort: Balanced
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 39 selected item(s). CI at Test notes (2)
Review details
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1651 +/- ##
==========================================
- Coverage 96.45% 96.44% -0.01%
==========================================
Files 575 575
Lines 75872 75892 +20
Branches 13076 13076
==========================================
+ Hits 73179 73192 +13
- Misses 1644 1646 +2
- Partials 1049 1054 +5
🚀 New features to boost your workflow:
|
Mutation of changed linesAt 0d89878: 8 caught · 0 missed This is not a clean result:
Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary. |
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g87AEAbe Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g87AEAbz Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g87AEAcA Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the problem I found and the small thing I've marked fix before merge (in the line comments)? Then push and I'll take another look.
What I checked on 5409056:
- When I changed the code on purpose, the tests still passed for 12 of 12 changes, and no test pins these down yet (non-blocking):
dokimi/dokimi/cli.py:470(the handled error is raised again),dokimi/dokimi/commands/_output.py:50(the handled error is raised again),dokimi/dokimi/commands/_shared.py:185(the handled error is raised again) and 9 more. - The 65 changed tests pass, and fail on main as expected.
- The full test suite passes with main merged in (37,307 tests), apart from failures main has too.
- It merges cleanly onto main.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com> # Conflicts: # dokimi/dokimi/commands/tools.py
Thread: PRRT_kwDOVBg7g87AM0ER Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g87AM0ET Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Preserve the guard’s allowance for the conventional success status. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
|
The assignment regression is fixed in |

Summary
Dokimi package commands use named nonzero statuses from
dokimi/exit_codes.py.EXIT_OF_ERRORuses the same names. The touched container entry points define statuses locally so they can run with the standard library alone.Evidence
status=, and local entry-point returns. The guard reports the offending lines for each case. It also follows assigned literal and conditional statuses while respecting scope and named rebindings.Merge Danger
Door: two-way. Revert restores the literals.
No value changes, so consumers and scripts see the same exit codes.
Blast Radius: none (CLI exit names only; values identical).
🤖 Generated with Claude Code