Skip to content

feat(cli): --fail-on takes warn or fail on the gate leaves (#94 F1b) - #958

Merged
napetrov merged 9 commits into
intel:mainfrom
napetrov:feat/cli-f1b-failon
Nov 20, 2026
Merged

napetrov merged 9 commits into
intel:mainfrom
napetrov:feat/cli-f1b-failon

Conversation

@napetrov

Copy link
Copy Markdown
Contributor

Part of #94 (F1b, fail_on concept)

Summary

The fail_on concept of the flag registry: one flag, --fail-on, that takes the levels a command can gate on. Four spellings move; --strict stays where it gates a verdict.

Old New Leaves
--fail-on-warning --fail-on=warn repo validate, repo budget
--fail-on-fail --fail-on=fail repo scan
--fail-on-error --fail-on=fail repo inspect
--strict (on eval triggers generate) --fail-on=warn eval triggers generate, and the catalog trigger-set tombstone

Each --fail-on leaf accepts only the level it gates on: repo scan --fail-on warn exits 2.

--strict stays on the verdict gates (baseline compare, judge validity and agreement, docs check, catalog check, skill check); each has a reason in tests/data/cli_flags_allowlist.txt.

Evidence

  • make ci-local CI_LOCAL_ARGS="--offline --jobs static,typecheck": 0 failed, 16 passed, 3 skipped (on the reviewed head).
  • Full suite on the pre-review head: 23774 passed, 20 skipped, 1 failed (an exit-code test still on --strict); fixed, and the targeted files pass on the final head.
  • Fresh-context local self-review (lane L4): fixed two doc spellings still naming the retired --strict, and a tombstone suggestion --fail-on=warn=1. Declined: abbreviations of retired flags (argparse allow_abbrev, not covered by the exact-spelling tombstone), and the unconditional incomplete: hint, which is pre-existing.
  • Snapshot docs/reference/cli-interface.json regenerated with make cli-snapshot.

Merge Danger

  • The old spellings exit 2 and print the new command. Scripts and CI that pass them must change the flag. CI workflow ci.yml is updated in this PR.
  • --strict is not removed from eval triggers generate for the verdict meaning; only the lint gate moves to --fail-on=warn.

Changelog fragment: dokimi/changelog.d/20261118_150000_napetrov_cli-f1b-fail-on.md.

🤖 Generated with Claude Code

…F1b)

The fail_on concept of the flag registry (intel#94 section 2.4): one flag,
--fail-on, with the levels a command can gate on. The old spellings
are tombstoned: they print the argv with the new flag and exit 2.

- --fail-on-warning becomes --fail-on=warn on repo validate and repo budget.
- --fail-on-fail becomes --fail-on=fail on repo scan.
- --fail-on-error becomes --fail-on=fail on repo inspect.
- --strict becomes --fail-on=warn on eval triggers generate (the catalog
  trigger-set tombstone points there).

--fail-on takes only the levels a leaf can gate on: repo scan refuses
--fail-on warn. --strict stays where it gates a verdict (baseline
compare, judge validity and agreement, docs check, catalog check, skill
check) and is listed in the allowlist with its reason.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov
napetrov requested a review from a team as a code owner November 19, 2026 08:23
@napetrov napetrov added the cli-interface-change Changes dokimi's user-facing CLI surface label Nov 19, 2026
@exai-bot

exai-bot commented Nov 19, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 32 selected item(s).

CI at ac4d60b: 26 passing, 3 skipped.

Test notes (2)
  • dokimi/dokimi/commands/repo_scan.py:151: With if not gate or not (payload["counts"]["fail"] or payload["incomplete"]): changed to if not (not gate or not (payload["counts"]["fail"] or payload["incomplete"])):, the tests still pass: dokimi/tests/test_cli_flag_moves.py, dokimi/tests/test_cli_output.py, dokimi/tests/test_exit_codes_boundaries.py, dokimi/tests/test_journeys_trace.py, dokimi/tests/test_repo_budget.py, dokimi/tests/test_repo_environment.py. If this condition matters, a test should pin it.
  • dokimi/dokimi/commands/repo.py:177: With cli_output.emit_leaf("repo scan", stamp("repo_readiness", dict(payload)), status="failed" if failed else "complete", reason=_scan_reason(payload, static_errors, gate) if failed else None, subjects=scan_subjects(payload), summary={"claims": dict(payload["counts"]), "files": len(payload["files"]), "adapters": ", ".join(payload.get("adapters") or []) or "none"}) changed to pass, the tests still pass: dokimi/tests/test_cli_flag_moves.py, dokimi/tests/test_cli_output.py, dokimi/tests/test_exit_codes_boundaries.py, dokimi/tests/test_journeys_trace.py, dokimi/tests/test_repo_budget.py, dokimi/tests/test_repo_environment.py. If this condition matters, a test should pin it.
Review details
  • Commit reviewed: ac4d60b against merge base 5d4e205
  • Coverage: 32 files in 5 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 622k tokens (421k from cache), 38s
  • Tool calls: 58 (37 file_read, 9 code_search, 5 pr_threads, 4 file_read_diff, 2 local_check_results, 1 ci_status)
  • CLI flag migration, routing, and compatibility checks: 10 files
  • Repository evaluation commands, contracts, and schemas: 8 files
  • Repository scanning and L0 verifier coverage: 5 files
  • User journey definitions and trace validation: 4 files
  • Migration changelog and user-facing guidance: 5 files

@github-actions

Copy link
Copy Markdown

CLI interface change detected

This PR changes dokimi's user-facing CLI surface (commands and/or options):

~ `dokimi eval triggers generate` parameters changed:
    - removed option `--strict`
    + added option `--fail-on`
~ `dokimi repo budget` parameters changed:
    - removed option `--fail-on-warning`
    + added option `--fail-on`
~ `dokimi repo inspect` parameters changed:
    - removed option `--fail-on-error`
    + added option `--fail-on`
~ `dokimi repo scan` parameters changed:
    - removed option `--fail-on-fail`
    + added option `--fail-on`
~ `dokimi repo validate` parameters changed:
    - removed option `--fail-on-warning`
    + added option `--fail-on`

Updated on every push; the cli-interface-change label is on while the diff is non-empty.

@codecov-commenter

codecov-commenter commented Nov 19, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.91%. Comparing base (5d4e205) to head (ac4d60b).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #958      +/-   ##
==========================================
- Coverage   95.92%   95.91%   -0.02%     
==========================================
  Files         449      449              
  Lines       59444    59445       +1     
  Branches    10246    10246              
==========================================
- Hits        57020    57014       -6     
- Misses       1506     1508       +2     
- Partials      918      923       +5     
Files with missing lines Coverage Δ
dokimi/dokimi/cli_flags.py 100.00% <ø> (ø)
dokimi/dokimi/cli_routes.py 97.47% <100.00%> (ø)
dokimi/dokimi/commands/catalog.py 98.93% <100.00%> (ø)
dokimi/dokimi/commands/repo.py 99.03% <100.00%> (+<0.01%) ⬆️
dokimi/dokimi/commands/repo_scan.py 92.66% <100.00%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

As on memory lint and repo security: warn gates on a warning or an error, fail on an error. validate --fail-on fail is its default gate; inspect --fail-on warn now also fails on warning findings.

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…evels

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I checked 7d0ee7a. The move is right: each old flag maps to the --fail-on value that gates on the same level, the tombstones print a valid command (also for --fail-on-warning=1 and the retired catalog trigger-set --strict), and --strict stays where it gates a verdict.

Merge: safe now: it merges cleanly into current main, 2 commits behind, and its tests pass on the merge. Once it is in, #956, #898, #954, #955 and #957 conflict with it (repo.py, repo_scan.py, cli_flags.py, test_cli_flag_moves.py, the contract doc and the CLI snapshot) and need a rebase.

What I ran, at 7d0ee7a:

  • make ci-local --offline: 0 failed, 25 passed, 20 skipped (network and matrix jobs); 23,725 tests passed, changed lines 100% covered, mutation of changed lines passed, the L0 self-scan with --fail-on fail passed.
  • The touched test files on the merge with current main: 1,292 passed.

Checked, no issues

  • Gates: validate and budget gate on warnings under warn, scan and inspect on failures and errors under fail, the same conditions as the old flags; eval triggers generate refuses before writing, as before.
  • Docs, schemas and CI: no old spelling is left in docs, schema descriptions, journeys or ci.yml; schema edits are description-only.

Fixed in this branch, up to 7d0ee7a:

  • repo validate refused --fail-on fail and repo inspect refused --fail-on warn, unlike memory lint and repo security: 8e6b95b lets both take warn and fail; inspect's warn also gates on warning findings, and a new test pins it. The CLI snapshot, the contract doc and the changelog fragment (7d0ee7a) follow.
  • The scan helpers kept the retired fail_on_fail name: 23af0fe computes one gate in cmd_repo_scan and renames the parameter.
    Each new test fails when the code it covers is broken.

@vchamarthi vchamarthi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Changes needed: 1 must-fix, 1 nit · reviewed 7d0ee7a

Next: @napetrov: fix the 1 must-fix finding; then push for a re-review. 1 nit optional.

Verified on 7d0ee7a: ✅ changed tests: 1586 passed, fail on main · ✅ full suite on the head: 23750 passed · ⚠️ conflicts with main · ✅ 12 broken variants of the changed code: 12 caught by the tests · 2 mutations tried · 6 edge inputs tried

12 checks behind it, each with its evidence
Area What holds How
Changed tests The twelve changed test files pass on the head: 1,586 passed, none failed tests on the head
Moved spellings Each old spelling exits 2 and prints its new argv. --fail-on-warning=1 prints --fail-on=warn with no stray =1, and catalog trigger-set --strict points at eval triggers generate --fail-on=warn tests on the head
Scan leaf repo scan --fail-on warn exits 2, because --fail-on on repo scan takes only fail ran it, edge input (cli)
Verdict gates docs check --strict and catalog check --strict are not rewritten, so their verdict gates keep --strict tests on the head
Inspect gate repo inspect --fail-on fail exits 0 on a tree whose only finding is a warning; --fail-on warn exits 1 with the reason 0 error(s), N warning(s) under --fail-on warn tests on the head
Budget gate repo budget --fail-on warn exits 0 on a tree with no warnings and exits 1 on a tree with one tests on the head, edge input (collections)
Validate gate repo validate --fail-on warn exits 1 on a warning-only tree; without the flag the same tree passes. Dropping the warn gate on dokimi/commands/repo.py:108 fails test_repo_validate_fail_on_warning broke the code, tests caught it
Trigger set gate eval triggers generate --fail-on warn refuses a set with an unresolved label before it writes the output file tests on the head
Empty value repo budget --fail-on= with an empty value exits 2 with invalid choice ran it, edge input (text)
Missing directory repo inspect --fail-on warn on a path that is not a directory exits 2 with not a directory ran it, edge input (paths)
Missing value repo validate --fail-on with no value exits 2 with expected one argument ran it, edge input (cli)
No out path repo scan without --out still gates under --fail-on fail: test_fail_on_fail_follows_the_result_not_the_flag passes for a clean tree and for an incomplete one tests on the head, edge input (none)

Comment on lines 458 to 461
with refusal() as exc:
_run_cli([*argv, "--fail-on-warning"])
_run_cli([*argv, "--fail-on", "warn"])
assert exc.code == 1
assert "warning:" in capsys.readouterr().out

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Must fix: repo validate --fail-on fail on a warning-only tree is not tested: a gate that also trips on warnings still passes the suite.

Input: a tree whose only finding is a warning, run with repo validate --fail-on fail. Changing the gate on dokimi/commands/repo.py:108 to bool(args.fail_on and report.warnings), so fail also trips on warnings, still passes all 175 tests in tests/test_repo_manifest.py. The only case with the flag runs --fail-on warn (line 459). Expected: exit 0 for --fail-on fail on that tree, since the help says fail is an error-only gate, and a case that exits 1 on the broken gate.

Fix, run on 7d0ee7a: the tests now catch the broken variant; tests and lint are no worse.

Suggested change
with refusal() as exc:
_run_cli([*argv, "--fail-on-warning"])
_run_cli([*argv, "--fail-on", "warn"])
assert exc.code == 1
assert "warning:" in capsys.readouterr().out
_run_cli([*argv, "--fail-on", "fail"])
with refusal() as exc:
_run_cli([*argv, "--fail-on", "warn"])
assert exc.code == 1
assert "warning:" in capsys.readouterr().out

@@ -0,0 +1,3 @@
### Changed

- **Fail-on flags: one spelling for the warn and fail gates.** `--fail-on-warning` is now `--fail-on=warn` on `repo validate` and `repo budget`. `--fail-on-fail` is now `--fail-on=fail` on `repo scan`, and `--fail-on-error` is now `--fail-on=fail` on `repo inspect`. `--strict` on `eval triggers generate` is now `--fail-on=warn`, and the catalog `trigger-set` tombstone points there. `--fail-on` takes `warn` or `fail` only where the command can gate on that level, so `repo scan --fail-on warn` is refused. `repo validate` and `repo inspect` take both, as `memory lint` and `repo security` do: `warn` fails on a warning or an error, `fail` on an error; `repo inspect --fail-on warn` is the new gate on its warning findings. The old spellings print the new command and exit 2, so scripts and CI that pass them must change the flag. `--strict` stays on the commands whose gate is a verdict (for example `docs check`, `catalog check`, and the judge and baseline exits), where it is not a plain warn or fail gate.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Nit: The changelog says repo security warn fails on a warning or an error; it gates on classes the baseline never shows.

repo security --fail-on warn fails on new_classes, a violation class the baseline never shows (dokimi/commands/repo_security.py:60), and not on warnings or errors. Expected: the fragment names memory lint alone for the warning-or-error rule, or says what repo security gates on.

Fix, run on 7d0ee7a: the quoted text is gone; tests are no worse.

Suggested change
- **Fail-on flags: one spelling for the warn and fail gates.** `--fail-on-warning` is now `--fail-on=warn` on `repo validate` and `repo budget`. `--fail-on-fail` is now `--fail-on=fail` on `repo scan`, and `--fail-on-error` is now `--fail-on=fail` on `repo inspect`. `--strict` on `eval triggers generate` is now `--fail-on=warn`, and the catalog `trigger-set` tombstone points there. `--fail-on` takes `warn` or `fail` only where the command can gate on that level, so `repo scan --fail-on warn` is refused. `repo validate` and `repo inspect` take both, as `memory lint` and `repo security` do: `warn` fails on a warning or an error, `fail` on an error; `repo inspect --fail-on warn` is the new gate on its warning findings. The old spellings print the new command and exit 2, so scripts and CI that pass them must change the flag. `--strict` stays on the commands whose gate is a verdict (for example `docs check`, `catalog check`, and the judge and baseline exits), where it is not a plain warn or fail gate.
- **Fail-on flags: one spelling for the warn and fail gates.** `--fail-on-warning` is now `--fail-on=warn` on `repo validate` and `repo budget`. `--fail-on-fail` is now `--fail-on=fail` on `repo scan`, and `--fail-on-error` is now `--fail-on=fail` on `repo inspect`. `--strict` on `eval triggers generate` is now `--fail-on=warn`, and the catalog `trigger-set` tombstone points there. `--fail-on` takes `warn` or `fail` only where the command can gate on that level, so `repo scan --fail-on warn` is refused. `repo validate` and `repo inspect` take both, as `memory lint` does: `warn` fails on a warning or an error, `fail` on an error; `repo inspect --fail-on warn` is the new gate on its warning findings. The old spellings print the new command and exit 2, so scripts and CI that pass them must change the flag. `--strict` stays on the commands whose gate is a verdict (for example `docs check`, `catalog check`, and the judge and baseline exits), where it is not a plain warn or fail gate.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov
napetrov merged commit 6ebda00 into intel:main Nov 20, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli-interface-change Changes dokimi's user-facing CLI surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants