opencode-azure-devops-pr-review 0.4.6 → 0.5.0
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/CHANGELOG.md +161 -0
- package/README.md +514 -217
- package/package.json +2 -2
- package/src/attribution.mjs +165 -97
- package/src/comment-work.mjs +10 -5
- package/src/comments.mjs +124 -39
- package/src/config.mjs +159 -72
- package/src/host.mjs +1 -1
- package/src/output.mjs +89 -320
- package/src/prompts/comment-plan.md +5 -5
- package/src/prompts/comment-policy.md +4 -4
- package/src/prompts/common.md +2 -13
- package/src/prompts/dedupe.md +19 -11
- package/src/prompts/rating.md +4 -4
- package/src/prompts/{quick.md → review.md} +19 -6
- package/src/review-work.mjs +434 -426
- package/src/runtime.mjs +137 -85
- package/src/session.mjs +3 -2
- package/src/setup.mjs +253 -54
- package/src/tui-setup.mjs +87 -12
- package/src/prompts/final.md +0 -64
- package/src/prompts/functional.md +0 -34
- package/src/prompts/risk.md +0 -36
package/src/output.mjs
CHANGED
|
@@ -4,13 +4,10 @@
|
|
|
4
4
|
* Parsing is strict JSON: the whole answer, one ```json fence or one embedded
|
|
5
5
|
* object. Anything else is reported as a concrete problem that the runtime
|
|
6
6
|
* sends back to the same session as a repair turn. After the configured repair
|
|
7
|
-
* attempts, acceptance degrades per item instead of discarding the review:
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* A verifier decision row is judged by its own fields, not only by the list it
|
|
12
|
-
* was placed in, and a confirmation that moves its finding to another file
|
|
13
|
-
* must say so (`movedFrom`); the runtime then records the candidate's location.
|
|
7
|
+
* attempts, acceptance degrades per item instead of discarding the review: a
|
|
8
|
+
* finding that still lacks a field or a checkable location becomes NEEDS_INFO,
|
|
9
|
+
* a merge or a rating that cannot be used is left out, and every other result
|
|
10
|
+
* stays usable.
|
|
14
11
|
*/
|
|
15
12
|
import { parsePullRequestUrl } from './azure.mjs';
|
|
16
13
|
|
|
@@ -21,8 +18,6 @@ export const canonicalKey = key => String(key).trim().replace(/[_\s-]/g, '').toL
|
|
|
21
18
|
const canonicalEnum = value => typeof value === 'string' ? value.trim().toUpperCase().replace(/[\s-]+/g, '_') : '';
|
|
22
19
|
const SEVERITIES = ['high', 'medium', 'low'];
|
|
23
20
|
export const FINDING_FIELDS = Object.freeze(['id', 'summary', 'evidence', 'counterevidence', 'location', 'severity', 'suggestion']);
|
|
24
|
-
const DECISIONS = ['CONFIRMED', 'MERGED', 'REJECTED', 'NEEDS_INFO'];
|
|
25
|
-
const DECISION_FIELDS = [...FINDING_FIELDS, 'status', 'reason', 'mergedInto', 'verifiedFinding', 'movedFrom'];
|
|
26
21
|
const MAX_LISTED_ISSUES = 25;
|
|
27
22
|
|
|
28
23
|
/** Path part of a location such as "head:/src/a.ts:12-14"; '' when there is none. */
|
|
@@ -191,13 +186,16 @@ function aliasFields(value, names, warnings) {
|
|
|
191
186
|
const name = aliases.get(canonicalKey(key));
|
|
192
187
|
if (name) counts.set(name, (counts.get(name) ?? 0) + 1);
|
|
193
188
|
}
|
|
189
|
+
// Own data properties only, also for a key such as __proto__, which an assignment would take as the object's
|
|
190
|
+
// prototype: what is checked must be what is kept.
|
|
194
191
|
const result = {};
|
|
192
|
+
const put = (key, content) => Object.defineProperty(result, key, { value: content, enumerable: true, writable: true, configurable: true });
|
|
195
193
|
for (const [key, content] of Object.entries(value)) {
|
|
196
194
|
const name = aliases.get(canonicalKey(key));
|
|
197
195
|
if (name && counts.get(name) > 1) {
|
|
198
196
|
warnings.add('Conflicting field spellings were kept as written.');
|
|
199
|
-
|
|
200
|
-
} else
|
|
197
|
+
put(key, content);
|
|
198
|
+
} else put(name ?? key, content);
|
|
201
199
|
}
|
|
202
200
|
return result;
|
|
203
201
|
}
|
|
@@ -214,24 +212,20 @@ function rows(value, warnings, label) {
|
|
|
214
212
|
|
|
215
213
|
function normalizeFinding(value, warnings) {
|
|
216
214
|
const row = isObject(value) ? aliasFields(value, FINDING_FIELDS, warnings) : { summary: asText(value) };
|
|
217
|
-
for (const key of FINDING_FIELDS)
|
|
215
|
+
for (const key of FINDING_FIELDS) {
|
|
216
|
+
if (!Object.hasOwn(row, key)) continue;
|
|
217
|
+
// A field is text or it is missing: false, a list or an object written where text goes is no text, however it
|
|
218
|
+
// would read once turned into one, so the finding names that field as missing for its correction turn.
|
|
219
|
+
if (key !== 'id' && typeof row[key] !== 'string') { row[key] = ''; warnings.add('A finding field that was not text was left out; the correction turn names it.'); continue; }
|
|
220
|
+
row[key] = asText(row[key]).trim();
|
|
221
|
+
}
|
|
218
222
|
if (typeof row.severity === 'string') row.severity = row.severity.toLowerCase();
|
|
219
223
|
return row;
|
|
220
224
|
}
|
|
221
225
|
|
|
222
|
-
/**
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
* itself. This is a check of form on a few fixed spellings: the runtime does not
|
|
226
|
-
* judge whether the defect is real, it asks the verifier which of the two it means.
|
|
227
|
-
*/
|
|
228
|
-
const NO_CORRECTION = /^[\s\p{P}\p{S}]*(?:n[\s.\/]*a|none|nothing|not applicable|no (?:changes?|corrections?|fix(?:es)?|action)(?: (?:is|are))? (?:needed|required|necessary)|無|无|不適用|不适用|(?:不需要|無需|无需|不需)(?:修正|修改))?[\s\p{P}\p{S}]*$/iu;
|
|
229
|
-
// Placeholders are short; the bound also keeps the match linear on long text.
|
|
230
|
-
export const givesNoCorrection = suggestion => text(suggestion) && suggestion.trim().length <= 60 && NO_CORRECTION.test(suggestion.trim());
|
|
231
|
-
|
|
232
|
-
/** Problems that make a finding unusable, phrased for a repair request. */
|
|
233
|
-
function findingProblems(row, { requireLocation }) {
|
|
234
|
-
const missing = FINDING_FIELDS.filter(key => key !== 'id' && (key !== 'location' || requireLocation) && !text(row[key]));
|
|
226
|
+
/** Problems that make a finding unusable, phrased for a repair request. Every field but the ID is needed, the location included. */
|
|
227
|
+
function findingProblems(row) {
|
|
228
|
+
const missing = FINDING_FIELDS.filter(key => key !== 'id' && !text(row[key]));
|
|
235
229
|
const problems = [];
|
|
236
230
|
if (missing.length) problems.push(`missing ${missing.join(', ')}`);
|
|
237
231
|
if (text(row.severity) && !SEVERITIES.includes(row.severity)) problems.push('severity must be high, medium or low');
|
|
@@ -241,6 +235,8 @@ function findingProblems(row, { requireLocation }) {
|
|
|
241
235
|
/** Give missing, malformed or repeated IDs stable runtime IDs. */
|
|
242
236
|
export function assignIds(findings, prefix, warnings) {
|
|
243
237
|
const pattern = new RegExp(`^${prefix}-[1-9][0-9]*$`);
|
|
238
|
+
// Whether the parser gave an ID is its own mark: one an answer wrote is no mark.
|
|
239
|
+
for (const row of findings) if (isObject(row)) delete row.generatedId;
|
|
244
240
|
const reserved = new Set(findings.map(row => row.id).filter(id => typeof id === 'string' && pattern.test(id)));
|
|
245
241
|
const used = new Set();
|
|
246
242
|
let next = 1;
|
|
@@ -249,6 +245,8 @@ export function assignIds(findings, prefix, warnings) {
|
|
|
249
245
|
if (text(row.id)) row.originalId = row.id;
|
|
250
246
|
while (reserved.has(`${prefix}-${next}`)) next++;
|
|
251
247
|
row.id = `${prefix}-${next++}`;
|
|
248
|
+
// An ID the answer did not write: nothing in its text can mean it.
|
|
249
|
+
row.generatedId = true;
|
|
252
250
|
reserved.add(row.id);
|
|
253
251
|
warnings.add('Runtime IDs replaced missing, malformed or repeated finding IDs.');
|
|
254
252
|
}
|
|
@@ -260,15 +258,15 @@ const listIssues = issues => issues.slice(0, MAX_LISTED_ISSUES).map(issue => `-
|
|
|
260
258
|
(issues.length > MAX_LISTED_ISSUES ? `\n- ... and ${issues.length - MAX_LISTED_ISSUES} more` : '');
|
|
261
259
|
|
|
262
260
|
/**
|
|
263
|
-
* Accept one
|
|
261
|
+
* Accept one reviewer answer for an assigned set of files.
|
|
264
262
|
* Always returns a usable result; `issues` lists what a repair turn should fix.
|
|
265
263
|
* `invalid` maps finding IDs to the field problems that make them unusable (a
|
|
266
264
|
* plain object, so stage records keep it), and
|
|
267
265
|
* `envelope` says whether `findings` was an array and `coverage` an object: a
|
|
268
266
|
* parsed answer is not necessarily a usable review.
|
|
269
|
-
* @param {{prefix: string, assigned?: string[], inventory?: string[], filesComplete?: boolean
|
|
267
|
+
* @param {{prefix: string, assigned?: string[], inventory?: string[], filesComplete?: boolean}} options
|
|
270
268
|
*/
|
|
271
|
-
export function evaluateInitial(answerText, { prefix, assigned = [], inventory = [], filesComplete = true
|
|
269
|
+
export function evaluateInitial(answerText, { prefix, assigned = [], inventory = [], filesComplete = true }) {
|
|
272
270
|
const warnings = new Set();
|
|
273
271
|
const parsed = parseModelJSON(answerText, { keys: ['status', 'findings', 'coverage', 'report'] });
|
|
274
272
|
if (!parsed.value) {
|
|
@@ -276,7 +274,7 @@ export function evaluateInitial(answerText, { prefix, assigned = [], inventory =
|
|
|
276
274
|
return {
|
|
277
275
|
issues: [`Your answer could not be used: ${parsed.problem}.`],
|
|
278
276
|
result: { status: 'PARTIAL', structured: false, coverage: { files: [], gaps: ['The reviewer answer was not structured JSON.'] },
|
|
279
|
-
additionalFiles: [], findings: [], report, warnings: ['The
|
|
277
|
+
additionalFiles: [], findings: [], report, warnings: ['The reviewer answer was not structured; its text is kept as it is.'],
|
|
280
278
|
invalid: {}, envelope: { findings: false, coverage: false } },
|
|
281
279
|
};
|
|
282
280
|
}
|
|
@@ -289,9 +287,11 @@ export function evaluateInitial(answerText, { prefix, assigned = [], inventory =
|
|
|
289
287
|
const envelope = { findings: Array.isArray(source.findings), coverage: isObject(source.coverage) };
|
|
290
288
|
if (!envelope.findings) issues.push('"findings" must be an array (use [] when there are none).');
|
|
291
289
|
if (!envelope.coverage) issues.push('"coverage" must be an object with "files" (reviewed paths) and "gaps".');
|
|
290
|
+
// A coverage without its list of files says nothing of what was reviewed: it is asked for (an empty list stands).
|
|
291
|
+
else if (!Array.isArray(coverage.files)) issues.push('"coverage.files" must list the assigned paths you reviewed (use [] for none).');
|
|
292
292
|
const findings = rows(source.findings, warnings, 'findings').map(row => normalizeFinding(row, warnings));
|
|
293
293
|
const problems = findings.map((row, index) => {
|
|
294
|
-
const found = findingProblems(row
|
|
294
|
+
const found = findingProblems(row);
|
|
295
295
|
if (found.length) issues.push(`findings[${index}]${text(row.id) ? ` (${row.id})` : ''}: ${found.join('; ')}.`);
|
|
296
296
|
return found;
|
|
297
297
|
});
|
|
@@ -302,7 +302,7 @@ export function evaluateInitial(answerText, { prefix, assigned = [], inventory =
|
|
|
302
302
|
.filter(path => text(path) && !/[\0\r\n]/.test(path)).map(path => path.startsWith('/') ? path : '/' + path))]
|
|
303
303
|
.filter(path => !known.has(path));
|
|
304
304
|
if (additionalFiles.length && filesComplete) {
|
|
305
|
-
warnings.add('The reviewer listed changed paths outside the complete inventory;
|
|
305
|
+
warnings.add('The reviewer listed changed paths outside the complete inventory; the report names them.');
|
|
306
306
|
}
|
|
307
307
|
const missingCoverage = assigned.filter(path => !covered.includes(path));
|
|
308
308
|
let status = canonicalEnum(source.status) === 'COMPLETE' ? 'COMPLETE' : 'PARTIAL';
|
|
@@ -320,268 +320,24 @@ export function evaluateInitial(answerText, { prefix, assigned = [], inventory =
|
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
-
const hasFindingContent = row => FINDING_FIELDS.some(key => key !== 'id' && text(asText(row[key])));
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* The decision a row states itself. An explicit valid `status` wins over the
|
|
327
|
-
* list the row was placed in, and a row under `confirmed` that names
|
|
328
|
-
* `mergedInto` but carries no finding is a merge: it cannot be a confirmation.
|
|
329
|
-
*/
|
|
330
|
-
function rowDecision(row, listed) {
|
|
331
|
-
const explicit = canonicalEnum(row.status);
|
|
332
|
-
if (DECISIONS.includes(explicit)) return explicit;
|
|
333
|
-
if (listed === 'CONFIRMED' && text(asText(row.mergedInto)) && !isObject(row.verifiedFinding) && !hasFindingContent(row)) return 'MERGED';
|
|
334
|
-
return listed;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/** A confirmation's finding is its `verifiedFinding`, otherwise the row's own finding fields. */
|
|
338
|
-
function decisionRow(row, status) {
|
|
339
|
-
const id = asText(row.id ?? row.verifiedFinding?.id).trim();
|
|
340
|
-
if (status !== 'CONFIRMED') return { ...row, id, status };
|
|
341
|
-
const { reason, verifiedFinding, mergedInto, status: _stated, movedFrom, ...finding } = row;
|
|
342
|
-
return { id, status, reason, verifiedFinding: isObject(verifiedFinding) ? verifiedFinding : finding, ...(movedFrom !== undefined ? { movedFrom } : {}) };
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function normalizeDecisionRows(value, warnings) {
|
|
346
|
-
const source = aliasFields(value, ['status', 'dispositions', 'confirmed', 'merged', 'rejected', 'needsInfo', 'newFindings', 'report'], warnings);
|
|
347
|
-
const fields = item => aliasFields(isObject(item) ? item : { reason: asText(item) }, DECISION_FIELDS, warnings);
|
|
348
|
-
const decisions = [];
|
|
349
|
-
for (const item of rows(source.dispositions, warnings, 'dispositions')) {
|
|
350
|
-
const row = fields(item);
|
|
351
|
-
decisions.push(decisionRow(row, canonicalEnum(row.status)));
|
|
352
|
-
}
|
|
353
|
-
let reclassified = 0;
|
|
354
|
-
for (const [category, listed] of Object.entries({ confirmed: 'CONFIRMED', merged: 'MERGED', rejected: 'REJECTED', needsInfo: 'NEEDS_INFO' })) {
|
|
355
|
-
for (const item of rows(source[category], warnings, category)) {
|
|
356
|
-
const row = fields(item);
|
|
357
|
-
const status = rowDecision(row, listed);
|
|
358
|
-
if (status !== listed) reclassified++;
|
|
359
|
-
decisions.push(decisionRow(row, status));
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
if (reclassified) warnings.add(`${reclassified} decision(s) placed under another category were classified by their own fields.`);
|
|
363
|
-
return { source, decisions };
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/** A valid confirmation located in another file than its candidate; null when the file is unchanged. */
|
|
367
|
-
function fileMove(original, row) {
|
|
368
|
-
const from = locationPath(original?.location), to = locationPath(row.verifiedFinding.location);
|
|
369
|
-
if (!from || !to || from === to) return null;
|
|
370
|
-
return { from: original.location.trim(), to: row.verifiedFinding.location, acknowledged: text(asText(row.movedFrom)) || text(asText(row.verifiedFinding.movedFrom)) };
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Accept one verifier answer for its assigned original findings.
|
|
375
|
-
* @param {string} answerText
|
|
376
|
-
* @param {{originals: object[], allIds?: string[], previous?: object, supplement?: boolean}} options
|
|
377
|
-
*/
|
|
378
|
-
export function evaluateFinal(answerText, { originals, allIds = originals.map(f => f.id), previous, supplement = false }) {
|
|
379
|
-
// A supplement merges into the previous result and keeps its normalization
|
|
380
|
-
// notes; a full resend starts clean so a failed first answer leaves no trace.
|
|
381
|
-
const warnings = new Set(supplement && previous?.structured ? previous.baseWarnings ?? [] : []);
|
|
382
|
-
const parsed = parseModelJSON(answerText, { keys: ['status', 'confirmed', 'merged', 'rejected', 'needsinfo', 'newfindings', 'dispositions', 'report'] });
|
|
383
|
-
if (parsed.corrections) warnings.add('A JSON formatting slip (unescaped quotes in inline code) was repaired locally.');
|
|
384
|
-
const assignedIds = originals.map(f => f.id);
|
|
385
|
-
if (!parsed.value) {
|
|
386
|
-
if (previous?.structured) {
|
|
387
|
-
return { issues: [`Your correction could not be used: ${parsed.problem}.`], result: previous, repairIds: previous.pendingIds ?? [] };
|
|
388
|
-
}
|
|
389
|
-
return {
|
|
390
|
-
issues: [`Your answer could not be used: ${parsed.problem}.`],
|
|
391
|
-
repairIds: assignedIds,
|
|
392
|
-
result: finishFinal({ structured: false, modelStatus: 'UNSPECIFIED', decisions: new Map(), newFindings: [],
|
|
393
|
-
report: String(answerText ?? '').trim(), warnings: new Set(['The verifier answer was not structured; its text is shown as-is.']) }, originals),
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
const { source, decisions } = normalizeDecisionRows(parsed.value, warnings);
|
|
397
|
-
const byId = new Map(supplement && previous?.structured ? previous.decisionRows.map(row => [row.id, row]) : []);
|
|
398
|
-
const issues = [];
|
|
399
|
-
const assigned = new Set(assignedIds), all = new Set(allIds);
|
|
400
|
-
for (const row of decisions) {
|
|
401
|
-
if (!assigned.has(row.id)) { warnings.add(`Ignored a decision for unassigned ID ${row.id || '(blank)'}.`); continue; }
|
|
402
|
-
if (!supplement && byId.has(row.id)) { warnings.add(`Kept the first of several decisions for ${row.id}.`); continue; }
|
|
403
|
-
byId.set(row.id, row);
|
|
404
|
-
}
|
|
405
|
-
const repairIds = new Set(), invalid = { confirm: new Set(), merge: new Set() }, moves = new Map();
|
|
406
|
-
const candidates = new Map(originals.map(original => [original.id, original]));
|
|
407
|
-
for (const id of assignedIds) {
|
|
408
|
-
const row = byId.get(id);
|
|
409
|
-
if (!row) { repairIds.add(id); continue; }
|
|
410
|
-
if (!DECISIONS.includes(row.status)) { issues.push(`${id}: status must be one of ${DECISIONS.join(', ')}.`); repairIds.add(id); continue; }
|
|
411
|
-
if (!text(row.reason)) { issues.push(`${id}: give a concrete reason.`); repairIds.add(id); }
|
|
412
|
-
if (row.status === 'MERGED' && (!all.has(row.mergedInto) || row.mergedInto === id)) {
|
|
413
|
-
issues.push(`${id}: mergedInto must name another original finding ID.`); repairIds.add(id); invalid.merge.add(id);
|
|
414
|
-
}
|
|
415
|
-
if (row.status === 'CONFIRMED') {
|
|
416
|
-
row.verifiedFinding = normalizeFinding(row.verifiedFinding, warnings);
|
|
417
|
-
row.verifiedFinding.id = id;
|
|
418
|
-
const problems = findingProblems(row.verifiedFinding, { requireLocation: true });
|
|
419
|
-
if (problems.length) { issues.push(`${id}: the confirmed finding is ${problems.join('; ')}.`); repairIds.add(id); invalid.confirm.add(id); continue; }
|
|
420
|
-
if (givesNoCorrection(row.verifiedFinding.suggestion)) {
|
|
421
|
-
issues.push(`${id}: confirmed, but its suggestion gives no correction (${JSON.stringify(row.verifiedFinding.suggestion.slice(0, 40))}). If the defect stands, state the correction; if your check refutes the claim, list ${id} under rejected with the refutation.`);
|
|
422
|
-
repairIds.add(id); invalid.confirm.add(id); continue;
|
|
423
|
-
}
|
|
424
|
-
const move = fileMove(candidates.get(id), row);
|
|
425
|
-
if (move) moves.set(id, move);
|
|
426
|
-
if (move && !move.acknowledged) {
|
|
427
|
-
issues.push(`${id}: the location moved to another file (${move.from} → ${move.to}). Keep the candidate's file unless the defect stated in summary is in the other file; to keep the move, add "movedFrom": "${move.from}" and explain the move in reason.`);
|
|
428
|
-
repairIds.add(id);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
// A merge whose chain ends at a finding this same answer rejected or left
|
|
433
|
-
// NEEDS_INFO takes both out without a refutation; ask for one consistent
|
|
434
|
-
// decision on the pair. Targets another shard decides are settled after the
|
|
435
|
-
// shards are combined (settleMergeTargets).
|
|
436
|
-
for (const id of assignedIds) {
|
|
437
|
-
const row = byId.get(id);
|
|
438
|
-
if (row?.status !== 'MERGED' || invalid.merge.has(id)) continue;
|
|
439
|
-
const seen = new Set([id]);
|
|
440
|
-
let target = byId.get(row.mergedInto);
|
|
441
|
-
while (target?.status === 'MERGED' && assigned.has(target.id) && !seen.has(target.id)) { seen.add(target.id); target = byId.get(target.mergedInto); }
|
|
442
|
-
if (!target || !assigned.has(target.id) || !['REJECTED', 'NEEDS_INFO'].includes(target.status)) continue;
|
|
443
|
-
issues.push(`${id}: merged into ${target.id}, which this answer marks ${target.status}. Confirm ${target.id} with the complete finding, or decide ${id} on its own evidence (confirmed, rejected or needsInfo).`);
|
|
444
|
-
repairIds.add(id); repairIds.add(target.id);
|
|
445
|
-
}
|
|
446
|
-
const missing = assignedIds.filter(id => !byId.has(id));
|
|
447
|
-
if (missing.length) issues.unshift(`No decision was given for: ${missing.join(', ')}.`);
|
|
448
|
-
const sourceNew = supplement && !Object.hasOwn(source, 'newFindings') ? null : source.newFindings;
|
|
449
|
-
const newFindings = sourceNew === null ? [...(previous?.newFindings ?? []), ...(previous?.incompleteNewFindings ?? [])]
|
|
450
|
-
: rows(sourceNew, warnings, 'newFindings').map(row => normalizeFinding(row, warnings));
|
|
451
|
-
if (sourceNew !== null) newFindings.forEach((row, index) => {
|
|
452
|
-
const problems = findingProblems(row, { requireLocation: true });
|
|
453
|
-
if (problems.length) issues.push(`newFindings[${index}]: ${problems.join('; ')}.`);
|
|
454
|
-
});
|
|
455
|
-
const report = supplement && !text(asText(source.report)) ? previous?.report ?? '' : asText(source.report).trim();
|
|
456
|
-
const modelStatus = supplement ? previous?.modelStatus ?? 'UNSPECIFIED' : canonicalEnum(source.status) || 'UNSPECIFIED';
|
|
457
|
-
const state = { structured: true, modelStatus, decisions: byId, newFindings, report, warnings, corrections: parsed.corrections, moves };
|
|
458
|
-
return { issues, repairIds: [...repairIds], result: finishFinal(state, originals, invalid, [...repairIds]) };
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// The runtime records where a moved finding came from; a model's own value is not kept.
|
|
462
|
-
function confirmedFinding(finding, move) {
|
|
463
|
-
const { movedFrom: _stated, ...rest } = finding;
|
|
464
|
-
return move ? { ...rest, movedFrom: move.from } : rest;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
/** Degrade unresolved items per finding; nothing else is discarded. */
|
|
468
|
-
/**
|
|
469
|
-
* A merge chain must end at a non-merged decision; findings whose chain is a
|
|
470
|
-
* cycle become UNREVIEWED. Runs per verifier answer and again over all shards,
|
|
471
|
-
* since a merge may name a finding another shard decided. Returns their IDs.
|
|
472
|
-
*/
|
|
473
|
-
export function breakMergeCycles(dispositions) {
|
|
474
|
-
const byId = new Map(dispositions.map(entry => [entry.id, entry]));
|
|
475
|
-
const cyclic = new Set();
|
|
476
|
-
for (const entry of dispositions) {
|
|
477
|
-
if (entry.status !== 'MERGED') continue;
|
|
478
|
-
const seen = new Set([entry.id]);
|
|
479
|
-
let target = byId.get(entry.mergedInto);
|
|
480
|
-
while (target?.status === 'MERGED' && !seen.has(target.id)) { seen.add(target.id); target = byId.get(target.mergedInto); }
|
|
481
|
-
if (target?.status === 'MERGED') cyclic.add(entry.id);
|
|
482
|
-
}
|
|
483
|
-
for (const entry of dispositions) {
|
|
484
|
-
if (!cyclic.has(entry.id)) continue;
|
|
485
|
-
entry.status = 'UNREVIEWED';
|
|
486
|
-
entry.reason = `${entry.reason} [Runtime: the merge chain forms a cycle.]`;
|
|
487
|
-
delete entry.mergedInto;
|
|
488
|
-
}
|
|
489
|
-
return [...cyclic];
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* A merge chain must end at a CONFIRMED finding; otherwise the merged finding
|
|
494
|
-
* has no decision of its own and would vanish behind a rejection. Runs per
|
|
495
|
-
* verifier answer after normalization (a confirmation that became NEEDS_INFO
|
|
496
|
-
* counts) and again over all shards, since a verifier may merge into a
|
|
497
|
-
* finding another shard decided. Call after breakMergeCycles. Targets absent
|
|
498
|
-
* from `dispositions` belong to other shards unless `unknownIsDangling`;
|
|
499
|
-
* `confirmedIds` names targets kept elsewhere (surviving verifier-added
|
|
500
|
-
* findings, which the duplicate check may merge into). Dangling sources
|
|
501
|
-
* become UNREVIEWED; returns them with the target they named.
|
|
502
|
-
*/
|
|
503
|
-
export function settleMergeTargets(dispositions, { unknownIsDangling = false, confirmedIds = new Set() } = {}) {
|
|
504
|
-
const byId = new Map(dispositions.map(entry => [entry.id, entry]));
|
|
505
|
-
const lookup = id => byId.get(id) ?? (confirmedIds.has(id) ? { id, status: 'CONFIRMED' } : undefined);
|
|
506
|
-
const dangling = [];
|
|
507
|
-
for (const entry of dispositions) {
|
|
508
|
-
if (entry.status !== 'MERGED') continue;
|
|
509
|
-
const seen = new Set([entry.id]);
|
|
510
|
-
let target = lookup(entry.mergedInto);
|
|
511
|
-
while (target?.status === 'MERGED' && !seen.has(target.id)) { seen.add(target.id); target = lookup(target.mergedInto); }
|
|
512
|
-
if (target?.status === 'CONFIRMED' || target?.status === 'MERGED' || (!target && !unknownIsDangling)) continue;
|
|
513
|
-
dangling.push({ id: entry.id, target: target?.id ?? entry.mergedInto, status: target?.status ?? 'undecided' });
|
|
514
|
-
}
|
|
515
|
-
for (const row of dangling) {
|
|
516
|
-
const entry = byId.get(row.id);
|
|
517
|
-
entry.status = 'UNREVIEWED';
|
|
518
|
-
entry.reason = `${entry.reason} [Runtime: merged into ${row.target}, which is ${row.status}; no decision stands.]`;
|
|
519
|
-
delete entry.mergedInto;
|
|
520
|
-
}
|
|
521
|
-
return dangling;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
function finishFinal(state, originals, invalid = { confirm: new Set(), merge: new Set() }, pendingIds = []) {
|
|
525
|
-
const { decisions } = state;
|
|
526
|
-
// Normalization notes carry over into a merged supplement; warnings derived
|
|
527
|
-
// from the current decisions are recomputed every time.
|
|
528
|
-
const base = [...state.warnings], derived = [];
|
|
529
|
-
const dispositions = [];
|
|
530
|
-
for (const original of originals) {
|
|
531
|
-
const row = decisions.get(original.id);
|
|
532
|
-
if (!row) {
|
|
533
|
-
dispositions.push({ id: original.id, status: 'UNREVIEWED', reason: 'The verifier gave no decision for this finding; it is not confirmed.' });
|
|
534
|
-
continue;
|
|
535
|
-
}
|
|
536
|
-
if (!DECISIONS.includes(row.status)) {
|
|
537
|
-
dispositions.push({ id: original.id, status: 'UNREVIEWED', reason: asText(row.reason) || 'The verifier decision was malformed.' });
|
|
538
|
-
continue;
|
|
539
|
-
}
|
|
540
|
-
if (row.status === 'CONFIRMED' && invalid.confirm.has(original.id)) {
|
|
541
|
-
const absent = FINDING_FIELDS.filter(key => !text(row.verifiedFinding?.[key]));
|
|
542
|
-
if (!absent.length && givesNoCorrection(row.verifiedFinding?.suggestion)) absent.push('a correction in suggestion');
|
|
543
|
-
dispositions.push({ id: original.id, status: 'NEEDS_INFO', reason: `${asText(row.reason)} [Runtime: the confirmation lacks ${absent.join(', ') || 'valid fields'}, so it is not eligible for comments.]`.trim(),
|
|
544
|
-
partialFinding: row.verifiedFinding });
|
|
545
|
-
continue;
|
|
546
|
-
}
|
|
547
|
-
if (row.status === 'MERGED' && invalid.merge.has(original.id)) {
|
|
548
|
-
dispositions.push({ id: original.id, status: 'UNREVIEWED', reason: `${asText(row.reason)} [Runtime: the merge target is invalid.]`.trim() });
|
|
549
|
-
continue;
|
|
550
|
-
}
|
|
551
|
-
const entry = { id: original.id, status: row.status, reason: asText(row.reason).trim() || 'No reason given.',
|
|
552
|
-
...(row.status === 'MERGED' ? { mergedInto: row.mergedInto } : {}),
|
|
553
|
-
...(row.status === 'CONFIRMED' ? { verifiedFinding: confirmedFinding(row.verifiedFinding, state.moves?.get(original.id)) } : {}) };
|
|
554
|
-
dispositions.push(entry);
|
|
555
|
-
}
|
|
556
|
-
breakMergeCycles(dispositions);
|
|
557
|
-
const dangling = settleMergeTargets(dispositions);
|
|
558
|
-
if (dangling.length) derived.push(`${dangling.length} merged finding(s) name a target that was not confirmed and are shown as UNREVIEWED.`);
|
|
559
|
-
const unreviewed = dispositions.filter(row => row.status === 'UNREVIEWED').length;
|
|
560
|
-
if (unreviewed) derived.push(`${unreviewed} finding(s) have no usable verifier decision and are shown as UNREVIEWED.`);
|
|
561
|
-
const unconfirmed = dispositions.filter(row => row.status === 'CONFIRMED' && state.moves?.get(row.id)?.acknowledged === false);
|
|
562
|
-
if (unconfirmed.length) derived.push(`Verification moved ${unconfirmed.map(row => `${row.id} (from ${row.verifiedFinding.movedFrom})`).join(', ')} to another file without confirming the move; check the location.`);
|
|
563
|
-
const newFindings = state.newFindings.filter(row => !findingProblems(row, { requireLocation: true }).length);
|
|
564
|
-
if (newFindings.length < state.newFindings.length) derived.push(`${state.newFindings.length - newFindings.length} new verifier finding(s) were incomplete and are listed in the report only.`);
|
|
565
|
-
return {
|
|
566
|
-
status: !state.structured ? 'PARTIAL' : state.modelStatus === 'INCOMPLETE' ? 'INCOMPLETE' : 'COMPLETE',
|
|
567
|
-
structured: state.structured, modelStatus: state.modelStatus, dispositions, newFindings,
|
|
568
|
-
incompleteNewFindings: state.newFindings.filter(row => !newFindings.includes(row)),
|
|
569
|
-
report: state.report, warnings: [...base, ...derived], baseWarnings: base,
|
|
570
|
-
...(state.corrections ? { corrections: state.corrections } : {}),
|
|
571
|
-
decisionRows: [...decisions.values()], pendingIds,
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
|
|
575
323
|
/**
|
|
576
|
-
* Accept one
|
|
577
|
-
*
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
* survivor and are left
|
|
324
|
+
* Accept one duplicate check of the findings different reviewer sessions
|
|
325
|
+
* reported in one file. The answer only merges: every finding it does not merge
|
|
326
|
+
* stays reported, so an invalid row is reported for a correction turn and
|
|
327
|
+
* otherwise ignored, never turning into a lost finding. Chains (A into B, B
|
|
328
|
+
* into C) end at the finding that stays; cycles name no survivor and are left
|
|
329
|
+
* unmerged.
|
|
330
|
+
* `sessions` names, per finding, the reviewer sessions that reported it (several
|
|
331
|
+
* for a finding that already stands for identical ones). A session files one
|
|
332
|
+
* finding per place that needs its own correction, so findings of one session
|
|
333
|
+
* never end up in one group, neither directly nor through a third finding:
|
|
334
|
+
* merges are applied in the answer's order, and one that would bring two
|
|
335
|
+
* findings of a session together is refused, reported for a correction turn and
|
|
336
|
+
* otherwise left out.
|
|
581
337
|
* @param {string} answerText
|
|
582
|
-
* @param {{ids: string[]}} options the findings of the checked file
|
|
338
|
+
* @param {{ids: string[], sessions?: Record<string, string[]>}} options the findings of the checked file
|
|
583
339
|
*/
|
|
584
|
-
export function evaluateDuplicates(answerText, { ids }) {
|
|
340
|
+
export function evaluateDuplicates(answerText, { ids, sessions = {} }) {
|
|
585
341
|
const warnings = new Set();
|
|
586
342
|
const parsed = parseModelJSON(answerText, { keys: ['status', 'merged', 'report'] });
|
|
587
343
|
if (!parsed.value) {
|
|
@@ -591,34 +347,60 @@ export function evaluateDuplicates(answerText, { ids }) {
|
|
|
591
347
|
if (parsed.corrections) warnings.add('A JSON formatting slip (unescaped quotes in inline code) was repaired locally.');
|
|
592
348
|
const source = aliasFields(parsed.value, ['status', 'merged', 'report'], warnings);
|
|
593
349
|
const assigned = new Set(ids), issues = [], rowsById = new Map();
|
|
594
|
-
|
|
595
|
-
|
|
350
|
+
// Only a list of merges decides anything: another value merges nothing, however it could be read as one.
|
|
351
|
+
const decided = Array.isArray(source.merged);
|
|
352
|
+
if (!decided) issues.push('"merged" must be an array (use [] when none of the findings are duplicates).');
|
|
353
|
+
for (const [index, item] of (decided ? source.merged : []).entries()) {
|
|
596
354
|
const row = aliasFields(isObject(item) ? item : {}, ['id', 'mergedInto', 'reason'], warnings);
|
|
597
355
|
const id = asText(row.id).trim(), into = asText(row.mergedInto).trim(), problems = [];
|
|
598
356
|
if (!assigned.has(id)) problems.push(`id ${JSON.stringify(id)} is not an assigned finding`);
|
|
599
357
|
if (!assigned.has(into) || into === id) problems.push('mergedInto must name another assigned finding');
|
|
600
|
-
|
|
358
|
+
// A reason is text: false or a list is none, however it would read once turned into text.
|
|
359
|
+
if (typeof row.reason !== 'string' || !text(row.reason)) problems.push('give a concrete reason');
|
|
601
360
|
if (rowsById.has(id)) problems.push(`${id} is merged more than once`);
|
|
602
361
|
if (problems.length) { issues.push(`merged[${index}]: ${problems.join('; ')}.`); continue; }
|
|
603
362
|
rowsById.set(id, { id, mergedInto: into, reason: asText(row.reason).trim() });
|
|
604
363
|
}
|
|
605
|
-
|
|
364
|
+
// A cycle names no finding that stays: its rows are reported and left out.
|
|
365
|
+
const cyclic = new Set();
|
|
606
366
|
for (const row of rowsById.values()) {
|
|
607
367
|
const seen = new Set([row.id]);
|
|
608
368
|
let target = row.mergedInto;
|
|
609
369
|
while (rowsById.has(target) && !seen.has(target)) { seen.add(target); target = rowsById.get(target).mergedInto; }
|
|
610
|
-
if (rowsById.has(target)) { issues.push(`${row.id}: the merges form a cycle; keep one of these findings and merge the others into it.`);
|
|
611
|
-
merges.push({ ...row, mergedInto: target });
|
|
370
|
+
if (rowsById.has(target)) { cyclic.add(row.id); issues.push(`${row.id}: the merges form a cycle; keep one of these findings and merge the others into it.`); }
|
|
612
371
|
}
|
|
613
|
-
|
|
614
|
-
|
|
372
|
+
// The groups grow in the answer's order. Each has the finding that stays (`kept`), its members and the sessions
|
|
373
|
+
// that reported them; a merge whose group shares a session with the group it would join is refused.
|
|
374
|
+
const groupOf = new Map(ids.map(id => [id, { kept: id, members: [id], sessions: new Set(sessions[id] ?? []) }]));
|
|
375
|
+
const applied = [];
|
|
376
|
+
let refused = 0;
|
|
377
|
+
for (const row of rowsById.values()) {
|
|
378
|
+
if (cyclic.has(row.id)) continue;
|
|
379
|
+
const from = groupOf.get(row.id), into = groupOf.get(row.mergedInto);
|
|
380
|
+
if (from === into) continue;
|
|
381
|
+
const shared = [...from.sessions].find(session => into.sessions.has(session));
|
|
382
|
+
if (shared !== undefined) {
|
|
383
|
+
const own = from.members.find(id => (sessions[id] ?? []).includes(shared)), twin = into.members.find(id => (sessions[id] ?? []).includes(shared));
|
|
384
|
+
issues.push(`${row.id} into ${row.mergedInto}: ${own} and ${twin} were both reported by the session ${JSON.stringify(shared)}, which filed them as separate findings, so they cannot end up in one finding. Merge only the one that repeats the other session's finding, if any, and leave the other separate.`);
|
|
385
|
+
refused++;
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
for (const session of from.sessions) into.sessions.add(session);
|
|
389
|
+
into.members.push(...from.members);
|
|
390
|
+
for (const id of from.members) groupOf.set(id, into);
|
|
391
|
+
applied.push(row);
|
|
392
|
+
}
|
|
393
|
+
// Every merged finding names the finding its group keeps, also where its own target was merged later.
|
|
394
|
+
const merges = applied.map(row => ({ ...row, mergedInto: groupOf.get(row.id).kept }));
|
|
395
|
+
const unmerged = issues.length ? [`Some duplicate-check merges were invalid and were not applied${refused ? ` (${refused} would have joined two findings of one reviewer session)` : ''}; those findings stay reported.`] : [];
|
|
396
|
+
return { issues, result: { status: 'COMPLETE', structured: true, decided, merges, refused, report: asText(source.report).trim(), warnings: [...warnings, ...unmerged],
|
|
615
397
|
...(parsed.corrections ? { corrections: parsed.corrections } : {}) } };
|
|
616
398
|
}
|
|
617
399
|
|
|
618
400
|
/**
|
|
619
401
|
* Accept one severity rating. The answer only sets levels: a finding it does
|
|
620
|
-
* not rate, or rates with something else than high, medium or low, keeps
|
|
621
|
-
*
|
|
402
|
+
* not rate, or rates with something else than high, medium or low, keeps its
|
|
403
|
+
* reviewer's severity, so an invalid row is reported for a correction turn and
|
|
622
404
|
* otherwise ignored.
|
|
623
405
|
* @param {string} answerText
|
|
624
406
|
* @param {{ids: string[]}} options the findings to rate
|
|
@@ -628,7 +410,7 @@ export function evaluateRatings(answerText, { ids }) {
|
|
|
628
410
|
const parsed = parseModelJSON(answerText, { keys: ['status', 'ratings', 'report'] });
|
|
629
411
|
if (!parsed.value) {
|
|
630
412
|
return { issues: [`Your answer could not be used: ${parsed.problem}.`],
|
|
631
|
-
result: { status: 'COMPLETE', structured: false, ratings: [], report: '', warnings: ['The severity rating gave no usable answer; the
|
|
413
|
+
result: { status: 'COMPLETE', structured: false, ratings: [], report: '', warnings: ['The severity rating gave no usable answer; the reviewers\' severities are kept.'] } };
|
|
632
414
|
}
|
|
633
415
|
if (parsed.corrections) warnings.add('A JSON formatting slip (unescaped quotes in inline code) was repaired locally.');
|
|
634
416
|
const source = aliasFields(parsed.value, ['status', 'ratings', 'report'], warnings);
|
|
@@ -645,7 +427,7 @@ export function evaluateRatings(answerText, { ids }) {
|
|
|
645
427
|
}
|
|
646
428
|
const missing = ids.filter(id => !byId.has(id));
|
|
647
429
|
if (missing.length) issues.push(`No usable rating for ${missing.slice(0, 20).join(', ')}${missing.length > 20 ? ', ...' : ''}.`);
|
|
648
|
-
const kept = missing.length ? [`${missing.length} finding(s) got no usable rating and keep
|
|
430
|
+
const kept = missing.length ? [`${missing.length} finding(s) got no usable rating and keep their reviewer's severity.`] : [];
|
|
649
431
|
return { issues, result: { status: 'COMPLETE', structured: true, ratings: [...byId.values()], report: asText(source.report).trim(), warnings: [...warnings, ...kept],
|
|
650
432
|
...(parsed.corrections ? { corrections: parsed.corrections } : {}) } };
|
|
651
433
|
}
|
|
@@ -657,7 +439,7 @@ export function ratingRepairPrompt(issues, { parseOnly = false } = {}) {
|
|
|
657
439
|
|
|
658
440
|
export function duplicateRepairPrompt(issues, { parseOnly = false } = {}) {
|
|
659
441
|
if (parseOnly) return parseRepairPrompt(issues);
|
|
660
|
-
return `AZPR runtime: your duplicate check needs correction.\n${listIssues(issues)}\n\nReturn the complete JSON object again (status, merged, report). Merge an assigned finding only into another assigned finding that stays, and only when both state the same root cause and need the same correction.`;
|
|
442
|
+
return `AZPR runtime: your duplicate check needs correction.\n${listIssues(issues)}\n\nReturn the complete JSON object again (status, merged, report). Merge an assigned finding only into another assigned finding that stays, and only when both state the same root cause and need the same correction; two findings of one session stay separate.`;
|
|
661
443
|
}
|
|
662
444
|
|
|
663
445
|
// When only the JSON syntax was wrong, the content must come back unchanged:
|
|
@@ -667,35 +449,22 @@ const VERBATIM = 'Send the same answer again with identical content: do not shor
|
|
|
667
449
|
export const syntaxProblem = issues => issues.some(issue => /could not be parsed|repeats a key/.test(issue));
|
|
668
450
|
export const parseRepairPrompt = issues => `AZPR runtime: your previous answer was not valid JSON.\n${listIssues(issues)}\n\n${VERBATIM}`;
|
|
669
451
|
|
|
670
|
-
/** Repair request for
|
|
671
|
-
export function
|
|
672
|
-
if (parseOnly) return parseRepairPrompt(issues);
|
|
673
|
-
return `AZPR runtime: your previous answer needs correction before it can be used.\n${listIssues(issues)}\n\nReturn the complete corrected JSON object for the same review (status, coverage, additionalFiles, findings, report). Keep every finding you still stand behind and keep the existing wording of fields that need no correction; read more source only if a correction needs it.`;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
/** Repair request for a quick review: the whole object, with what to do about failed locations. */
|
|
677
|
-
export function quickRepairPrompt(issues, { parseOnly = false } = {}) {
|
|
452
|
+
/** Repair request for a reviewer: the whole object, with what to do about failed locations. */
|
|
453
|
+
export function reviewRepairPrompt(issues, { parseOnly = false } = {}) {
|
|
678
454
|
if (parseOnly) return parseRepairPrompt(issues);
|
|
679
455
|
return `AZPR runtime: your previous answer needs correction before it can be used.\n${listIssues(issues)}\n\nReturn the complete corrected JSON object for the same review (status, coverage, additionalFiles, findings, report). For a location problem, read the file with azpr_read_diff or azpr_read_file and correct the location, locate the finding at readable source that supports it, or move the concern to report. Keep every finding you still stand behind and keep the existing wording of fields that need no correction.`;
|
|
680
456
|
}
|
|
681
457
|
|
|
682
458
|
/**
|
|
683
|
-
* The one follow-up turn for a
|
|
459
|
+
* The one follow-up turn for a reviewer whose answer is PARTIAL with work it named:
|
|
684
460
|
* the same session continues where the source is readable and keeps honest limits.
|
|
685
461
|
*/
|
|
686
|
-
export function
|
|
462
|
+
export function reviewFollowUpPrompt({ gaps = [], uncovered = [] }) {
|
|
687
463
|
const listed = uncovered.slice(0, 20).join(', ') + (uncovered.length > 20 ? `, and ${uncovered.length - 20} more` : '');
|
|
688
464
|
const items = [...gaps, ...(uncovered.length ? [`Assigned files not listed as reviewed: ${listed}`] : [])];
|
|
689
465
|
return `AZPR runtime: your answer is PARTIAL and names work that is not finished.\n${listIssues(items)}\n\nWhere a check you need is unfinished and the source it needs is readable with AZPR's tools, continue it now. Keep a gap only for a limit you cannot close (binary, oversized or missing content, a tool that keeps failing) and say what stopped you. Then return the complete JSON object again (status, coverage, additionalFiles, findings, report): every finding you still stand behind and any you found now, with status COMPLETE only when every assigned file is reviewed and no gap remains.`;
|
|
690
466
|
}
|
|
691
467
|
|
|
692
|
-
/** Repair request for a verifier: only the decisions that are missing or invalid. */
|
|
693
|
-
export function finalRepairPrompt(issues, ids, { includeNewFindings = false, full = false, parseOnly = false } = {}) {
|
|
694
|
-
if (parseOnly) return parseRepairPrompt(issues);
|
|
695
|
-
if (full) return `AZPR runtime: your previous answer needs correction before it can be used.\n${listIssues(issues)}\n\nReturn the complete verification JSON object (status, confirmed, merged, rejected, needsInfo, newFindings, report) with exactly one decision for each assigned finding ID.`;
|
|
696
|
-
return `AZPR runtime: some decisions need correction.\n${listIssues(issues)}\n\nReturn one JSON object {"dispositions": [...]${includeNewFindings ? ', "newFindings": [...]' : ''}} containing decisions only for: ${ids.join(', ')}. Each row has id, status (CONFIRMED, MERGED, REJECTED or NEEDS_INFO) and reason; CONFIRMED rows include "verifiedFinding" with summary, evidence, counterevidence, location, severity and suggestion (plus "movedFrom" when the location is in another file than the candidate's); MERGED rows include "mergedInto". Earlier decisions are kept.`;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
468
|
/** The flags a review command takes right after the PR URL, and the afterReview mode each sets for that run. */
|
|
700
469
|
export const REVIEW_FLAGS = Object.freeze({ '--preview': 'preview', '--publish': 'publish', '--no-comment': 'none' });
|
|
701
470
|
const FLAG_NAMES = '--preview, --publish or --no-comment';
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
The verifier already merged duplicate findings: each finding is a separate
|
|
8
8
|
issue, so never skip one because another finding of this review has or will get
|
|
9
9
|
a comment.
|
|
10
|
-
<!-- azpr:
|
|
10
|
+
<!-- azpr:reviewers -->
|
|
11
11
|
Treat each finding as a separate issue, as the reviewer reported it: never skip
|
|
12
12
|
one because another finding of this review has or will get a comment.
|
|
13
|
-
|
|
14
|
-
lists such candidates
|
|
15
|
-
overlapping lines of one file, with the same severity). Combine findings of one
|
|
13
|
+
Where the input has `mergeCandidates`, different sessions may have reported one
|
|
14
|
+
defect twice: the runtime lists such candidates there (findings of different
|
|
15
|
+
sessions on overlapping lines of one file, with the same severity). Combine findings of one
|
|
16
16
|
group into one comment only when they state the same root cause, with
|
|
17
17
|
compatible triggers and the same correction: give that comment `findingIds`
|
|
18
18
|
with every finding it covers and a `mergeReason`, keep each trigger and the
|
|
@@ -82,7 +82,7 @@ priority if useful. No finding recap, counts, run IDs or SHAs.
|
|
|
82
82
|
<!-- azpr:verified -->
|
|
83
83
|
content, for example `### Additional finding details` (confirmed findings
|
|
84
84
|
without an inline comment, including low severity) and
|
|
85
|
-
<!-- azpr:
|
|
85
|
+
<!-- azpr:reviewers -->
|
|
86
86
|
content, for example `### Additional finding details` (findings without an
|
|
87
87
|
inline comment, including low severity) and
|
|
88
88
|
<!-- azpr:end -->
|
|
@@ -13,10 +13,10 @@ revive rejected claims, inflate severity or add new findings.
|
|
|
13
13
|
|
|
14
14
|
One general PR summary plus inline comments for confirmed high and medium
|
|
15
15
|
findings:
|
|
16
|
-
<!-- azpr:
|
|
17
|
-
The supplied findings come from
|
|
18
|
-
|
|
19
|
-
this review's final findings and authoritative for trigger, impact, location,
|
|
16
|
+
<!-- azpr:reviewers -->
|
|
17
|
+
The supplied findings come from this review's reviewers: each checked its own
|
|
18
|
+
findings against the source, and no separate verification re-checked them. They
|
|
19
|
+
are this review's final findings and authoritative for trigger, impact, location,
|
|
20
20
|
severity and qualifications. Do not judge them again, revive dispositions that
|
|
21
21
|
are not findings, inflate severity or add new findings. A finding with
|
|
22
22
|
`"inline": false` has no location that can carry an inline comment: put it in
|