Orca-Code-Review/scripts/severity.test.mjs
Zhenghua Bao 01edbdf5c5
P3 severity + summary pinned to top of PR description (#4)
* feat(review-action): pin per-push summary to top of PR description

Move the per-push Orca-Code-Review summary out of a chronologically-buried
issue comment and into a marker-delimited region at the top of the PR
description body, the only element GitHub anchors at the top. A new pure
merge primitive (inject-summary.mjs) prepends the region on first push and
replaces it in place afterward, preserving author-written body text. The
driver reads the prior region back for the push counter and Δ column, and
best-effort deletes any legacy summary issue comment on migrated PRs.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>

* feat(review): add P3 severity, split style nits out of P2

Add a P3 level below P2 to mirror Codex. P2 is redefined as a
real-but-conditional bug (a genuine defect that fires only under a
precondition the code doesn't normally meet); P3 is a pure
style/maintainability nit with no behavioral defect. Both stay
non-blocking and are still posted. SEVERITIES flows the new level through
the gate, run report, and PR summary automatically.

This builds on the P1/P2 calibration + PRECISION rules from #2 (kept
intact); it only adds the P2/P3 split and the P2-vs-P3 boundary note.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>

* fix(review): handle P3 in Δ state, inline badge, and preserve author body

Address self-review findings on the P3 change:
- summary-comment.mjs stored only p0/p1/p2 in the state line, so on push 2+
  the P3 Δ column subtracted an undefined prev.p3 and rendered NaN. Store p3
  and treat a missing prev.p3 as 0 (back-compat with older state lines).
- action.yml's inline renderer used its own P[012] tag regex + a SEV map
  without P3, so a [P3] finding fell back to a P1 badge — the inline comment
  disagreed with the gate/summary. Recognize P3 (⚪) in the regex, badge map,
  and breakdown.
- inject-summary.mjs trimStart() stripped meaningful leading whitespace from
  the author's PR body on first injection; prepend the body verbatim instead.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>

* fix(review): complete P3 across dedup key and control-plane report

The dedup key stripped only [P0]-[P2] tags, so a re-tagged P3 finding
would not merge across exhaustive passes; the report payload omitted the
P3 count entirely. Both are gaps in the new P3 severity level.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 <noreply@anthropic.com>
2026-07-16 19:07:27 +08:00

61 lines
2.3 KiB