Repository navigation
refactor(report): render the arms report one section helper per block - #1568
Conversation
render_arms_report was one 147-line body (cyclomatic 32) for the header, summary, cost, agentic, skill-selection and per-question blocks. Each block is now a _section_<name> helper and render_arms_report joins them in the same order. The agentic fallback that rebuilds stats from answers moves to _agentic_from_answers and runs only when agentic_usage_summary is empty, as before. The Markdown is unchanged: a differential probe over 55,000 seeded artifacts (including malformed top-level fields) matches the previous output, the exception type and message, and the input dict after the call. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
render_arms_report has no branches after the section split, so the growth ratchet reports its baseline entry as back under the cap and tests/test_growth_ratchet fails on the PR. check_growth.py --update removes the entry; it is the only line that changes. Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the arms-report section-helper refactor.
No open issues 🎉
What changed in this PR
0 new findings; nothing to fix.
Refactors arms-report rendering into section helpers while preserving the public signature, section order, and Markdown output.
Changes:
- Extracts six section helpers and the older-artifact agentic fallback.
- Removes the renderer’s complexity-baseline entry.
- Adds a changelog fragment documenting the internal refactor.
| File | Description |
|---|---|
dokimi/scripts/growth_baseline.json |
Removes the renderer’s complexity exception. |
dokimi/dokimi/report/arms_report.py |
Splits rendering into focused section helpers. |
dokimi/changelog.d/20261202_130000_arms-report-sections.md |
Documents the refactor and unchanged output. |
Review effort: Balanced
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 3 selected item(s). CI at `02c900c`: 2 cancelled, 19 passing, 4 skipped
Test notes (2)
Review details
|
Mutation of changed linesAt 02c900c: 69 caught · 11 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. |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1568 +/- ##
==========================================
- Coverage 96.53% 96.52% -0.02%
==========================================
Files 550 550
Lines 73183 73188 +5
Branches 12623 12622 -1
==========================================
- Hits 70645 70642 -3
- Misses 1553 1557 +4
- Partials 985 989 +4
🚀 New features to boost your workflow:
|
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
🟢 LGTM · checked b514e8c · nothing required from @napetrov
🔀 Merge: safe now · merges cleanly into current main, 5 commits behind; the arms report and growth ratchet tests pass on the merge · after it, #1573 needs a rebase (report/arms_report.py, growth_baseline.json), and #1525 and #1558 need one for growth_baseline.json
✅ make ci-local --offline: 34,218 passed, 1 failed (test_cli_fault_contract[eval score ragas], {})
The split keeps the section order, the old-artifact agentic fallback and the output byte for byte.
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com> # Conflicts: # dokimi/scripts/growth_baseline.json
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com> # Conflicts: # dokimi/dokimi/report/arms_report.py
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
antonwolfy
left a comment
There was a problem hiding this comment.
The refactor itself holds up, but the merge waits on one red GitHub check. CodeQL (python) fails at this head and passes on main. I could not reproduce it on this Python: it needs CodeQL's own tooling, and the log quoted in the PR says it failed while extracting the downloaded CLI bundle, before any analysis. The PR changes no workflow. A re-run should settle it.
What I ran, on a Linux review host at 0a14d28:
make ci-local: 37 passed, 1 failed, 16 skipped. 34,907 tests passed, 1 failed.- The one failure is
test_no_file_or_function_grew_past_its_baseline:dokimi/repos/manifest.py(807 lines) anddokimi/repos/workspace.py(803 lines) are over the 800 cap. This PR touches neither file, and its only baseline edit removes therender_arms_reportcomplexity entry. The failure is not the PR's. - Read the diff of
arms_report.pyagainst the base, block by block.
Checked, no issues
- Order and fallback:
render_arms_reportjoins header, summary, cost, agentic, selection and per-question in the old order._agentic_from_answersruns only whenagentic_usage_summaryis falsy, as before, and it still readsanswersafter the cost block, so the order of any raised error is unchanged. - Baseline entry: removing
render_arms_reportfromgrowth_baseline.jsonis right; its complexity is now 1. - Changelog and DCO: the fragment is present and
skip-changelogis set. Both non-merge commits carrySigned-off-by.
|
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
refactor(report): render the arms report one section helper per block
Problem
render_arms_report(dokimi/report/arms_report.py) was one 147-line function(cyclomatic complexity 32) that wrote the header, summary, cost, agentic,
skill-selection and per-question blocks in one body. Hard to read and hard to
change one block without touching the others.
Change
_section_header,_section_summary,_section_cost,_section_agentic,_section_selection,_section_per_question.render_arms_reportjoins them in the same order._agentic_from_answers. It still runs only whenagentic_usage_summaryisempty, so an older artifact renders as before.
skip-changeloglabel because no output changes.Evidence
seeded artifacts, half with malformed top-level fields. Old and new output,
exception type and message, and the input dict after the call are compared.
0 mismatches; every executable line of the new body ran.
pyteston the arms, ask, report, skill-selection and records tests: 380 passed.ruff checkandmypyclean on the module.Merge danger
dokimi/scripts/growth_baseline.json: this PR removes therender_arms_reportentry (its complexity is now 1). PR fix(report): escape pipes and line breaks in generator table cells #1558 also edits that file, removing theReportGenerator._format_markdownentry two lines below. The two hunks are adjacent, so whichever lands second needs a one-line conflict resolution: keep both deletions.render_arms_reportkeeps its signature and output.🤖 Generated with Claude Code