Repository navigation
refactor: make shared helpers public and dedupe the git -z reader - #1527
Conversation
- 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 intel#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>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the refactor that exposes shared helpers and consolidates duplicated readers.
No open issues 🎉
What changed in this PR
0 new findings; nothing to fix.
This refactor makes dokimi’s shared helpers public and consolidates duplicated readers without changing report outputs or file formats.
Changes:
- Publish statistics helpers and update callers, retaining
_wilsoncompatibility until #1416. - Extract shared report input and sidecar helpers into
eval_io.py. - Consolidate the Git NUL-separated reader and update tests and tooling configuration.
| File | Description |
|---|---|
dokimi/tests/test_writers_save_artifact.py |
Update the answer-reader patch target. |
dokimi/tests/test_stats_float_range.py |
Use public paired differences. |
dokimi/tests/test_stats_exact.py |
Use public correction and rounding helpers. |
dokimi/tests/test_stats_correction.py |
Update correction helper calls. |
dokimi/tests/test_single_condition_arms_report.py |
Import the shared answers-path helper. |
dokimi/tests/test_sign_flip_float_range.py |
Use public delta descriptions. |
dokimi/tests/test_report_writers_surrogate.py |
Update the sidecar-writer patch target. |
dokimi/tests/test_holm_floor_family.py |
Use public statistics helpers. |
dokimi/tests/test_docs_review_triggers.py |
Enable sibling helper imports. |
dokimi/tests/test_check_comment_blocks.py |
Enable sibling helper imports. |
dokimi/tests/test_check_changelog_fragment.py |
Enable sibling helper imports. |
dokimi/tests/test_binary_stats.py |
Update a helper name in a docstring. |
dokimi/scripts/duplicates_baseline.json |
Remove the obsolete reader duplication entry. |
dokimi/scripts/check_docs_review_triggers.py |
Use the shared Git reader. |
dokimi/scripts/check_comment_blocks.py |
Use the shared Git reader. |
dokimi/scripts/check_changelog_fragment.py |
Use the shared Git reader. |
dokimi/scripts/_git_z.py |
Add the common NUL-separated Git reader. |
dokimi/pyproject.toml |
Exempt the sibling import from dependency checks. |
dokimi/dokimi/subjects/evidence.py |
Update a helper reference in a comment. |
dokimi/dokimi/report/single_condition_report.py |
Consume shared report I/O helpers. |
dokimi/dokimi/report/model_compare.py |
Use public correction and finalization helpers. |
dokimi/dokimi/report/eval_report.py |
Delegate shared I/O to eval_io. |
dokimi/dokimi/report/eval_io.py |
House shared report readers and sidecar writing. |
dokimi/dokimi/eval/stats.py |
Publish six helpers and retain _wilson compatibility. |
dokimi/dokimi/eval/sign_flip.py |
Update a helper reference in a docstring. |
dokimi/dokimi/eval/interactions.py |
Use public statistics helpers. |
dokimi/dokimi/eval/binary_stats.py |
Use public rounding and Wilson helpers. |
dokimi/changelog.d/20261201_120000_napetrov_arch-r10-567.md |
Document the internal refactor. |
Review effort: Balanced
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 28 selected item(s). CI at Test notes (2)
Review details
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1527 +/- ##
==========================================
- Coverage 96.50% 96.47% -0.03%
==========================================
Files 534 535 +1
Lines 71550 71556 +6
Branches 12362 12362
==========================================
- Hits 69046 69037 -9
- Misses 1530 1538 +8
- Partials 974 981 +7
🚀 New features to boost your workflow:
|
Mutation of changed linesAt 3d60d2d: 55 caught · 12 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 the whole picture:
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.
@napetrov, could you fix the small thing I've marked fix before merge (in the line comments)? I'll approve once that's done.
Optional, non-blocking (1)
dokimi/dokimi/report/eval_report.py:482: A question set where one record has"difficulty": nulland another has"difficulty": "easy"stops the eval report with aTypeErrorin the Q&A table: the sort at this line comparesNonewith a string (main has it too).
What I checked on b567fa3:
- When I changed the code on purpose, the tests still passed for 3 of 12 changes, and no test pins these down yet (non-blocking):
dokimi/dokimi/report/eval_io.py:21(it returns None),dokimi/dokimi/report/eval_io.py:34(the handled error is raised again) anddokimi/dokimi/report/eval_io.py:50(the handled error is raised again). - The 270 changed tests pass, and fail on main as expected.
- The full test suite passes with main merged in (37,849 tests), apart from failures main has too.
- It merges cleanly onto main.
…EPATH Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟢 LGTM · checked 1cbdcf3 · nothing required from @napetrov
🔀 Merge: safe now · merges cleanly into current main, 1 commit behind (no shared files) · after it, #1406 and #1523 need a rebase (report/eval_report.py, report/single_condition_report.py)
✅ make ci-local --offline: 33,319 passed · ResourceWarning; not from this PR · ✅ each new test fails with its fix reverted
The moves into eval_io.py and the renames in stats.py are exact; report output is unchanged.
Agreed with @vchamarthi on the untested 0.05 boundary (now pinned below); the difficulty: null sort crash is on main too, so it goes to a separate issue.
Fixed in this branch, up to 1cbdcf3:
- The check scripts failed under
PYTHONSAFEPATH=1: 74f1d83 puts their own directory onsys.path, ascheck_duplicates.pydoes; a test per script. - The shared-answers-path test called one function twice: 8ea9626 checks both reports use
eval_io's. - An adjusted p of exactly 0.05 was untested: 1cbdcf3 pins it as not significant.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g86-f3wf: already fixed in 1cbdcf3 Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
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> # Conflicts: # dokimi/dokimi/report/eval_report.py # dokimi/dokimi/report/single_condition_report.py
Summary
Also: the duplicate baseline entry
d3dc645dd2ccis removed (stale), and deptry's DEP001 list gains_git_z.Evidence
-zreader; helpers with underscore names used across modules.After: one reader, public helper names, same outputs.
ruff check ., deptry, mypy: clean.PytestUnraisableExceptionWarning(ScandirIterator) under--randomly-seed=19; the exact replay passed (220 passed). Treated as a flake, not a change in behaviour.Merge Danger
Door: two-way (internal refactor, revert is a plain revert)
Blast Radius: internal helpers only; no output, CLI, or file-format change. Changelog fragment is
### Changed, labelledskip-changelog.Reviewer note:
_wilsonalias ineval/stats.pymust go when #1416 lands.🤖 Generated with Claude Code