Repository navigation
[stacked on #1645] fix: refuse a deeply nested native log, subject descriptor, dataset cell or ideal - #1650
[stacked on #1645] fix: refuse a deeply nested native log, subject descriptor, dataset cell or ideal#1650napetrov wants to merge 3 commits into
Conversation
…ceback json.loads and yaml.safe_load raise RecursionError, not ValueError, past the interpreter's nesting limit. The user-file readers that caught only ValueError (repo compare --ledger, the batch stamp, eval and answers files, repair receipts, --resume and --jsonl rows, task source lines, skill, eval-coverage and upstream manifests, the runtime config) let it escape as a traceback. The ledger now goes through the shared reader in dokimi.files, which already refuses deep nesting; the others catch RecursionError with the handler they already have. Tests: tests/test_deep_user_inputs.py (16 cases, red on the base, green here). Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
…ell or ideal The readers that intel#1645 did not reach still let a RecursionError escape on deeply nested input: the native log (eval native-import), the subject descriptor (catalog show --kind subject), a SWE-bench FAIL_TO_PASS cell, and a json_match ideal. The log and the descriptor now go through the shared reader in dokimi.files, which refuses deep nesting as InputError. The cell and the ideal are not files: a cell nested too deeply is not a list, and an ideal nested too deeply is dropped with the note an ideal that is not JSON already gets. batch_stamp and answers_by_id stay as they are: both already read any unparseable file, deep or not, as a missing stamp or answers file, and tests/test_deep_user_inputs.py pins that. Tests: tests/test_deep_user_inputs.py (4 new cases, red on the base). Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1650 +/- ##
=======================================
Coverage 96.49% 96.49%
=======================================
Files 569 569
Lines 75249 75250 +1
Branches 12980 12979 -1
=======================================
+ Hits 72611 72616 +5
+ Misses 1615 1606 -9
- Partials 1023 1028 +5
🚀 New features to boost your workflow:
|
The four eval native-import log rows (missing, directory, unreadable, dangling-link) exit 2 with an input error now, so the allowlist names them as known failures that pass. Rows and digest follow the list. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
There was a problem hiding this comment.
🟡 Changes recommended
The changelog incorrectly claims deeply nested native logs and subject descriptors still cause tracebacks, contradicting the implemented InputError refusal.
1 open issue
What changed in this PR
1 new finding.
This PR extends #1645’s deep-input handling to native logs, JSON subject descriptors, dataset cells, and grading ideals, preventing parser recursion errors from escaping.
Changes:
- Route log and descriptor JSON through the shared input reader.
- Handle excessive nesting using existing malformed-input behavior.
- Add regression tests, shrink fault allowances, and document fixes.
| File | Description |
|---|---|
| dokimi/tests/test_deep_user_inputs.py | Adds deep-input regression cases. |
| dokimi/tests/data/cli_fault_allowlist.txt | Removes fixed native-import exceptions. |
| dokimi/tests/cli_faults.py | Updates allowlist count and digest. |
| dokimi/scripts/duplicates_baseline.json | Removes extracted duplicate allowance. |
| dokimi/dokimi/task_formats/source.py | Handles deeply nested JSONL rows. |
| dokimi/dokimi/task_formats/imports/openai_evals.py | Drops deeply nested ideals with a note. |
| dokimi/dokimi/task_formats/imports/native_logs.py | Uses the shared JSON reader. |
| dokimi/dokimi/task_formats/datasets.py | Handles deeply nested test-list cells. |
| dokimi/dokimi/subjects/loader.py | Uses shared reading for JSON descriptors. |
| dokimi/dokimi/skills/formats.py | Handles deeply nested manifests. |
| dokimi/dokimi/skill_coverage.py | Reuses shared eval-row parsing. |
| dokimi/dokimi/repos/ledger.py | Wraps shared-reader input errors. |
| dokimi/dokimi/repos/conformance.py | Refuses deeply nested expectations. |
| dokimi/dokimi/repos/compare.py | Treats deeply nested stamps as absent. |
| dokimi/dokimi/report/eval_io.py | Handles deeply nested eval and answer files. |
| dokimi/dokimi/novelty/sweep.py | Handles deeply nested resume rows. |
| dokimi/dokimi/mcp/factory.py | Refuses deeply nested runtime configuration. |
| dokimi/dokimi/external/upstream.py | Refuses deeply nested upstream manifests. |
| dokimi/dokimi/eval_coverage.py | Extracts nesting-aware eval-row parsing. |
| dokimi/dokimi/commands/repair_receipt.py | Refuses deeply nested reports. |
| dokimi/dokimi/commands/opportunities.py | Handles deeply nested JSON input. |
| dokimi/dokimi/commands/catalog_scan.py | Refuses deeply nested scan rows. |
| dokimi/changelog.d/20261204_110000_napetrov_deep-input-readers.md | Documents follow-up reader fixes. |
| dokimi/changelog.d/20261204_100000_napetrov_deep-user-input-refusal.md | Documents the inherited input-handling fixes. |
Review effort: Balanced
|
|
||
| ### Fixed | ||
|
|
||
| - **A deeply nested user file is refused, not a traceback** — a JSON or YAML file nested past the parser's recursion limit printed a `RecursionError` traceback from `repo compare --ledger`, `report eval` and `report generate` (eval and answers files), conformance expectations (`repos/conformance.py`), `catalog scan --resume` and `catalog novelty --resume` (`--jsonl` rows), `catalog repair-receipt`, `report opportunities`, `catalog eval` and `eval skill-coverage` (`evals.json`), task source lines, skill and upstream manifests, and the runtime config. `repo compare --ledger` now exits 2 with `cannot read the ledger: <file> is not valid JSON: ...`, and refuses a device path such as `/dev/null` as `not a file`. The other readers treat such a file as they treat a malformed one: an input error naming the file, or a missing stamp or answers file. Native task logs (Inspect, promptfoo) and the subject descriptor still raise a traceback on deep nesting; a follow-up will route them the same way. |
|
✅ OpenCodeReview: Review complete: 1 finding(s) across 24 selected item(s). CI at Review details
|

Summary
Stacked on #1645 (head e7c2b1d). Draft until #1645 merges; this PR's diff also shows #1645's commit until then.
batch_stamp and answers_by_id are unchanged: they already read any unparseable file as absent, deep or not.
Evidence
tests/test_deep_user_inputs.py: 4 new cases fail on e7c2b1d withRecursionError(read_log, load_subject, _test_list, openai_evals ideal).After: 20 passed on this head; targeted subset (answer imports, task formats, subjects, swe-bench, promptfoo csv, input refusal, cli refusal parity, import architecture, cli output, repo l0) 1428 passed, 1 skipped.
eval native-import deep.jsonandcatalog show deep.json --kind subjectexit 2 withis not valid JSON, no traceback.ruff check .clean;mypyclean (576 files).Merge Danger
Door: two-way (a refusal instead of a traceback; reverting restores the traceback).
Behaviour change on unreadable input only: a missing, device, non-UTF-8 or deeply nested
eval native-importlog orcatalog show --kind subjectdescriptor now exits 2 with anInputErrornaming the file. Input that parsed before is unchanged.Blast radius: narrow: two CLI commands, plus two in-process cells (dataset test-list cell, json_match ideal).
Not covered here, same class:
subjects/run_plan.py:121,task_formats/imports/promptfoo.py:75, the.tomlbranch ofsubjects/loader.py.🤖 Generated with Claude Code