@jphutchins/code-review 0.1.0-alpha.65 → 0.1.0-alpha.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jphutchins/code-review",
3
- "version": "0.1.0-alpha.65",
3
+ "version": "0.1.0-alpha.66",
4
4
  "description": "Deterministic commenter for agentic PR review — gather, render, inline, post, adapt, extract, cost, validate, print-schema",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -47,22 +47,80 @@
47
47
  <% } -%>
48
48
 
49
49
  <%~ it.findings.summary %>
50
- <% const c = it.severityCounts %><% const findingsTotal = c.critical + c.major + c.minor + c.nit %>
51
- <% if (it.teachesResponses && (findingsTotal > 0 || it.systemic.length > 0)) { -%>
50
+ <% const c = it.severityCounts %><% const findingsTotal = c.critical + c.major + c.minor + c.nit -%>
51
+ <% if (it.strays.length > 0 || (!it.incomplete && (findingsTotal > 0 || it.systemic.length > 0 || it.contested.length > 0))) { -%>
52
52
 
53
- <sub><%~ it.responseTeaching %></sub>
53
+ ## <% if (it.strays.length === 0) { %>Findings<% } else if (it.inlineDisposition && (it.inlineDisposition.kind === 'disabled' || it.inlineDisposition.kind === 'whole-document')) { %>Findings<% } else if (it.inlineDisposition && it.inlineDisposition.kind === 'no-envelope') { %>Findings (no inline review — result envelope lost)<% } else { %><%= (it.unanchoredCount && it.unanchoredCount > 0) ? 'Findings' : 'Findings outside the diff' %><% } %>
54
+ <% if (it.strays.length > 0) { %>
55
+ <% if (it.inlineDisposition && it.inlineDisposition.kind === 'no-envelope') { %>
56
+ <% if (it.shedCount === 0) { %>
57
+ _Every finding is listed below — the inline review could not be built because the result envelope was missing._
58
+ <% } -%>
59
+ <% } else if (it.inlineDisposition && it.inlineDisposition.kind === 'whole-document') { %>
60
+ _Every finding from this run<% if (it.inlineDisposition.inlineCount > 0) { %>, including the <%= it.inlineDisposition.inlineCount %> posted as inline comment<%= it.inlineDisposition.inlineCount === 1 ? '' : 's' %> on the diff<% } %><% if (it.inlineDisposition.rejectedCount > 0) { %>; <%= it.inlineDisposition.rejectedCount %> could not be anchored (GitHub rejected the position)<% } %>._
61
+ <% } else if (it.unanchoredCount && it.unanchoredCount > 0) { %>
62
+ _<%= it.unanchoredCount %> finding<%= it.unanchoredCount === 1 ? '' : 's' %> below couldn't be posted as inline comment<%= it.unanchoredCount === 1 ? '' : 's' %> (GitHub rejected the position)<% if (it.strays.length > it.unanchoredCount) { %>; the rest are outside the diff<% } %>._
63
+ <% } %>
64
+ <% } %>
65
+ <% if (it.teachesResponses && (findingsTotal > 0 || it.systemic.length > 0 || it.contested.length > 0)) { -%>
66
+
67
+ <details><summary>How to answer these findings</summary>
68
+
69
+ <%~ it.responseTeaching %>
70
+ </details>
71
+ <% } -%>
72
+ <% if (!it.incomplete && it.contested.length > 0) { -%>
73
+
74
+ ### ⚖️ Contested
75
+
76
+ _The reviewer rebutted a maintainer's answer, and a maintainer answered again. Each stays in the score at a fixed weight, whether or not it is raised again, until a maintainer rules._
77
+ <% if (it.teachesResponses) { -%>
78
+
79
+ <%~ it.rulingTeaching %>
80
+ <% } -%>
81
+
82
+ <% it.contested.forEach(function(k) { -%>
83
+ #### <%= it.severityEmoji(k.severity) %> (<%= k.severity %>) <%= k.title %>
84
+ <sub><% if (k.reRaise && k.reRaise.location) { %>`<%~ k.reRaise.location %>` · <% } %>id `<%~ k.id %>` · [the maintainer's latest answer](<%~ k.answerUrl %>)</sub>
85
+ <% if (k.reRaise) { -%>
86
+
87
+ <%~ k.reRaise.description %>
88
+ <% if (k.reRaise.rebuttal) { -%>
89
+
90
+ **Rebuttal:** <%~ k.reRaise.rebuttal %>
91
+ <% } -%>
92
+
93
+ > <details><summary>Reasoning</summary>
94
+ >
95
+ <% k.reRaise.reasoning.split("\n").forEach(function(rl) { -%>
96
+ > <%= rl %>
97
+ <% }) -%>
98
+ >
99
+ > </details>
54
100
  <% } -%>
101
+ <% if (k.discussionHtml) { -%>
55
102
 
103
+ <details><summary>💬 Discussion</summary>
104
+
105
+ <%~ k.discussionHtml %>
106
+ </details>
107
+ <% } -%>
108
+ <% }) -%>
109
+ <% } -%>
56
110
  <% if (!it.incomplete && it.systemic.length > 0) { -%>
57
111
 
58
- ## 🔗 Systemic problems
112
+ ### 🔗 Systemic problems
59
113
 
60
114
  <% it.systemic.forEach(function(s) { -%>
61
- ### <%= it.severityEmoji(s.severity) %> (<%= s.severity %>) <%= s.title %>
115
+ #### <%= it.severityEmoji(s.severity) %> (<%= s.severity %>) <%= s.title %>
62
116
  <sub>confidence <%= it.formatConfidence(s.confidence) %><% if (s.id) { %> · id <% if (s.code_url) { %>[`<%~ s.id %>`](<%~ s.code_url %>)<% } else { %>`<%~ s.id %>`<% } %><% } %></sub>
63
117
  <% const meta = [] %><% if (s.paths && s.paths.length > 0) { meta.push('Affects: ' + s.paths.map(function(p) { return '`' + p + '`' }).join(', ')) } %><% if (s.finding_ids && s.finding_ids.length > 0) { meta.push('Ties together: ' + s.finding_ids.map(function(c) { return '`' + c + '`' }).join(', ')) } %><% if (meta.length > 0) { %>_<%~ meta.join(' · ') %>_<% } %>
64
118
 
65
119
  <%~ s.description %>
120
+ <% if (s.answeredNote) { -%>
121
+
122
+ > ↩️ <%~ s.answeredNote %>
123
+ <% } -%>
66
124
  <% if (it.hasRebuttal(s)) { -%>
67
125
 
68
126
  **Rebuttal:** <%~ s.rebuttal %>
@@ -84,6 +142,7 @@
84
142
  > </details>
85
143
  <% }) -%>
86
144
  <% } -%>
145
+ <% } -%>
87
146
 
88
147
  ---
89
148
 
@@ -99,7 +158,10 @@
99
158
  <% if (findingsTotal > 0) { %>
100
159
  <% const parts = [] %><% if (c.critical) { parts.push(it.severityEmoji('critical') + ' ' + c.critical) } %><% if (c.major) { parts.push(it.severityEmoji('major') + ' ' + c.major) } %><% if (c.minor) { parts.push(it.severityEmoji('minor') + ' ' + c.minor) } %><% if (c.nit) { parts.push(it.severityEmoji('nit') + ' ' + c.nit) } %>
101
160
  **Findings:** <%~ parts.join(' · ') %>
102
- <% } else if (!it.incomplete && it.systemic.length === 0 && !it.answeredReRaiseNote) { %>
161
+ <% } else if (!it.incomplete && (it.systemic.length > 0 || it.contested.length > 0)) { %>
162
+ <% const held = [] %><% if (it.contested.length > 0) { held.push(it.contested.length + ' contested item' + (it.contested.length === 1 ? '' : 's')) } %><% if (it.systemic.length > 0) { held.push(it.systemic.length + ' systemic problem' + (it.systemic.length === 1 ? '' : 's')) } %>
163
+ _No findings beyond the <%= held.join(' and ') %> above._
164
+ <% } else if (!it.incomplete && !it.answeredReRaiseNote) { %>
103
165
  <% if (it.unverifiedNoLogs) { %>_No findings — but no failing-job logs were staged, so this pass could not read the CI failure. "No findings" is not evidence of none._<% } else { %>_No findings — clean review._<% } %>
104
166
  <% } %>
105
167
 
@@ -118,16 +180,6 @@
118
180
  <% } %>
119
181
 
120
182
  <% if (it.strays.length > 0) { %>
121
- ## <% if (it.inlineDisposition && (it.inlineDisposition.kind === 'disabled' || it.inlineDisposition.kind === 'whole-document')) { %>Findings<% } else if (it.inlineDisposition && it.inlineDisposition.kind === 'no-envelope') { %>Findings (no inline review — result envelope lost)<% } else { %><%= (it.unanchoredCount && it.unanchoredCount > 0) ? 'Findings' : 'Findings outside the diff' %><% } %>
122
- <% if (it.inlineDisposition && it.inlineDisposition.kind === 'no-envelope') { %>
123
- <% if (it.shedCount === 0) { %>
124
- _Every finding is listed below — the inline review could not be built because the result envelope was missing._
125
- <% } -%>
126
- <% } else if (it.inlineDisposition && it.inlineDisposition.kind === 'whole-document') { %>
127
- _Every finding from this run<% if (it.inlineDisposition.inlineCount > 0) { %>, including the <%= it.inlineDisposition.inlineCount %> posted as inline comment<%= it.inlineDisposition.inlineCount === 1 ? '' : 's' %> on the diff<% } %><% if (it.inlineDisposition.rejectedCount > 0) { %>; <%= it.inlineDisposition.rejectedCount %> could not be anchored (GitHub rejected the position)<% } %>._
128
- <% } else if (it.unanchoredCount && it.unanchoredCount > 0) { %>
129
- _<%= it.unanchoredCount %> finding<%= it.unanchoredCount === 1 ? '' : 's' %> below couldn't be posted as inline comment<%= it.unanchoredCount === 1 ? '' : 's' %> (GitHub rejected the position)<% if (it.strays.length > it.unanchoredCount) { %>; the rest are outside the diff<% } %>._
130
- <% } %>
131
183
 
132
184
  <% it.strays.forEach(function(f) { -%>
133
185
  ### <%= it.severityEmoji(f.severity) %> (<%= f.severity %>) `<%= f.path %>:<%= f.rangeLabel %><% if (f.side) { %> (<%= f.side %>)<% } %>` — <%= f.title %>