test(cli): a fault contract generated from the parser tree for every path parameter #1336
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #1336"
general
weight: 0.35
vchamarthi
Summary
Reviewers keep finding two things by hand: a wrong exit code or a traceback where a message belongs, and a path or link that leaves its root. This adds a contract test, generated from the parser, that raises both before review.
Closes #1294
Changes
tests/cli_faults.pybuilds the faults;tests/test_cli_fault_contract.pygenerates cases frombuild_parser(): every path parameter of every command gets a missing file, a directory, an unreadable file, a dangling link, a link out of the root,.., an absolute path, an empty file, invalid UTF-8 and an unwritable parent.docs/quickstart.mdgives a bad input, print noTraceback, leave nothing behind, and make no model call before an unreadable path is refused.nulland a JSON string, which a command may accept or refuse but must not crash on.tests/data/cli_fault_allowlist.txt. A row that no longer fails, is not reached, or names no case fails the test, so the list only shrinks. The same file lists the commands none of whose path parameters is reached, each with what refuses first; these are limits of the harness, not defects.NOT_PATHS,FILLERS,CENTRAL,DOCUMENTED) live intests/cli_faults.py;test_every_hand_kept_name_is_still_in_the_parserfails on the PR that renames one.Tests only; no product code changes.
What the allowlist holds
1. Traceback on an unreadable input:
catalog check --rootand--upstream,catalog provenance --upstream,skill check --root,eval tasks list --tasks-root, the batch dir ofrepo compare,repo hits sheetandrepo report, the subject file ofsubjects run.2. Traceback on
eval native-importwhen the log is missing, a directory, a dangling link or unreadable.3. Unreadable directory accepted with exit 0:
eval inspect.4.
catalog check --tasks-subdiraccepts a missing path, a file,.., an absolute path and a link out of--root.5.
catalog list --intentsis read only with--domain, so a bad file passes; an empty--intentsor--registryfile reads as an empty registry.6. Output left after a refusal:
catalog evalwritesreport.mdand then exits 2;repo hits judgeleaves_eval/lockon a bad--labels.7.
skill novelty analyzeandskill novelty atomsmake a model call before refusing an unusable--out-diror--out;skill shortenexits 0 on an unusable--out.8.
skill novelty proberaisesKeyError: 'atoms'on an--atomsfile holding{}.9.
eval judge wording --answerscrashes on a JSON list with no usable answer.Each is a defect to fix in its own PR; fixing one fails its row here, naming the row to delete.
Risk
test_the_harness_reaches_a_path_parameter_of_every_command, with the refusal in the message; its author adds a filler or oneunreachedrow.Path.exists()raises PermissionError under an unreadable directory before Python 3.14 and returns False from 3.14 on. Rows whose reason startspython <3.14:orpython >=3.14:apply on those versions only. Expect a few rows to move when a new Python joins the matrix.Testing
tests/test_cli_fault_contract.pyon Python 3.11, 3.13 and 3.14 before the rebase onto current main, and on 3.14 after it: passes on each (the interpreter rows above are what differ). Also passes in shuffled order under-n autowith three seeds and in one process.unreachedrow fails the reach test; a name planted inFILLERSthat no command has fails the names test.make ci-local CI_LOCAL_ARGS='--offline --jobs static,typecheck': 0 failed, 17 passed, 3 skipped.Open questions
None. Three readings were settled from the docs:
1.
catalog check --tasks-subdirshould refuse a directory outside--rootand a missing one given on the command line: its help places it under--root, and the exit-code table listsrepo scan --manifest ../x.yamlunder exit 2. The default subdirectory may still be absent.2. An empty intents or registry file named on the command line should be refused: the exit-code table gives exit 2 to "
evaluate --custom-questionson an empty or non-JSON file".3.
report summaryexiting 0 on a missing input is intended: its docstring says "Exit 0 once written", and the missing input becomes anot_runrow. The contract accepts 0 and 2 for it.Revert
Revert the commit. It adds four test files (the helpers, the contract, a test of the helpers and the allowlist) and touches nothing else; nothing is stored.
Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)