Repository navigation
fix(readers): dashboard generate and hits judge refuse a directory they cannot list, eval inspect reports it #1390
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ee2dcb4
fix(dashboard): generate refuses a results directory it cannot list (…
antonwolfy 00a8c0c
fix(hits): judge and sheet refuse an eval content directory they cann…
antonwolfy 4c4e865
fix(eval): inspect reports a directory it cannot list instead of skip…
antonwolfy 74fe4a4
fix(dashboard): read an eval or evaluations symlink to a directory as…
antonwolfy 7868a1d
fix(dashboard): match an eval or evaluations symlink without regard t…
antonwolfy 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
10 changes: 10 additions & 0 deletions
10
dokimi/changelog.d/20261128_150000_readers-unlistable-dir-three.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,10 @@ | ||
| <!-- | ||
| Copyright (C) 2026 Intel Corporation | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| --> | ||
|
|
||
| ### Fixed | ||
|
|
||
| - **`dashboard generate` refuses a results directory with a subdirectory it cannot list** — `ResultsAggregator.aggregate` found the result files with `Path.rglob`, which skips a subdirectory it cannot list (mode `0o111`) without an error, so a `eval_*.json` file below it was missing from the dashboard and nothing said so. It now lists the tree strictly and `dashboard generate` exits 2 naming the directory. A tree that can be listed gives the same files, and an `eval` or `evaluations` that is a symlink to a directory is still read through. | ||
| - **`repo hits judge` and `repo hits sheet` refuse a batch whose exported eval content has a directory they cannot list** — the task directory was found with `Path.rglob("task.json")`, which skips a directory it cannot list, so a task below it was reported as `no directory of task ... with a task.json`, blaming a missing task. Both commands now exit 2 naming the directory and the OS reason, before any judge call. A task that is really absent is reported as before. | ||
| - **`eval inspect` reports a directory it cannot list instead of skipping it** — the tree scan listed a directory with `iterdir()` inside `except OSError: return`, so the tasks below a directory it could not list (mode `0o111`) were left out without a word. The directory is now an `unknown` item with a `cannot read:` problem, as a `task.md` the scan cannot read already was, and the rest of the tree is still reported. The exit code is unchanged (0). A tree that can be listed gives the same items. |
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
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,45 @@ | ||
| # Copyright (C) 2026 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """`repo hits judge` and `repo hits sheet` refuse a batch whose exported eval content has a directory they cannot list. | ||
|
|
||
| The task directory is found by walking ``<batch>/_eval/content``: a task under a directory that cannot be listed is | ||
| not a missing task (#1364). | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import errno | ||
| import os | ||
| import shutil | ||
|
|
||
| import pytest | ||
|
|
||
| from dokimi import llm | ||
| from dokimi.repos.hits_judge import read_pairs | ||
| from tests.test_repo_hits_judge import JUDGE, _batch, _run | ||
|
|
||
|
|
||
| @pytest.mark.skipif(not hasattr(os, "geteuid") or os.geteuid() == 0, reason="root lists a mode 111 directory") | ||
| @pytest.mark.parametrize("argv", [["judge", "--judge", JUDGE], ["sheet", "--out", "sheet.json"]]) | ||
| def test_a_task_under_a_directory_that_cannot_be_listed_is_refused_not_reported_missing(tmp_path, capsys, argv): | ||
| batch = _batch(tmp_path) | ||
| tasks = batch / "_eval" / "content" / "tasks" | ||
| tasks.chmod(0o111) | ||
| argv = [a if a != "sheet.json" else str(tmp_path / "sheet.json") for a in argv] | ||
| try: | ||
| with llm.use_adapter(llm.FakeAdapter()) as fake: # an unscripted call fails the test | ||
| code, out, err = _run(capsys, argv[0], str(batch), *argv[1:]) | ||
| finally: | ||
| tasks.chmod(0o755) | ||
| assert (code, out, fake.requests) == (2, "", []) | ||
| assert err.startswith(f"Error: cannot list {tasks}: {os.strerror(errno.EACCES)}"), err | ||
| assert "no directory of task" not in err | ||
| assert not (tmp_path / "sheet.json").exists() | ||
|
|
||
|
|
||
| def test_a_batch_with_no_exported_eval_content_reports_each_task_as_missing(tmp_path): | ||
| batch = _batch(tmp_path) | ||
| shutil.rmtree(batch / "_eval") | ||
| _, pairs = read_pairs(batch) | ||
| assert pairs and all(p.problem and "no directory of task" in p.problem for p in pairs) |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.