Skip to content

refactor(judge): split eval judge agreement into helpers; public build_validity_pairs - #1416

Merged
napetrov merged 2 commits into
intel:mainfrom
napetrov:arch/r8-6
Dec 6, 2026
Merged

napetrov merged 2 commits into
intel:mainfrom
napetrov:arch/r8-6

Conversation

@napetrov

@napetrov napetrov commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

cmd_eval_cross_judge was 147 lines, ruff mccabe 29, the largest function in commands/. It is now a sequence of helpers, and the private _build (imported by judge wording and judge sequential) is public as build_validity_pairs.

cmd_eval_cross_judge            mccabe 29 -> 5
  _grounded_truth               --grounded ground truth
  _cross_judge_problems         stored-score gate (messages unchanged)
    _rescored_stored_scores / _digest_gaps
  _load_pairs / _load_validity  result files read before any paid call
  _score_judges                 one measure per --judge entry
  _warn_validity / _print_agreement / _scored_nothing_exit / _strict_cross_judge_exit

Evidence

  • The original 7,700-case differential probe compared the refactor with its November 29 parent using the real CLI and a deterministic fake judge. Outputs, exit codes, written files, and judge calls matched after normalizing the run ID and thread order.
  • The standalone branch passed 1,491 focused tests with one skip. These cover judge agreement, temperature flags, output-write errors, source growth, import architecture, and documentation references.

Merge Danger

  • The branch applies the two judge commits to current main. The agreement command retains repeatable --judge, comma-separated names within each argument, and the existing diagnostics.
  • build_validity_pairs preserves the private helper’s signature. All repository callers use the public name.
  • The changelog records the public name in an Added fragment.

🤖 Generated with Claude Code

@napetrov napetrov added the skip-changelog No user-visible change: bypasses the changelog fragment check label Nov 29, 2026
@codecov-commenter

codecov-commenter commented Nov 29, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 95.87629% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.48%. Comparing base (1f4baa1) to head (7717744).

Files with missing lines Patch % Lines
dokimi/dokimi/commands/judge_reliability.py 95.74% 2 Missing and 2 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1416      +/-   ##
==========================================
- Coverage   96.49%   96.48%   -0.01%     
==========================================
  Files         569      569              
  Lines       75249    75277      +28     
  Branches    12980    12981       +1     
==========================================
+ Hits        72611    72634      +23     
- Misses       1615     1616       +1     
- Partials     1023     1027       +4     
Files with missing lines Coverage Δ
dokimi/dokimi/eval/judge_sequential.py 100.00% <100.00%> (ø)
dokimi/dokimi/eval/judge_validity.py 98.33% <100.00%> (ø)
dokimi/dokimi/commands/judge_reliability.py 98.43% <95.74%> (+0.12%) ⬆️

... and 5 files with indirect coverage changes

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

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

⚠️ Tests miss 20 of 80 small breaks of the lines this PR changes, and not every break was tried

At 7717744: 60 caught · 20 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 # mutation-ok[<operator>]: <reason> at the end of the line or alone on the line above.

Where Operator Change no test notices Tests reaching the line
dokimi/dokimi/commands/judge_reliability.py:310 drop-clause body.get("metadata") or {} → (body.get("metadata")) 24
dokimi/dokimi/commands/judge_reliability.py:312 drop-clause isinstance(r, dict) and isinstance(r.get("arms"), dict) → (isinstance(r, dict)) 24
dokimi/dokimi/commands/judge_reliability.py:313 drop-filter isinstance(body, dict) → True 24
dokimi/dokimi/commands/judge_reliability.py:315 drop-clause not isinstance(ev, dict) or outcome_of(ev) == ASK → (not isinstance(ev, dict)) 24
dokimi/dokimi/commands/judge_reliability.py:318 drop-clause ev.get("scores") or {} → (ev.get("scores")) 24
dokimi/dokimi/commands/judge_reliability.py:330 drop-clause isinstance(r, dict) and isinstance(question_id(r), (str, int)) → (isinstance(question_id(r), (str, int))) 24
dokimi/dokimi/commands/judge_reliability.py:337 delete-statement continue → pass 1
dokimi/dokimi/commands/judge_reliability.py:360 drop-clause materials is not None and materials.mode != JUDGE_CONTEXT_BASELINE → (materials is not None) 26
dokimi/dokimi/commands/judge_reliability.py:472 take-branch data.get("baseline_arm") if isinstance(data, dict) else None → (None) 106
dokimi/dokimi/commands/judge_reliability.py:473 take-branch data.get("library_name") if isinstance(data, dict) else None → (None) 106
dokimi/dokimi/commands/judge_reliability.py:493 delete-statement _warn_validity(report, validity, data) → pass 40
dokimi/dokimi/commands/judge_reliability.py:311 drop-clause data.get("answers") or [] → (data.get("answers")) 24
dokimi/dokimi/commands/judge_reliability.py:312 drop-clause isinstance(r, dict) and isinstance(r.get("arms"), dict) → (isinstance(r.get("arms"), dict)) 24
dokimi/dokimi/commands/judge_reliability.py:314 drop-clause data.get("evaluations") or [] → (data.get("evaluations")) 24
dokimi/dokimi/commands/judge_reliability.py:315 drop-clause not isinstance(ev, dict) or outcome_of(ev) == ASK → (outcome_of(ev) == ASK) 24
dokimi/dokimi/commands/judge_reliability.py:319 drop-clause kinds.get(arm) or ("baseline" if arm == baseline else None) → (kinds.get(arm)) 24
dokimi/dokimi/commands/judge_reliability.py:329 drop-clause data.get("answers") or [] → (data.get("answers")) 24
dokimi/dokimi/commands/judge_reliability.py:330 drop-clause isinstance(r, dict) and isinstance(question_id(r), (str, int)) → (isinstance(r, dict)) 24
dokimi/dokimi/commands/judge_reliability.py:496 drop-clause args.output or Path(args.answers).with_name(Path(args.answers).stem + "_crossjud → (args.output) 38
dokimi/dokimi/commands/judge_reliability.py:312 drop-filter isinstance(r, dict) and isinstance(r.get("arms"), dict) → True 24

Not checked:

  • 42 more breaks of covered changed lines were over the limit and not tried
  • 24 changed lines were not mutated

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

@napetrov napetrov changed the title [stacked on #1190] refactor(judge): split eval judge agreement into helpers; public build_validity_pairs refactor(judge): split eval judge agreement into helpers; public build_validity_pairs Dec 2, 2026
napetrov added a commit that referenced this pull request Dec 3, 2026
)

* refactor: make shared helpers public and dedupe the git -z reader

- eval/stats: round_p, wilson, apply_correction, describe_deltas,
  finalize_result and paired_differences lose their underscore; their
  users (interactions, binary_stats, model_compare, tests) follow.
  judge_validity keeps importing the old _wilson alias until #1416.
- report/eval_io: the eval-file, answers and Q&A sidecar readers the
  paired and one-condition reports share, moved out of eval_report.
- scripts/_git_z: one git_z(*args, cwd) for the three check scripts
  that carried identical copies; the duplicate baseline entry goes.

No output changes.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>

* fix(scripts): check scripts find their sibling _git_z under PYTHONSAFEPATH

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* test(report): both reports must take sibling_answers_path from eval_io

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* test(stats): an adjusted p of exactly 0.05 is not significant

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* test(stats): record the verified boundary fix

Thread: PRRT_kwDOVBg7g86-f3wf: already fixed in 1cbdcf3
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>

* test(cli): supply an agent run fault fixture

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
(cherry picked from commit e249323eb321bbc70ac425c03170071d835a143c)

---------

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Co-authored-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…d_validity_pairs

cmd_eval_cross_judge (147 lines, ruff mccabe 29) is now a short sequence
of helpers: grounded truth, the stored-score gate, the pairwise/checklist
and validity file loads, per-judge scoring, validity warnings and the
report writer. The gate's problem messages are unchanged.

judge wording and judge sequential imported the private `_build` from
judge_validity; it is now build_validity_pairs. No behaviour change: a
differential run of 7700 argument/fixture cases matched the previous
output (stdout, stderr, exit codes, written files, judge calls).

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
The function is at complexity 5 after the split, under the cap; the
ratchet asks for its entry to go (scripts/check_growth.py --update).

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov
napetrov marked this pull request as ready for review December 5, 2026 05:05
@napetrov
napetrov requested a review from a team as a code owner December 5, 2026 05:05
Copilot AI balanced review requested due to automatic review settings December 5, 2026 05:05

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.

🟢 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 refactor simplifies dokimi’s judge-agreement command while preserving its behavior and exposes the shared validity-pair builder.

Changes:

  • Extract focused helpers from cmd_eval_cross_judge.
  • Rename _build to public build_validity_pairs and update callers and tests.
  • Remove the obsolete complexity exemption and document the public API.
File Description
dokimi/​tests/​test_judge_validity.py Update tests to use the public builder.
dokimi/​tests/​test_eval_output_write_errors.py Update the builder mock.
dokimi/​scripts/​growth_baseline.json Remove the command’s complexity exemption.
dokimi/​dokimi/​eval/​judge_validity.py Expose build_validity_pairs.
dokimi/​dokimi/​eval/​judge_sequential.py Use the public builder.
dokimi/​dokimi/​commands/​judge_reliability.py Extract agreement helpers and update the wording caller.
dokimi/​changelog.d/​20261129_120000_napetrov_arch-r8-6.md Document the public name and migration.

Review effort: Balanced

@exai-bot

exai-bot commented Dec 5, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 7 selected item(s).

CI at 7717744: 21 passing, 4 skipped.

Review details
  • Commit reviewed: 7717744 against merge base 1f4baa1
  • Coverage: 7 files in 2 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 141k tokens (62k from cache), 23s
  • Tool calls: 14 (9 file_read, 2 code_search, 1 ci_status, 1 file_read_diff, 1 local_check_results)
  • Judge reliability command refactor and baseline tracking: 3 files
  • Judge evaluation behavior and output-error tests: 4 files

@vchamarthi vchamarthi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving 7717744.
Still open: when I changed the code on purpose, the tests still passed for 1 of 12 changes, and no test pins this one down yet (non-blocking): dokimi/dokimi/commands/judge_reliability.py:288 (the condition is negated).
What I checked: the 363 changed tests pass, and fail on main as expected; the full test suite passes with main merged in (43,553 tests), apart from failures main has too; it merges cleanly onto main.

@napetrov
napetrov merged commit 19e5222 into intel:main Dec 6, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog No user-visible change: bypasses the changelog fragment check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants