feat: name the commit in each finding, print the fix, add warn status - #278
Conversation
Item 10 (SHA and Fix). The tree and the tables said "Commit 2/3" with no way to tell which commit that was; a reviewer had to count commits on the PR. `git log` now runs with `%H%x00%B%x00`, `parse_commit_messages` returns `(sha, message)` pairs, and `ScopeResult` gains `sha`. The `label` stays "Commit 2/3" so the `result` output is stable for downstream steps; the hash is appended where a person reads it (`display_label`: "Commit 2/3 (5584f46)") and the summary table's Scope cell links to the commit on `GITHUB_SERVER_URL`/`GITHUB_REPOSITORY`. The non-PR "Commit message" scope carries `git rev-parse HEAD`. The CLI has shipped `fix` (the corrected text) since 2.15 and the action already forwarded it in `result`, but never rendered it; the tree now prints `Fix:` after `Suggest:`, one row per line for a multi-line fix (CC012 sign-off). When the CLI's `suggest` is just `Use "<fix>"` only `Fix:` is printed, so the same text is not shown twice in a row. Item 9 (annotation detail). The `::error` annotation carried only the scope label and the error's first line, so on the Files changed tab the reader saw "Subject must start with a capital letter" and nothing to act on. The value, suggestion and fix are now appended as `%0A`-separated lines, produced by the same `_finding_lines` helper the tree uses, so the two surfaces cannot drift. Item 11 (`warn` status). `overall_status` collapsed a warn-only run into "pass", although every human surface already said "1 warning". It now returns "warn" (fail > all-skip > warn > pass); `exit_code_for` is unchanged, so only "fail" is ever non-zero. README lists the four values and adds the missing `fix` field. Item 12 (untitled annotation). `log_error_and_exit` printed `::error::commit-check found N failures.` after the per-finding annotations, so GitHub counted one error more than there were findings and listed an untitled entry that only restated the titled ones. The failure verdict is now a plain `✖ commit-check: 2 of 5 checks failed` line next to the existing `✔`/dry-run verdicts, counted by `_check_counts` so the step log, summary and comment agree. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018xYa7m3qup5wyN5MaXFgf6
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe action now preserves commit SHAs through validation, displays short hashes and commit links, renders detailed findings and fixes, distinguishes warning results, and serializes expanded scope data. Documentation and tests cover the updated output and status behavior. ChangesCommit-aware results and reporting
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to Commit-aware reporting, warning statuses, fixes, annotations, and structured outputs are consistently implemented and documented, with no identified merge-blocking impact. Sequence Diagram(s)sequenceDiagram
participant Git
participant CommitChecks
participant ScopeResult
participant Reporter
participant ActionOutput
Git->>CommitChecks: Read commit SHA and message
CommitChecks->>ScopeResult: Store checks and SHA
ScopeResult->>Reporter: Render findings and commit label
Reporter->>ActionOutput: Emit annotations, report, and result JSON
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 53.85% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 91 functions across 2 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 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 |
Commit Check✅ All 5 checks passed Show all 5 checkscommit-check 2.17.0 · Rules reference |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #278 +/- ##
==========================================
+ Coverage 94.48% 94.86% +0.37%
==========================================
Files 1 1
Lines 544 584 +40
==========================================
+ Hits 514 554 +40
Misses 30 30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What
Four changes to what the Action shows and outputs. "Before" lines are from real runs of
main.pyonmainunder a fakedpull_requestevent; "after" lines are the same runs on this branch (CLI 2.17.0, commitswip stuff,feat: add login page,fix: Handle timeout).Each finding names its commit, with a link
git lognow emits%H%x00%B%x00, so every message scope carries its commit's hash. The label staysCommit 2/3in theresultoutput (downstream matching keeps working) and a newshafield carries the full hash; where a person reads it the short hash is appended, and the summary table's Scope cell links to the commit (GITHUB_SERVER_URLis honoured, so it is right on GitHub Enterprise Server too; noGITHUB_REPOSITORY, no link). The tree cannot carry a link because it is a fenced code block. The non-PRCommit messagescope carriesgit rev-parse HEAD.Fix:in the tree and in the annotationsThe CLI has returned
fix(the corrected text) since 2.17 and the Action already forwarded it inresult, but nothing rendered it. A new_finding_lineshelper is the single source of thevalue:/Suggest:/Fix:rows for both the tree and the annotation payload, so the two cannot drift. When the CLI'ssuggestis exactlyUse "<fix>", onlyFix:is printed; bespoke suggestions (CC010, CC201) still print both. A multi-line fix (CC012 sign-off) takes one row per line.Annotations, before and after:
GitHub renders
%0Aas line breaks, so the annotation on the Files changed tab is enough to act on without opening the step log.result.statusgainswarnoverall_statusreduces fail > all-skip > warn > pass. A run whose only findings are warned rules now reportsstatus: warninstead ofpass; the exit code is unchanged (exit_code_forstill only fails onfail). Downstream:No more untitled
::error::annotationlog_error_and_exitprinted::error::commit-check found 2 failures.after the per-finding annotations, so GitHub counted one error more than there were findings. It is replaced by a plain verdict line in the same voice as the passing and dry-run ones,✖ commit-check: 2 of 5 checks failed(plus, 1 warningwhen applicable), computed by the same_check_countsas the Markdown verdict so the surfaces agree. Under dry-run the output is unchanged.Docs: the spec comment block in
main.py, README (resultsection now lists the four statuses and thefix/shafields, examples show the SHA, link,Fix:and annotation shape) andaction.yml's output description.Compatibility
result.scopes[].labelunchanged;shaandfixare additive.result.statushas one new value,warn, only for runs that previously reportedpasswhile carrying warnings. Consumers checking== 'fail'are unaffected.Testing
log_error_and_exitsignature andoverall_status; new tests cover the(sha, message)parser incl. blank-message alignment,head_shasuccess/128/OSError,display_label, the linked table with and withoutGITHUB_REPOSITORY, GHES server URL, non-commit scopes never linked, Fix/Suggest dedupe, bespoke suggest + fix, multi-line CC012 fix in tree and%0Aannotation, the verdict line (exactly one::errorper finding, no untitled one), verdict with warnings, dry-run without✖,warnoverall status with exit 0 and inGITHUB_OUTPUT,sha/fixinresult.main.py95% overall; the uncovered lines are pre-existing API/exception paths).pre-commit run --all-filesclean (black, mypy, codespell, …).pull_requestevent against a scratch repo: failure, warn-only, dry-run and non-PR push runs; annotations, step summary andGITHUB_OUTPUTmatch the excerpts above (3::errorannotations for 3 findings,result.status: warnon the warn-only run).🤖 Generated with Claude Code
https://claude.ai/code/session_018xYa7m3qup5wyN5MaXFgf6
Generated by Claude Code
Summary by CodeRabbit
New Features
Documentation