Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues requiring changes.
No open issues 🎉
What changed in this PR
0 new findings; nothing to fix.
This PR prevents deeply nested user files from producing uncaught RecursionError tracebacks in dokimi’s affected readers.
Changes:
- Handles excessive nesting through existing malformed-input behavior.
- Reuses shared readers for ledgers and skill-creator evaluation files.
- Adds regression tests and documents behavior and remaining exclusions.
| File | Description |
|---|---|
dokimi/tests/test_deep_user_inputs.py |
Adds 16 deep-input regression cases. |
dokimi/scripts/duplicates_baseline.json |
Removes the extracted reader’s duplication baseline. |
dokimi/dokimi/task_formats/source.py |
Records deeply nested JSONL lines as invalid. |
dokimi/dokimi/skills/formats.py |
Handles deeply nested manifests and marketplaces. |
dokimi/dokimi/skill_coverage.py |
Uses the shared evaluation-file reader. |
dokimi/dokimi/repos/ledger.py |
Loads ledgers through the shared JSON reader. |
dokimi/dokimi/repos/conformance.py |
Converts excessive YAML nesting into a loader error. |
dokimi/dokimi/repos/compare.py |
Treats deeply nested batch stamps as absent. |
dokimi/dokimi/report/eval_io.py |
Handles deeply nested evaluation and answers files. |
dokimi/dokimi/novelty/sweep.py |
Handles excessive nesting in resume rows. |
dokimi/dokimi/mcp/factory.py |
Reports excessive runtime-config nesting as an input error. |
dokimi/dokimi/external/upstream.py |
Refuses deeply nested upstream manifests. |
dokimi/dokimi/eval_coverage.py |
Extracts a shared nesting-aware evaluation reader. |
dokimi/dokimi/commands/repair_receipt.py |
Refuses deeply nested report input. |
dokimi/dokimi/commands/opportunities.py |
Handles excessive nesting during input parsing. |
dokimi/dokimi/commands/catalog_scan.py |
Handles deeply nested resume rows. |
dokimi/changelog.d/20261204_100000_napetrov_deep-user-input-refusal.md |
Documents fixes and remaining exclusions. |
Review effort: Balanced
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1645 +/- ##
==========================================
- Coverage 96.44% 96.43% -0.01%
==========================================
Files 585 585
Lines 76600 76600
Branches 13175 13174 -1
==========================================
- Hits 73876 73870 -6
Misses 1671 1671
- Partials 1053 1059 +6
🚀 New features to boost your workflow:
|
…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>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 17 selected item(s). CI at Review details
|
vchamarthi
left a comment
There was a problem hiding this comment.
@napetrov, could you fix the small thing I've marked fix before merge (in the line comments) and answer my question below? I'll approve once that's done.
I'll approve once that's done.
My question before I approve:
- A deeply nested answers file, or a deeply nested batch stamp, is read as no answers or no stamp (
dokimi/dokimi/report/eval_io.py:34,dokimi/dokimi/repos/compare.py:191), while a deeply nested ledger orevals.jsonis refused. State the choice in the PR description, as it asks, or refuse deep answers and stamp files the way the ledger is refused, so the user is told the file was not read.
What I checked on e7c2b1d:
- When I changed the code on purpose, the tests still passed for 5 of 9 changes, and no test pins these down yet (non-blocking):
dokimi/dokimi/commands/opportunities.py:55(the handled error is raised again),dokimi/dokimi/report/eval_io.py:34(the handled error is raised again),dokimi/dokimi/repos/compare.py:191(the handled error is raised again) and 2 more. - The 16 changed tests pass, and fail on main as expected.
- The full test suite passes with main merged in (36,378 tests), apart from failures main has too.
- It merges cleanly onto main.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g87AO2JI Thread: PRR_kwDOVBg7g88AAAABcgRV-g Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
|
|
abc5217 corrects the For the three named mutation notes, I changed each handler to re-raise. The existing deep-input test for opportunities, answers, or stamps failed in each run. |
Refuse a deeply nested user file instead of a RecursionError traceback
Problem
json.loads and yaml.safe_load raise RecursionError (not ValueError) past the interpreter's nesting limit. Readers of user files that catch only ValueError let it escape as a traceback:
repo compare --ledgeron a deeply nested ledger, and the other user-file readers listed below.Change
read_log(native_logs, an Inspect or promptfoo log),subjects/loader_load_mapping(a subject descriptor),datasetscells,openai_evalsideals. Each escapes as a RecursionError traceback today; a follow-up PR can route them through the same catch.Evidence
Behaviour
<path> is nested too deeply to read as JSON.cannot read the ledger: cannot read <path>: ...(the wrapper sits on the shared reader's message). An empty--ledger ""readscannot read the ledger: cannot read .: Is a directory(base:Is a directory; the empty path is.). A non-UTF-8 ledger readscannot read the ledger: <path> is not UTF-8 text(base: the raw codec error). Exit code and stdout are unchanged. A device path is refused by refuse_device.report evalstill generates the report and omits answers from an unreadable optional answers file.repo comparetreats an unreadable_eval/batch.jsonas missing and warnshas no stampwhen comparing multiple batches.🤖 Generated with Claude Code