feat: markdown-formatted review summaries with per-finding list items#97
Conversation
📝 WalkthroughWalkthroughThis PR refactors the finding summarizer to enforce stricter Markdown formatting rules and reorganize how individual findings are rendered. The AI instruction rules are tightened to require severity headings with counts, one-per-bullet formatting, backticked file paths, and fenced code blocks. A new ChangesFinding Summarization Markdown Formatting
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…t items Replace semicolon-joined one-liner format in bare array fallback with proper markdown: ## headings per severity group, bullet list with one finding per line, backtick-wrapped file paths, fenced code blocks for snippets, and italic suggestions. Update AI summarization prompts to explicitly instruct markdown formatting with one-finding-per-bullet structure, matching the natural output format of gemini-3.5-flash. Signed-off-by: Wayne Sun <gsun@redhat.com>
042d517 to
9a4d6f7
Compare
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/cicaddy/delegation/summarizer.py (1)
500-523:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUnknown severities can disappear from the generated summary.
Line 500 groups any severity value, but Lines 508-517 only render
critical|major|minor|nit. If a finding has an unexpected severity, it is counted in the intro total but omitted from all bullet sections.Proposed fix
- for f in findings: - sev = str(f.get("severity", "minor")).lower() + for f in findings: + sev = str(f.get("severity", "minor")).lower() + if sev not in {"critical", "major", "minor", "nit"}: + sev = "minor" msg = f.get("message", "") if msg: severity_groups.setdefault(sev, []).append(f)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/cicaddy/delegation/summarizer.py` around lines 500 - 523, The summary currently collects all findings into severity_groups but only renders sections for ("critical","major","minor","nit"), causing unknown severities to be counted in total but not displayed; update the rendering logic in summarizer.py so after building severity_groups you compute an ordered list that first includes the known severities and then any remaining keys (e.g. remaining = sorted(k for k in severity_groups.keys() if k not in known)), then iterate that combined list to append sections using _format_finding_md for each entry; ensure you still compute total from severity_groups and include unknown severity names (or a generic "Other" if you prefer) in the section headers so no findings are omitted.
🧹 Nitpick comments (1)
src/cicaddy/delegation/summarizer.py (1)
126-127: ⚡ Quick winUse a Google-style docstring for the new helper.
Please update this new function docstring to Google style (Args/Returns) to match repository standards for
src/**/*.py.As per coding guidelines, "Use type hints and Google-style docstrings in Python code".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/cicaddy/delegation/summarizer.py` around lines 126 - 127, Update the docstring for the helper function _format_finding_md to use Google-style formatting: start with a one-line summary, then an Args section documenting entry (dict) and its expected contents, and a Returns section describing the returned str (markdown bullet body). Ensure type hints match (entry: dict) and keep the description concise to match repository standards.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/cicaddy/delegation/summarizer.py`:
- Around line 500-523: The summary currently collects all findings into
severity_groups but only renders sections for
("critical","major","minor","nit"), causing unknown severities to be counted in
total but not displayed; update the rendering logic in summarizer.py so after
building severity_groups you compute an ordered list that first includes the
known severities and then any remaining keys (e.g. remaining = sorted(k for k in
severity_groups.keys() if k not in known)), then iterate that combined list to
append sections using _format_finding_md for each entry; ensure you still
compute total from severity_groups and include unknown severity names (or a
generic "Other" if you prefer) in the section headers so no findings are
omitted.
---
Nitpick comments:
In `@src/cicaddy/delegation/summarizer.py`:
- Around line 126-127: Update the docstring for the helper function
_format_finding_md to use Google-style formatting: start with a one-line
summary, then an Args section documenting entry (dict) and its expected
contents, and a Returns section describing the returned str (markdown bullet
body). Ensure type hints match (entry: dict) and keep the description concise to
match repository standards.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b86df22a-ba37-4148-a4d8-4c5c498f3cf9
📒 Files selected for processing (2)
src/cicaddy/delegation/summarizer.pytests/unit/test_delegation_summarizer.py



Summary
_unpack_bare_arraywith markdown list items (##severity headings,-bullets per finding, fenced code blocks for snippets)_SUMMARY_RULES,_RESPONSE_FORMAT) to guide models toward markdown formatting — matches what gemini-3.5-flash naturally produces_format_finding_mdhelper for consistent per-finding formatting across fallback and AI pathsTest plan