Repository navigation
feat(runs): report eval --eval and eval score pointwise --answers take a run - #1523
Conversation
report eval --eval and eval score pointwise --answers now also take a run: its directory (one with a run.json), or the run_id or name of a run directory under the runs root. dokimi/runs/resolve.py reads the run's run.json through runs/scan and returns the one artifact of the kind the command reads. A file at the given path still wins, so every path reads as before. A run that has not ended complete, lists no artifact of the kind or more than one, a run.json that does not meet run.v1, or a run_id or name no run (or two runs) has exits 2 and says so; the error names the file, whose path still reads a stopped run's artifact. baseline:NAME is not handled here: it comes once runs.baseline gets its resolver. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
… yet The fragment and docs/runs.md showed --eval RUN as if a run's run_id from runs list worked: no command writes a run directory yet, so a RUN finds only directories the run-directory module made, and an envelope run_id is not a RUN. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…ocking on it resolve() opened ref/run.json once it existed, so a FIFO there hung the command. It now checks the stat as runs.scan does and exits 2. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…or a run With results/ unlistable, resolve() said no run had the name, though nothing was looked up. It now says the root cannot be listed, as runs show RUN_ID does. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
--eval eval reads the run named eval under the root rather than the eval/ directory eval score writes to; say so in docs/runs.md and the docstring, and test it. Test run.v1 on a run found by its run_id too. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The unlistable-root case took _find_run to complexity 11, over the growth cap; the error it raises is now built by _no_run. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The pattern held results/r-1/run.json, which the message spells with backslashes on Windows. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 11 selected item(s). CI at `50e2e61`: 3 failing, 23 passing, 4 skippedNot fully read: log of Test Linux Python 3.14: longer than 8000000 bytes, only the start was read; log of Test Linux Wheels Python 3.14: longer than 8000000 bytes, only the start was read
Review details
|
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1523 +/- ##
==========================================
- Coverage 96.52% 96.52% -0.01%
==========================================
Files 543 550 +7
Lines 72692 73178 +486
Branches 12535 12620 +85
==========================================
+ Hits 70168 70637 +469
- Misses 1545 1555 +10
- Partials 979 986 +7
🚀 New features to boost your workflow:
|
napetrov
left a comment
There was a problem hiding this comment.
All 28 focused tests passed. I also compared lookup by run name before and after copying its record inside the run directory. A backup copy of run.json makes a single run ambiguous when selected by name.
Mutation of changed linesAt 50e2e61: 77 caught · 3 missed Each row is a small deliberate break (a mutant) of a line this PR changes that every test reaching that line still passes. Add a test that fails on it or, if it cannot change behaviour, put
Not checked:
Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary. |
vchamarthi
left a comment
There was a problem hiding this comment.
@vlad-perevezentsev, could you fix the 2 small things I've marked fix before merge (in the line comments) and fix what the bot's thread on dokimi/dokimi/commands/report.py:101 and napetrov's thread on dokimi/dokimi/runs/resolve.py:115 still point out? I'll approve once that's done.
I'll approve once that's done.
What I checked on 242ad4e:
- When I changed the code on purpose, the tests still passed for 2 of 12 changes, and no test pins these down yet (non-blocking):
dokimi/dokimi/runs/resolve.py:84(the handled error is raised again) anddokimi/dokimi/runs/resolve.py:119(the handled error is raised again). - The 28 changed tests pass, and fail on main as expected.
- The full test suite passes with main merged in (33,868 tests), apart from failures main has too.
- It merges cleanly onto main.
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A run directory holding a backup of its record (previous-run.json) made a lookup by name report two runs, the same directory twice: the scan selects every run.v1 document. Only a file named run.json is a run's record now. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
report eval --eval RUN read the run's eval, but the sidecar looked for answers in answers/ next to eval/, which a run directory does not have: every answer in r.qa.json was null although the run lists its answers. resolve_with gives the run's answers with its eval, and report eval passes them to both report pages. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Main now has subjects run writing a run directory (intel#1494): the line that no command writes one was no longer true. The fragment also says that a run's report takes the run's answers. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…report 3aff61a looked the run's answers up with the same checks as its eval, so a run listing two answers (one per cell) or answers whose file is gone made report eval --eval RUN exit 2 with advice --eval cannot follow. The answers are taken only when the run lists exactly one file; otherwise the sidecar goes without them, as for a run that lists none. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
@vchamarthi Thanks. The four points are fixed (496a91e, 3aff61a, 397be7b, 576ff84). Of the two non-blocking survivors, the _stat one is pinned in 4594288 (a value with a NUL is left to the reader); the reread in _find_run is covered by test_an_unreadable_run_json_of_another_run_does_not_stop_the_lookup, which fails if that error propagates. Also 6793773: docs and fragment now say subjects run (#1494, merged since) writes a run directory, with no eval or answers. |
…ide its eval f1538d1 gave the report of a run that lists no answers, two or gone ones a sidecar without answers, but resolve_with returned None for them, as for a file, so both report pages still read the answers/ next to the run's eval/: answers the run did not list went into .qa.json. resolve_with now returns "" for such a run, and the sidecar takes no answers for it. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 9073998)
- Contract: changed. defaults dokimi/dokimi/commands/report.py:87; defaults dokimi/dokimi/report/eval_report.py:637
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
1 new must-fix finding. The run resolver tests pass on the branch. The pointwise test fails after merging current main and passes when updated to the current judge flag.
Checked the diff, input edges, prior feedback, and focused offline tests on Linux/Python 3.11 (50 passed in 2.29s).
The flag failure also reproduced in the merged checkout.
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Main moved eval score pointwise to --judge PROVIDER/MODEL; the old --judge-provider/--judge-model pair now exits 2 with 'moved:', so the test stopped before the judge after the merge of main. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 58a4aae)
- Contract: changed. defaults dokimi/dokimi/commands/report.py:87; defaults dokimi/dokimi/report/eval_report.py:637
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
0 new must-fix findings. Nothing to fix in this round. The previous pointwise test failure is fixed by 58a4aae8. The exact test now reaches the stub judge in the local merge with current main.
Checked the diff, input edges, and focused offline Linux tests (merged: 50 passed in 2.24s).
- Fixed on head by
58a4aae8. The original merged pointwise test now passes. Earlier thread
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The merge of main moved the sidecar's answer lookup into report/eval_io.py (answers_for_sidecar), so eval_report no longer imports answers_by_id and the test's monkeypatch found no attribute. Refs intel#94 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head f27da61)
- Contract: changed. defaults dokimi/dokimi/commands/report.py:87; defaults dokimi/dokimi/report/eval_report.py:593
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
No merge-blocking findings.
Checked file and run resolution, refusals and answer sidecars. Ran 136 focused tests with current main. Required CI passed. The runs documentation overlaps #1522.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com> # Conflicts: # dokimi/docs/runs.md
antonwolfy
left a comment
There was a problem hiding this comment.
LGTM. The resolver follows the order the docs give (file, run directory, run_id or name), refuses every case the description lists with exit 2, and the earlier review points are fixed at this head. No findings.
What I ran, on a Linux review host at 50e2e61:
make ci-local: 37 passed, 1 failed, 16 skipped. The one failure istest_growth_ratchet:dokimi/repos/manifest.py(807 lines) anddokimi/repos/workspace.py(803 lines) are over the 800 cap with no baseline entry. The PR does not touch either file, so the failure is not the PR's. 34,947 tests passed.- Read the diff of every changed file, and checked the docs section and the changelog fragment against the code.
- All 18 non-merge commits carry
Signed-off-by.
Checked, no issues
- Wiring:
report eval --evalandeval score pointwise --answersresolve once, before any use of the value; the other--answersreaders are untouched, as the docs say. - Sidecar answers: a run's listed answers go to both report pages, and
""(none, several, or a missing file) gives a sidecar without answers instead of readinganswers/besideeval/. - Lookup: only a file named
run.jsoncounts as a run, so a copy beside it is no second run; an empty value and a NUL in the value go to the reader unchanged. - Docs: the new section and the exit-code row match the error paths in
resolve.py;docs/runs.mdis already in the nav.
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 50e2e61)
- Contract: changed. defaults dokimi/dokimi/commands/report.py:87; defaults dokimi/dokimi/report/eval_report.py:596
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
Ready to merge.
Checked the documentation conflict resolution, run and file lookup, and the answer sidecar. 136 focused tests and required CI passed. The optional Linux jobs reproduce the file-length failure on main (#1605).
* fix(runs): import InputError from dokimi.files in runs/resolve upstream/main fails test_package_uses_the_new_modules: dokimi.runs.resolve imports InputError through the legacy dokimi.utils re-export. #1190 split utils into its defining modules and added the test; #1523 added the import. Each PR was green against its own base, so the failure appeared only after both merged. Import InputError from dokimi.files, where it is defined. It is the same class object, so nothing changes at runtime. Refs #1190, #1523 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> * test(runs): import InputError from dokimi.files in test_runs_resolve #1523 added the legacy dokimi.utils import in the test too. #1190 moved the tests to the defining modules, so point this one at dokimi.files as well. test_package_uses_the_new_modules scans only the package, so it did not catch this one. Refs #1190, #1523 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com> --------- Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Summary
Step R-8 of #94 R2: a command that reads an earlier result can take the run that wrote it, not only the file (§2.3 "Reuse instead of paying twice").
dokimi/runs/resolve.py:resolve(ref, kind, flag=...)returns the path the command reads. It reads the run'srun.json(run.v1) throughruns/scanand does not touchruns/rundir.py(feat(subjects): subjects run writes a run directory with its plan and result #1494 is open on it).RUNforms, in this order:eval/x.json) also goes to the reader unchanged, with its old error;run.jsonis that run, inside the runs root or outside it;run_idornamein eachrun.jsonunder the runs root (results/, orDOKIMI_RUNS_DIR). A directory withoutrun.json(theeval/thateval scorewrites) does not hide a run of its name; with no such run it goes to the reader as before.eval,answers) in the run'sartifactslist; only a file namedrun.jsonis a run's record (aprevious-run.jsoncopy beside it is no second run).report evalof a run takes theanswersthe run lists for its Q&A sidecar (.qa.json), since a run directory has noanswers/next toeval/(resolve_with(..., beside="answers")); a run that lists none, two (one per cell) or a missing one still gets its report, with a sidecar without answers.report eval --evalandeval score pointwise --answers.run_idor name, or two of them; a runs root that is missing or cannot be listed; a run that has not endedcomplete; arun.jsonthat is not a regular file (a FIFO would block), cannot be read or does not meetrun.v1; no artifact of the kind, more than one, or a listed file that is not there.baseline:NAMEis not handled here.runs.baseline.resolve_refcomes with T60, which runs in parallel. A follow-up wires it in once both are merged, so there is one resolver.subjects runwrites a run directory so far (feat(subjects): subjects run writes a run directory with its plan and result #1494,docs/run-directories.md), and it lists noevaloranswers.docs/runs.mdand the fragment say so. The resolver starts working for these two readers as the answers and score commands move to run directories (R-6).Docs:
docs/runs.md, new section "Reading a run:--eval RUN", plus a row in its exit-code table.Refs #94 R2
Changed output
A missing path whose name has a run id's characters (
--eval eval.json, no such file) still exits 2. Its message changes fromcannot read eval.json: No such file or directoryto--eval eval.json: no file of that name, and no run under results/ has it as its run_id or name. A path with a separator (eval/missing.json) prints the same as on main.Evidence
open_run(nightly-7complete,stoppedincomplete): see "Changed output". On the branch,--evalgiven the run'srun_idand--eval results/nightly-7also write the report (exit 0).eval score pointwise --answers stoppedexits 2 with the same refusal.DOKIMI_RUNS_DIR=/nonexistentgives... no file of that name, and runs root DOKIMI_RUNS_DIR=/nonexistent does not exist(exit 2).--eval eval/missing.jsonprints the same error on main and on the branch.tests/test_runs_resolve.py, 35 tests, one per ref form and refusal:--out-dirdeeper under the root, a run directory outside the root;run.jsonbeside it (previous-run.json);chmod 0), two runs with one run_id;incomplete,failed,interruptedandrunningruns;run.jsonthat is a FIFO or failsrun.v1(by path and by run_id), and an unreadablerun.jsonof another run;report eval --eval NAME, its sidecar holding the run's answers (two-condition and knowledge-run pages), a run with two answers or whose listed answers are gone,report evalexit 2 on a run without an eval,eval score pointwise --answers RUN_IDwith the judge mocked.running;> 1changed to> 2for matches and for listed artifacts;is_run_idgate dropped, and limited to missing paths; name matching dropped;run.jsonraised instead of counted;run.v1check dropped, on both routes;--timeout); unlistable-root case dropped;report.pyandevaluate.py; the run's answers not passed to the report, and dropped in each report page;ValueErrorno longer caught in_stat.slot ci --quick(lint, mypy, the whole suite): 0 failed, 33353 passed, 132 skipped.check_growth.py: no file or function over its cap. The fullmake ci-local --offlineruns on the last commit before publishing.chmodtests are skipped there; the expected paths are built fromPath), a real model (the judge is mocked).Not in this PR
baseline:NAMEas aRUN: after T60'sruns.baseline.resolve_refmerges.run_idof an artifact outside a run directory (runs list,runs show RUN_ID) is not aRUN. There is norun.jsonto tell whether the run ended complete.report generate --eval,eval score ragas|grounding|panel|checklist|pairwise|reference --answers,report model-compare --regular-runs/--golden-runs,baseline compare --eval.report evalon a run's eval: the report heading takes the file name, so a run'seval.v1.jsonis titledeval.v1. This matters once answers/score write run directories (R-6).Open questions
--allow-incomplete) that resolves the run anyway?Checklist
pytestpasses:tests/test_runs_resolve.py(new, 35 tests);slot ci --quick0 failedruff,mypy, and schema checks pass:ci-local --jobs static,typecheck0 faileddocs/runs.md("Reading a run:--eval RUN", the sidecar's answers, exit codes); help of the two flagsAGENTS.md: mutations above, bad inputs (missing file, plain directory, FIFO, unlistable root, badDOKIMI_RUNS_DIR),list_new_error_paths.py,check_growth.pyraise/exit and test names the doc, contract or issue it traces to: the module points todocs/runs.md, each test quotes its lineruns/resolve.py, the test file, the fragment