Repository navigation
feat(cli): --fail-on takes warn or fail on the gate leaves (#94 F1b) - #958
Conversation
…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>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 32 selected item(s). CI at Test notes (2)
Review details
|
CLI interface change detectedThis 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 |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
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
left a comment
There was a problem hiding this comment.
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 failpassed.- 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 underfail, the same conditions as the old flags;eval triggers generaterefuses 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 validaterefused--fail-on failandrepo inspectrefused--fail-on warn, unlikememory lintandrepo security: 8e6b95b lets both takewarnandfail; inspect'swarnalso 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_failname: 23af0fe computes onegateincmd_repo_scanand renames the parameter.
Each new test fails when the code it covers is broken.
vchamarthi
left a comment
There was a problem hiding this comment.
🔴 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 ·
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) |
| 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 |
There was a problem hiding this comment.
🔴 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.
| 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. | |||
There was a problem hiding this comment.
🟡 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.
| - **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>
Part of #94 (F1b, fail_on concept)
Summary
The
fail_onconcept of the flag registry: one flag,--fail-on, that takes the levels a command can gate on. Four spellings move;--strictstays where it gates a verdict.--fail-on-warning--fail-on=warnrepo validate,repo budget--fail-on-fail--fail-on=failrepo scan--fail-on-error--fail-on=failrepo inspect--strict(oneval triggers generate)--fail-on=warneval triggers generate, and thecatalog trigger-settombstoneEach
--fail-onleaf accepts only the level it gates on:repo scan --fail-on warnexits 2.--strictstays on the verdict gates (baseline compare, judge validity and agreement,docs check,catalog check,skill check); each has a reason intests/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).--strict); fixed, and the targeted files pass on the final head.--strict, and a tombstone suggestion--fail-on=warn=1. Declined: abbreviations of retired flags (argparseallow_abbrev, not covered by the exact-spelling tombstone), and the unconditionalincomplete:hint, which is pre-existing.docs/reference/cli-interface.jsonregenerated withmake cli-snapshot.Merge Danger
ci.ymlis updated in this PR.--strictis not removed fromeval triggers generatefor 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