Skip to content

refactor(report): split generate_report and render_task_runs_report into section helpers - #1403

Merged
napetrov merged 3 commits into
intel:mainfrom
napetrov:arch/r8-45
Nov 30, 2026
Merged

napetrov merged 3 commits into
intel:mainfrom
napetrov:arch/r8-45

Conversation

@napetrov

Copy link
Copy Markdown
Contributor

Summary

Pure extraction: each report section becomes a helper over a shared context. The top-level functions keep their signatures and call the sections in the same order.

report/eval_report.py
  generate_report(eval_path, out_path, qa_json_out)
    _report_context(eval_path)            # load, records, stats, valid pairs (once)
    _report_lines(ctx)
      _header_section / _legend_section / _summary_section
      _significance_section / _breakdown_section / _difficulty_section
      _diagnosis_section / _helped_section / _degradations_section
      _baseline_weak_section / _qa_static_section / _qa_dynamic_section
      _recommendations_section
    _qa_records(ctx, answers) -> sidecar JSON

report/task_runs_report.py
  render_task_runs_report(data)
    _run_context(data)
    _header_lines / _headline_section
    _aggregate_cells(rows)                # per (task, harness) cell
    _difficulty_section / _comparison_section / _discovery_lines
    _task_table_section / _cell_detail_section

Nested _val and _answer_text move to module level; the Top/Bottom 15 and the two Q&A tables each share one helper.

Evidence

  • Before: generate_report 310 lines, cyclomatic 51; render_task_runs_report 190 lines, cyclomatic 64.
    After: longest section helper is under 60 lines; both entry points are short sequencers.

  • Before / after, differential probe (old = pristine module, new = this branch, same inputs, report timestamp frozen; compares Markdown bytes, Q&A sidecar bytes, stdout, stderr, return value, and raised exception class and message):

    • eval: 151/151 cases identical (existing eval.v1 fixture + 150 random files, incl. stopped runs, NaN/overflow deltas, significance refusals)
    • task runs: 171/171 identical (existing task_runs.v1 fixture, the test module's own builders over their parameter grid, 150 random artifacts)
    • sensitivity: a copy with two one-line text changes is flagged on 33/41 eval and 55/61 task-run cases, so the probe is not vacuous.
  • Tests: pytest over every test file importing either module plus tests/test_report*.py: 1116 passed. make ci-local: static checks green; the only failures were two Ctrl-C timeouts in test_docker_cmd.py and test_repo_host.py under full-suite load, both pass when rerun alone.

Merge Danger

Door: two-way (pure refactor; revert restores the old bodies).

Blast Radius: report output only. Public names, signatures and the sidecar schema are unchanged. Ratchet baselines (scripts/growth_baseline.json, scripts/duplicates_baseline.json) are lowered to match the smaller functions.

Internal refactor, so the skip-changelog label is set; a short changelog.d fragment is included for the local pre-push hook.

🤖 Generated with Claude Code

…nto section helpers

Each report section is its own helper over a shared context; the top-level
functions keep their signatures and call the sections in the same order.
Output is byte-identical (checked by a differential probe over fixtures and
random inputs).

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov
napetrov requested a review from a team as a code owner November 29, 2026 05:25
@napetrov napetrov added the skip-changelog No user-visible change: bypasses the changelog fragment check label Nov 29, 2026
@exai-bot

exai-bot commented Nov 29, 2026 •

Copy link
Copy Markdown

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

CI at 3364aa6: 21 passing, 4 skipped.

Review details
  • Commit reviewed: 3364aa6 against merge base c8ee1b7
  • Coverage: 6 files in 2 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 103k tokens (35k from cache), 11s
  • Tool calls: 6 (4 file_read, 1 ci_status, 1 local_check_results)
  • Report section refactoring, formatting tests, and changelog: 4 files
  • Update code duplication and growth baselines: 2 files

@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 99.42197% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.27%. Comparing base (c8ee1b7) to head (3364aa6).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
dokimi/dokimi/report/eval_report.py 98.96% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1403      +/-   ##
==========================================
+ Coverage   96.25%   96.27%   +0.01%     
==========================================
  Files         512      513       +1     
  Lines       68234    68533     +299     
  Branches    11844    11882      +38     
==========================================
+ Hits        65680    65978     +298     
- Misses       1568     1570       +2     
+ Partials      986      985       -1     
Files with missing lines Coverage Δ
dokimi/dokimi/report/task_runs_report.py 94.14% <100.00%> (+0.64%) ⬆️
dokimi/dokimi/report/eval_report.py 95.62% <98.96%> (+0.70%) ⬆️

... and 26 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

80 mutants of the lines this PR changes, at 3364aa6: 66 killed, 14 survived, 0 waived, 0 inconclusive, 0 timed out, 0 errors, 0 not run.

The mutant cap left out 129 more mutants of covered changed lines.

A survivor is a change to that line that the tests covering it do not notice: add an assertion that fails on it or, if the change cannot alter behaviour, put # mutation-ok[<operator>]: <reason> at the end of the line or alone on the line above.

Line Operator Was Became Tests run
dokimi/dokimi/report/eval_report.py:285 flip-bool True False 12
dokimi/dokimi/report/eval_report.py:437 drop-element [ "## Breakdown: Dynamic vs Static", "| Set | Count | Context | ["## Breakdown: Dynamic vs Static", "| Set | Count | Context | Baseline | Delta 24
dokimi/dokimi/report/eval_report.py:456 drop-element [ "## Breakdown by Difficulty", "| Difficulty | Count | Context ["## Breakdown by Difficulty", "| Difficulty | Count | Context | Baseline | Delt 24
dokimi/dokimi/report/eval_report.py:479 drop-element [ "## Diagnosis", "| Diagnosis | Count | Rate |", "|---| ["## Diagnosis", "| Diagnosis | Count | Rate |"] 24
dokimi/dokimi/report/eval_report.py:488 swap-addsub r.all_stats["count"] - total_diag r.all_stats['count'] + total_diag 24
dokimi/dokimi/report/eval_report.py:490 delete-statement lines.append(f"| ⚪ Insufficient data | {missing} | {round(missing/r.all_stats['c pass 21
dokimi/dokimi/report/eval_report.py:518 drop-clause x.delta or 0 (0) 24
dokimi/dokimi/report/eval_report.py:530 drop-filter e.score(BASELINE) is not None True 24
dokimi/dokimi/report/eval_report.py:634 negate-condition dir_path not (dir_path) 24
dokimi/dokimi/report/eval_report.py:635 delete-statement os.makedirs(dir_path, exist_ok=True) pass 24
dokimi/dokimi/report/task_runs_report.py:172 flip-bool True False 8
dokimi/dokimi/report/task_runs_report.py:211 bump-int 1 2 41
dokimi/dokimi/report/task_runs_report.py:240 bump-int 0 1 41
dokimi/dokimi/report/task_runs_report.py:242 bump-int 0 1 41

Warn-only: a survivor does not fail the job yet. Updated on every push; the full report is in the ci run summary.

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

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

@vlad-perevezentsev vlad-perevezentsev 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.

🟢 LGTM · checked 3364aa6 · nothing required from @napetrov

🔀 Merge: safe now · merges cleanly into current main, 8 commits behind; growth and duplicate gates and the report tests pass on the merge · after it, #1406 needs a rebase (report/eval_report.py)

✅ make ci-local --offline: 30,977 passed, 100% of changed lines covered · ✅ old vs new output on 600 random task_runs artifacts and 600 random evals: identical Markdown, sidecar and stdout · ✅ changed-line mutants: 14 of 80 survive, down from 27

A clean split: both reports come out exactly as before, and the baselines shrink as they should.

Fixed in this branch, up to 3364aa6:

  • No test pinned the eval report's sections: 72d5c8e checks all 13 sections in order, the table rows and the sidecar's source.
  • The static check was written four times: 3364aa6 adds one _is_static for the split, the label and the sidecar.

@napetrov
napetrov merged commit 5395351 into intel:main Nov 30, 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.

4 participants