Skip to content

[stacked on #1645] fix: refuse a deeply nested native log, subject descriptor, dataset cell or ideal - #1650

Open
napetrov wants to merge 3 commits into
intel:mainfrom
napetrov:arch/r14-1
Open

napetrov wants to merge 3 commits into
intel:mainfrom
napetrov:arch/r14-1

Conversation

@napetrov

@napetrov napetrov commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Stacked on #1645 (head e7c2b1d). Draft until #1645 merges; this PR's diff also shows #1645's commit until then.

read_log / load_subject (JSON file)
  read_json_input(path)              # #1645 shared reader
    RecursionError -> InputError     # exit 2, names the file

_test_list(cell)                     # SWE-bench JSON-string cell
  json.loads(cell)
    ValueError | RecursionError -> None

openai_evals _checks (json_match)
  json.loads(ideal)
    ValueError | RecursionError -> note "ideal that is not JSON dropped"

batch_stamp and answers_by_id are unchanged: they already read any unparseable file as absent, deep or not.

Evidence

  • Before: tests/test_deep_user_inputs.py: 4 new cases fail on e7c2b1d with RecursionError (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.
  • CLI on the head: eval native-import deep.json and catalog show deep.json --kind subject exit 2 with is not valid JSON, no traceback.
  • ruff check . clean; mypy clean (576 files).
  • Self-review (local mode, fresh Sonnet child, 3 passes, no blocking) on the head.

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-import log or catalog show --kind subject descriptor now exits 2 with an InputError naming 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 .toml branch of subjects/loader.py.

🤖 Generated with Claude Code

…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-commenter

codecov-commenter commented Dec 5, 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 96.49%. Comparing base (1f4baa1) to head (a06b406).
⚠️ Report is 1 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/catalog_scan.py 97.34% <100.00%> (ø)
dokimi/dokimi/commands/opportunities.py 86.58% <100.00%> (ø)
dokimi/dokimi/commands/repair_receipt.py 100.00% <100.00%> (ø)
dokimi/dokimi/eval_coverage.py 99.19% <100.00%> (+0.01%) ⬆️
dokimi/dokimi/external/upstream.py 91.77% <100.00%> (ø)
dokimi/dokimi/mcp/factory.py 97.52% <100.00%> (ø)
dokimi/dokimi/novelty/sweep.py 94.83% <100.00%> (ø)
dokimi/dokimi/report/eval_io.py 100.00% <100.00%> (ø)
dokimi/dokimi/repos/compare.py 99.53% <100.00%> (ø)
dokimi/dokimi/repos/conformance.py 99.21% <100.00%> (ø)
... and 8 more

... and 8 files with indirect coverage changes

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

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>
@napetrov
napetrov marked this pull request as ready for review December 6, 2026 06:06
@napetrov
napetrov requested a review from a team as a code owner December 6, 2026 06:06
Copilot AI balanced review requested due to automatic review settings December 6, 2026 06:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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.
@exai-bot

exai-bot commented Dec 6, 2026

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 1 finding(s) across 24 selected item(s).

CI at a06b406: 26 passing, 4 skipped.

Review details
  • Commit reviewed: a06b406 against merge base 1f4baa1
  • Coverage: 24 files in 5 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 510k tokens (302k from cache), 38s
  • Tool calls: 58 (42 file_read, 5 code_search, 4 file_read_diff, 3 local_check_results, 1 ci_status, 1 code_comment, 1 file_find, 1 pr_comments)
  • Deep user-input refusal and CLI fault tests: 4 files
  • Coverage, skill, and subject input readers: 7 files
  • Command and integration input-reader adoption: 6 files
  • Repository comparison, conformance, and ledger readers: 3 files
  • Task dataset and import readers: 4 files

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants