Repository navigation
fix(repo): repo validate reports a task.json link that loops or is a directory (#910) - #952
Conversation
…directory (intel#910) _check_task caught only JSONDecodeError and UnicodeDecodeError around the task.json read, so a link to itself or to a directory ended in a traceback and exit 5, in a tree (OSError) and at <dir>@rev (SourceError). Both are now a 'cannot read task.json' error and exit 1. Fixes intel#910. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #952 +/- ##
==========================================
+ Coverage 95.84% 95.91% +0.06%
==========================================
Files 442 449 +7
Lines 58843 59481 +638
Branches 10148 10254 +106
==========================================
+ Hits 56397 57050 +653
+ Misses 1521 1509 -12
+ Partials 925 922 -3
🚀 New features to boost your workflow:
|
…tel#910) The contract's task.json section now says that an invalid, non-object or unreadable task.json (a link to itself or to a directory) is an error line and exit 1. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change to report unreadable task.json links as validation errors.
No open issues 🎉
What changed in this PR
0 new findings; nothing to fix.
Fixes #910 by making repo validate report unreadable task.json links as validation errors with exit code 1, rather than a traceback and exit code 5.
Changes:
- Extracts task JSON reading into a helper that handles read failures while preserving invalid-JSON messages.
- Adds regression coverage for self-links and directory links in working trees and committed revisions, plus pre-Python 3.13 loop errors.
- Documents the validation behavior and adds a changelog entry.
| File | Description |
|---|---|
dokimi/tests/test_repo_manifest.py |
Adds unreadable-link regression tests. |
dokimi/dokimi/repos/manifest.py |
Converts task JSON read failures into validation errors. |
dokimi/docs/repo-evaluation-contract.md |
Documents error reporting and exit code 1. |
dokimi/changelog.d/20261118_170000_task-json-link-validate.md |
Records the fix for #910. |
Review effort: Balanced
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). CI at Review details
|
…d git show is raised Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…eported Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟢 LGTM · checked e77ebc1 · nothing required from @vchamarthi
🔀 Merge: safe now · merges cleanly into current main, 26 commits behind, and its tests pass on the merge · after it, #1044 and #787 need a rebase (repos/manifest.py)
✅ make ci-local --offline: 23,646 passed · test_docker_cmd.py, test_repo_host.py) timed out under load and pass on rerun; schema_compat fails from newer main, not from this PR · ✅ the new tests fail on the base and at 792671f
A task.json link that loops, names a directory or nothing, or leaves the repository is now an error: line in both trees.
Fixed in this branch, up to e77ebc1:
- A working tree showed the host's absolute path and an
[Errno], and a failedgit showread as a task error: aa83e9e readstree.resolve(where)and catches onlyOSErrorandSourceArgumentError. - Dangling and out-of-repo links were untested and undocumented: e77ebc1 adds both to the test, the contract and the fragment.
…ctory (intel#910) A task.json link such as missing/../missing.json at <dir>@rev raised _NoSuchPath out of _read_task_json instead of recording the task error. It is now caught with the other unreadable-link cases, with a test case. Signed-off-by: vchamarthi <123653452+vchamarthi@users.noreply.github.com>
|
🟢 Ready for re-review · 1 commit on Next: a re-review of the new head. Changes
Threads and comments
Verified on the new head: ✅ 1/1 tests fail before the fix, pass after · ✅ full suite with main merged in: 24313 passed, 1 failure that main has too · ✅ second reader: nothing raised What each test shows
|
…ntel#910) Dropping OSError from the except in _read_task_json left every test green, though a task.json that raises PermissionError on open then exits 5 with a traceback. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
|
Pushed f485673, a test-only commit: a |
xaleryb
left a comment
There was a problem hiding this comment.
Approved on f485673. CI is green on the head. Checked 12 task.json shapes (loops, directory, dangling, past an absent directory, outside the repo, good links): main exits 5 with a traceback, the head exits 1 with the file named. The added test pins that an unopenable task.json is reported, not raised.
Summary
repo validateexited 5 with a traceback whentask.jsonis a link to itself or to a directory, in a tree and at<dir>@rev. It now reportscannot read task.json: ...and exits 1. Fixes #910.Changes
_read_task_jsonindokimi/dokimi/repos/manifest.pyreadstask.jsonand catchesOSError,RuntimeErrorandSourceErrorbesides the two JSON errors. It is a function of its own, with its result namedunreadableso it does not reuse the laterproblem, because a thirdexceptin_check_taskgrew its complexity past the baseline.dokimi/tests/test_repo_manifest.pyover loop and directory link, tree and@HEAD.WorkTree._resolveraiseRuntimeError, whichPath.resolvedoes for a loop before Python 3.13.Risk
Low. Only a
task.jsonthat could not be read before changes outcome: an error line and exit 1 instead of a traceback and exit 5. The error text for invalid JSON is unchanged.Testing
python -m pytest -q -p no:cacheprovider tests/test_repo_manifest.py tests/test_growth_ratchet.pypasses, andruff checkandmypypass ondokimi/repos/manifest.py. The new test fails on main in all four cases.Open questions
None
Revert
Plain revert. Nothing stored is left behind.
Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)Checklist evidence
pytestpasses: 1 test file(s) changed; the whole suite passed; 2 proof(s) fail before the changeruff,mypy, and schema checks pass: passed: ruff check / schema-check (Static checks (ruff, schema, zizmor, licenses, pre-commit, bandit, secrets, changelog, schema com...), typecheck / mypy (mypy)dokimi/docs/repo-evaluation-contract.mdAGENTS.md: second reader: 2 round(s), nothing left open; mutation of changed lines ranraise/exit and test names the doc, contract or issue it traces to: every new error path and test names a doc, contract or issue.github/.licenserc.yaml): no new source fileFixes #910.