Repository navigation
refactor(cli): bad input exits 2 through one InputError #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
napetrov
wants to merge
39
commits into
intel:main
Choose a base branch
from
napetrov:refactor/artifact-load-or-fail
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
df859b3
refactor(cli): bad input exits 2 through one InputError
napetrov 00876aa
fix(cli): cover self-review findings on the bad-input exit
napetrov 776122c
docs(changelog): name the field refusals and the all-vs-all catalog c…
napetrov e8455f6
docs(arch): state the bad-input exit rule; shorten the exit-rule comm…
napetrov 941e73a
test(cli): accept either deep-nesting reason, since Python 3.14 parse…
napetrov 19b1118
test(arch): count an exit in the else branch of a __main__ guard
xaleryb 74be552
test(arch): count an exit through usage_exit, a bound SystemExit or b…
xaleryb cccb356
test(novelty): match the artifact path literally, not as a regex
xaleryb a172082
Merge intel/main into the arch-loader branch
napetrov b706c6a
chore: drop the stray dokimi/uv.lock from the merge
napetrov fcb6bac
fix(novelty): a model failure exits 1, not 2
napetrov 8a8ddaa
fix(test): resolve SystemExit aliases when collecting bound names
napetrov c03dd38
docs(changelog): exit codes that changed in the arch-loader change
napetrov a5a5d7c
test(novelty): move the exit-code tests to their own file
napetrov ff8a48b
refactor(novelty): drop the duplicate InputError branch in probe
antonwolfy 97059b0
test(arch): count relative exit imports and reused module aliases
antonwolfy 565c1fe
test(arch): scope-aware exit bindings; exit-code tests through cli.main
napetrov a04aef3
Merge remote-tracking branch 'intel/main' into pr316-land1031
napetrov d3e08f6
test(arch): resolve exit names by Python scope; shape tests through c…
napetrov 43a7726
test(arch): an annotation alone makes a name local to its function
napetrov 744d212
test(arch): list the scoping cases exit_sites does not resolve
antonwolfy 5beb467
test(model-compare): legacy-format treatment-arm refusals exit 2 thro…
napetrov 5629960
fix(arch): exit-site resolution follows Python scoping for the review…
napetrov 26c33c2
fix(arch): an enclosing scope's exit-kind binding counts after a late…
napetrov d78866b
test(arch): move the exit-site tests to test_exit_sites.py
napetrov 1f7ab50
Merge remote-tracking branch 'intel/main' into pr316-land1031
napetrov b493264
fix(test): the exit-site resolver follows scope and source position
napetrov 60a07d5
fix(test): nonlocal names bound by assignment reach the exit site
napetrov 31247c3
fix(test): repeated and chained global/nonlocal declarations in the e…
napetrov 4953525
style(tests): two-line comment at the exit-table type; kinds move to …
napetrov 7e7234b
refactor(tests): move the exit-site scan to tests/exit_site_scan.py
napetrov 5957355
fix(tests): exit-site scan reads match captures, late targets, litera…
napetrov 02056d2
fix(tests): exit-site scan resolves dotted imports by root, honours d…
napetrov 4e056b7
fix(tests): comprehension-before-rebinding case uses a counted exit call
napetrov 221b8d6
fix(tests): bind a class name after its body in the exit-site scan
antonwolfy 4d507d4
fix(tests): exit-site scan follows Python scope for del, nonlocal and…
napetrov 3972abc
fix(novelty): review leftovers from the exit-code contract
napetrov 1694b01
fix(tests): an alias copied in a function keeps every binding its sou…
napetrov b13ff7e
fix(tests): the exit-site scan skips function-local annotations
napetrov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
dokimi/changelog.d/20261030_120000_napetrov_arch-loader.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ### Changed | ||
|
|
||
| - **Bad input exits 2 in the `novelty` and `report model-compare` commands** — a | ||
| file that `novelty` cannot read or that is not the artifact it names (`--artifact`, | ||
| `--atoms`, `--probes`, `--competitors`, `--queries-by-skill`), and the runs that | ||
| `report model-compare` refuses (a missing, unreadable, non-JSON or non-object file; | ||
| runs that disagree on the treatment, prompt or judge), and the skill fields that | ||
| `novelty routing` refuses (a missing competitor, a skill listed twice, a skill compared | ||
| with itself, an all-vs-all catalog that holds one skill twice with different content), | ||
| exit 2 with `Error: <message>` on stderr. For a bad file the message names the file and | ||
| the reason; for a refused field it names the skill or option at fault. The `novelty` | ||
| file refusals keep the exit code 2 they had, `--artifact` and `--atoms` among them; the | ||
| `model-compare`, `routing` and `view` refusals keep that code too. Exit 1 stays the verdict of the gates | ||
| (`--strict`, `eval judge-validity`) and the code of a model failure (an extractor or judge | ||
| that errors), so a script that branches on the code must treat 2 as "fix the input". | ||
| `subjects run --novelty-artifact` still prints its own `Error loading novelty artifact:` message | ||
| (now with the new reason text) and exits 2, as before. `novelty view` | ||
| also checks the `bundle` of an atoms file, so a malformed bundle is refused with exit 2. Two `report model-compare` messages changed wording: | ||
| `File not found: <file>` is now `cannot read <file>: No such file or directory`, and | ||
| `Invalid JSON in <file>` is now `<file> is not valid JSON`. An invalid artifact named by | ||
| `novelty view` says which part is wrong: `is not valid JSON`, `is not UTF-8 text`, | ||
| `is not a novelty artifact: expected a JSON object`, or `is not a valid novelty artifact: | ||
| <reason>`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: A few leftovers from the old exit contract.
_result_measure(line 54) and_load_points(line 74) still say "or exit 2 naming the file"; they raiseInputErrornow.commands/arms.py:126catches(EmptyQuestionError, InputError);EmptyQuestionErroris anInputErrornow, soexcept InputErroris enough.novelty/measure.py:238:check_armsraisesInputErrorfor a missingfullbut a plainValueErrorfor unknown arms and for placebo without--placebo-text.utils.pyends with two blank lines.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 3972abc: judge_reliability docstrings say InputError; arms.py catches InputError alone (EmptyQuestionError is one); trailing blank lines in utils.py removed.