@webpieces/rules-config 0.4.826 → 0.4.827
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 +1 -1
- package/src/checklist-config.js +2 -2
- package/src/checklist-config.js.map +1 -1
- package/src/checklist-instructions.d.ts +1 -1
- package/src/checklist-instructions.js +3 -3
- package/src/checklist-instructions.js.map +1 -1
- package/src/checklist-override.d.ts +4 -4
- package/src/checklist-override.js +4 -4
- package/src/checklist-override.js.map +1 -1
- package/src/checklist-validator.js +12 -3
- package/src/checklist-validator.js.map +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +6 -4
- package/src/index.js.map +1 -1
- package/src/pr-gate-section-validators.js +2 -2
- package/src/pr-gate-section-validators.js.map +1 -1
- package/src/retired-config-keys.js +1 -1
- package/src/retired-config-keys.js.map +1 -1
- package/src/review-json-data.d.ts +11 -4
- package/src/review-json-data.js +40 -21
- package/src/review-json-data.js.map +1 -1
- package/src/review-json.d.ts +38 -42
- package/src/review-json.js +103 -96
- package/src/review-json.js.map +1 -1
- package/src/review-provenance.d.ts +1 -1
- package/src/review-provenance.js +2 -2
- package/src/review-provenance.js.map +1 -1
- package/src/reviewer-instructions.d.ts +6 -0
- package/src/reviewer-instructions.js +22 -6
- package/src/reviewer-instructions.js.map +1 -1
- package/src/state-dir.d.ts +2 -2
- package/src/state-dir.js +2 -2
- package/src/state-dir.js.map +1 -1
- package/src/subagent-provenance.d.ts +2 -2
- package/src/subagent-provenance.js +3 -3
- package/src/subagent-provenance.js.map +1 -1
- package/src/verdict-schema-renderer.js +6 -3
- package/src/verdict-schema-renderer.js.map +1 -1
- package/templates/webpieces.review-checklists.md +41 -24
package/src/review-json.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ReviewJsonService = exports.PrContext = exports.ChecklistVerdict = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.
|
|
3
|
+
exports.ReviewJsonService = exports.PrContext = exports.ChecklistVerdict = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_ORANGE = exports.CK_ORANGE_FIXED = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.PrSummary = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.ChecklistResult = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_ORANGE = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = exports.checklistOverrideService = exports.ChecklistOverrideService = exports.ChecklistOverride = void 0;
|
|
4
4
|
exports.prDirFor = prDirFor;
|
|
5
5
|
exports.summaryJsonPath = summaryJsonPath;
|
|
6
6
|
exports.summaryJsonSchemaHint = summaryJsonSchemaHint;
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "checklistOverrideService", { enumerable: true, g
|
|
|
21
21
|
const review_json_data_1 = require("./review-json-data");
|
|
22
22
|
Object.defineProperty(exports, "VERDICT_GREEN", { enumerable: true, get: function () { return review_json_data_1.VERDICT_GREEN; } });
|
|
23
23
|
Object.defineProperty(exports, "VERDICT_YELLOW", { enumerable: true, get: function () { return review_json_data_1.VERDICT_YELLOW; } });
|
|
24
|
+
Object.defineProperty(exports, "VERDICT_ORANGE", { enumerable: true, get: function () { return review_json_data_1.VERDICT_ORANGE; } });
|
|
24
25
|
Object.defineProperty(exports, "VERDICT_RED", { enumerable: true, get: function () { return review_json_data_1.VERDICT_RED; } });
|
|
25
26
|
Object.defineProperty(exports, "VERDICT_STATUSES", { enumerable: true, get: function () { return review_json_data_1.VERDICT_STATUSES; } });
|
|
26
27
|
Object.defineProperty(exports, "ChecklistResult", { enumerable: true, get: function () { return review_json_data_1.ChecklistResult; } });
|
|
@@ -30,7 +31,8 @@ Object.defineProperty(exports, "PrSummary", { enumerable: true, get: function ()
|
|
|
30
31
|
Object.defineProperty(exports, "CK_PASS", { enumerable: true, get: function () { return review_json_data_1.CK_PASS; } });
|
|
31
32
|
Object.defineProperty(exports, "CK_WARN", { enumerable: true, get: function () { return review_json_data_1.CK_WARN; } });
|
|
32
33
|
Object.defineProperty(exports, "CK_OVERRIDDEN", { enumerable: true, get: function () { return review_json_data_1.CK_OVERRIDDEN; } });
|
|
33
|
-
Object.defineProperty(exports, "
|
|
34
|
+
Object.defineProperty(exports, "CK_ORANGE_FIXED", { enumerable: true, get: function () { return review_json_data_1.CK_ORANGE_FIXED; } });
|
|
35
|
+
Object.defineProperty(exports, "CK_ORANGE", { enumerable: true, get: function () { return review_json_data_1.CK_ORANGE; } });
|
|
34
36
|
Object.defineProperty(exports, "CK_FAIL", { enumerable: true, get: function () { return review_json_data_1.CK_FAIL; } });
|
|
35
37
|
Object.defineProperty(exports, "CK_MISSING", { enumerable: true, get: function () { return review_json_data_1.CK_MISSING; } });
|
|
36
38
|
Object.defineProperty(exports, "CK_BAD_FORMAT", { enumerable: true, get: function () { return review_json_data_1.CK_BAD_FORMAT; } });
|
|
@@ -48,15 +50,10 @@ const ARCHIVE_NOTE = 'ARCHIVE — this is the PR summary from the PREVIOUS wp-fi
|
|
|
48
50
|
'update, which has since moved. If you are updating the PR again, write a FRESH summary.json at the path ' +
|
|
49
51
|
"pnpm wp-review-upsert-pr prints; do not copy this file's title, summary or risk level forward without " +
|
|
50
52
|
're-deciding each one. Overwritten by every finish, so only the most recent summary is ever here.';
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
const CHECKLIST_ARCHIVE_NOTE = 'ARCHIVE — this is a checklist verdict from a PREVIOUS reviewer run on this branch, kept for audit ' +
|
|
56
|
-
'purposes only. It is NOT a live verdict and must never be read back as one: it was RETIRED because it ' +
|
|
57
|
-
'refused the PR, and the gate moved it here so the only way forward is a FRESH review-<id>.json written ' +
|
|
58
|
-
'by a real reviewer run. Do not copy its status back onto the live path to get past the gate. ' +
|
|
59
|
-
'Overwritten by every retirement, so only the most recently retired verdict is ever here.';
|
|
53
|
+
// A verdict file is named by its ROUND (issue #1053): `review-round<N>-<id>.json`, one per round, never
|
|
54
|
+
// overwritten. The id is matched EXACTLY (escaped), so `review-round2-fixes.json` (the author's recorded
|
|
55
|
+
// fixes for round 2) and a provenance file beside a verdict can never be read as a verdict.
|
|
56
|
+
const VERDICT_FILE_PREFIX = 'review-round';
|
|
60
57
|
/** Locates + loads/validates the AI-authored summary.json. `@injectable(bindingScopeValues.Singleton)` so it's drawn in the design. */
|
|
61
58
|
let ReviewJsonService = class ReviewJsonService {
|
|
62
59
|
dotDir;
|
|
@@ -67,7 +64,7 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
67
64
|
}
|
|
68
65
|
// The per-feature PR working dir: `<worktree>/.webpieces/pr-review/<feature>`. AI-WRITABLE scope,
|
|
69
66
|
// not local() — an agent AUTHORS summary.json here, and each reviewer subagent authors its own
|
|
70
|
-
// review
|
|
67
|
+
// review-round<N>-<id>.json beside it. A worktree-isolated agent's Write is refused for any path under the
|
|
71
68
|
// shared checkout, which is where local() puts this, so local() made both files unwritable by the
|
|
72
69
|
// very agents the flow instructs to write them. See DotWebpieces.aiWritable() for the full account.
|
|
73
70
|
prDirFor(repoRoot, featureName) {
|
|
@@ -113,15 +110,9 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
113
110
|
* The archived bytes: the original JSON with an AUDIT-ONLY note as its FIRST key, so anything that opens
|
|
114
111
|
* the file — human or AI — reads what it is before it reads any of its content.
|
|
115
112
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
* a second copy of this method would be the thing that drifts.
|
|
120
|
-
*
|
|
121
|
-
* Falls back to the raw bytes when they do not parse. For summary.json `loadSummaryJson` has already
|
|
122
|
-
* accepted the file so that is close to impossible, but a verdict file is written by a subagent and may
|
|
123
|
-
* be half-written or not an object at all — and preserving the original always beats losing it to a
|
|
124
|
-
* stamping failure, since the archive exists precisely to be the record.
|
|
113
|
+
* Falls back to the raw bytes when they do not parse. `loadSummaryJson` has already accepted the file, so
|
|
114
|
+
* that is close to impossible, but preserving the original always beats losing it to a stamping failure,
|
|
115
|
+
* since the archive exists precisely to be the record.
|
|
125
116
|
*/
|
|
126
117
|
archivedBody(raw, note) {
|
|
127
118
|
const parsed = this.tryParseObject(raw);
|
|
@@ -176,7 +167,7 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
176
167
|
}
|
|
177
168
|
/**
|
|
178
169
|
* The review context for a feature, recovered from the pr-context.json wp-start-upsert-pr already wrote.
|
|
179
|
-
* Lets wp-finish-upsert-pr's "you still owe me review
|
|
170
|
+
* Lets wp-finish-upsert-pr's "you still owe me review-round<N>-<id>.json" message inline the SAME self-sufficient
|
|
180
171
|
* per-reviewer block start printed, instead of a checklist name and an indirection. Empty when the file
|
|
181
172
|
* is absent or unreadable — the block then just omits those lines.
|
|
182
173
|
*/
|
|
@@ -220,62 +211,61 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
220
211
|
return `\nA PREVIOUS PR summary was archived to ${archive} when the last ${retryCommand} consumed it.\n` + `That file is for AUDIT ONLY — it describes code this branch has since moved past. Write a fresh one:`;
|
|
221
212
|
}
|
|
222
213
|
// Names summary.json when the author wrote its OLD name (review.json until #1033 — refused by Claude
|
|
223
|
-
// auto-mode as Self-Approval beside the review
|
|
214
|
+
// auto-mode as Self-Approval beside the review-round<N>-<id>.json verdicts). HARD CUT: the stale file is never read.
|
|
224
215
|
renamedFileHint(filePath) {
|
|
225
216
|
const stale = path.join(path.dirname(filePath), 'review.json');
|
|
226
217
|
if (!fs.existsSync(stale))
|
|
227
218
|
return '';
|
|
228
219
|
return `\n${stale} is IGNORED — the author's file was renamed to summary.json. ` + `Write the same JSON to ${filePath} instead.`;
|
|
229
220
|
}
|
|
230
|
-
// The per-checklist review file path that sits beside summary.json: review-<id>.json.
|
|
231
|
-
checklistResultPath(summaryJsonFilePath, checklistId) {
|
|
232
|
-
return path.join(path.dirname(summaryJsonFilePath), `review-${checklistId}.json`);
|
|
233
|
-
}
|
|
234
221
|
/**
|
|
235
|
-
*
|
|
222
|
+
* The per-checklist verdict file for ONE round, beside summary.json: `review-round<N>-<id>.json`.
|
|
236
223
|
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
* one fact worth keeping is "this checklist refused before, here is what it said".
|
|
224
|
+
* Round-numbered (issue #1053) so no round ever overwrites another. The top-level `review-<id>.json` this
|
|
225
|
+
* replaced was overwritten by every submission, and a separate `rounds/<N>/` copy had to be kept in step
|
|
226
|
+
* with it to recover the history: two records of one fact, and the copy was the one an agent could lose.
|
|
241
227
|
*/
|
|
242
|
-
|
|
243
|
-
return
|
|
228
|
+
checklistResultPath(summaryJsonFilePath, checklistId, round) {
|
|
229
|
+
return path.join(path.dirname(summaryJsonFilePath), `${VERDICT_FILE_PREFIX}${round}-${checklistId}.json`);
|
|
244
230
|
}
|
|
245
231
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* The point is the MOVE, exactly as in {@link archiveSummaryJson}. A red verdict left on the live path is
|
|
250
|
-
* re-read by the next run and re-reported as the CURRENT state of the branch, so the branch keeps being
|
|
251
|
-
* refused for a finding that may already be fixed — and the fix, when it comes, silently overwrites the
|
|
252
|
-
* only record that the gate ever refused anything. Moving it makes the refusal durable and makes a fresh
|
|
253
|
-
* reviewer run the only way forward, which is the honest requirement: the old verdict judged code that
|
|
254
|
-
* has since changed.
|
|
255
|
-
*
|
|
256
|
-
* Safe by construction for RED verdicts specifically, which is why the caller only archives on CK_FAIL:
|
|
257
|
-
* a red verdict is never reusable — it always blocks — so nothing is lost by moving it. Green and yellow
|
|
258
|
-
* verdicts ARE deliberately reused across finish attempts, and retiring one would force a needless (and
|
|
259
|
-
* expensive) subagent re-run.
|
|
232
|
+
* The HIGHEST round a verdict was submitted in for one checklist, or 0 when it has none. The live verdict
|
|
233
|
+
* is always that one; every lower round is history. Derived from the files present, so there is no
|
|
234
|
+
* counter to drift from them.
|
|
260
235
|
*/
|
|
261
|
-
|
|
262
|
-
const
|
|
263
|
-
if (!fs.existsSync(
|
|
264
|
-
return
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
236
|
+
latestVerdictRound(summaryJsonFilePath, checklistId) {
|
|
237
|
+
const dir = path.dirname(summaryJsonFilePath);
|
|
238
|
+
if (!fs.existsSync(dir))
|
|
239
|
+
return 0;
|
|
240
|
+
const pattern = new RegExp(`^${VERDICT_FILE_PREFIX}(\\d+)-${this.escapeRegExp(checklistId)}\\.json$`);
|
|
241
|
+
let latest = 0;
|
|
242
|
+
for (const name of fs.readdirSync(dir)) {
|
|
243
|
+
const match = pattern.exec(name);
|
|
244
|
+
if (match !== null)
|
|
245
|
+
latest = Math.max(latest, Number(match[1]));
|
|
246
|
+
}
|
|
247
|
+
return latest;
|
|
248
|
+
}
|
|
249
|
+
/** The verdict file name with the round left as `<N>`, for messages that name it before a round is known. */
|
|
250
|
+
checklistResultPathTemplate(summaryJsonFilePath, checklistId) {
|
|
251
|
+
return path.join(path.dirname(summaryJsonFilePath), this.checklistFileName(checklistId));
|
|
252
|
+
}
|
|
253
|
+
/** The live (highest-round) verdict file for one checklist, or '' when none was ever submitted. */
|
|
254
|
+
latestChecklistResultPath(summaryJsonFilePath, checklistId) {
|
|
255
|
+
const round = this.latestVerdictRound(summaryJsonFilePath, checklistId);
|
|
256
|
+
return round === 0 ? '' : this.checklistResultPath(summaryJsonFilePath, checklistId, round);
|
|
257
|
+
}
|
|
258
|
+
escapeRegExp(text) {
|
|
259
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
270
260
|
}
|
|
271
261
|
/**
|
|
272
262
|
* Load + validate the AI-authored summary.json. Throws InformAiError (with the schema) when missing,
|
|
273
263
|
* unparseable, or structurally wrong. `required` is the set of checklists the diff matched: every one
|
|
274
|
-
* must have a well-formed, passing (or overridden) review
|
|
264
|
+
* must have a well-formed, passing (or overridden) review-round<N>-<id>.json or a validation error is raised
|
|
275
265
|
* alongside the usual ones so the AI gets ONE message.
|
|
276
266
|
*/
|
|
277
267
|
// webpieces-disable max-lines-new-methods -- one cohesive load+validate pass over the review fields
|
|
278
|
-
loadSummaryJson(filePath, required = [], expectedMainAgentInstructions = '',
|
|
268
|
+
loadSummaryJson(filePath, required = [], expectedMainAgentInstructions = '', orangeFixes = {}, retryCommand = 'pnpm wp-finish-upsert-pr') {
|
|
279
269
|
const raw = this.readSummaryObject(filePath, expectedMainAgentInstructions, retryCommand);
|
|
280
270
|
const errors = [];
|
|
281
271
|
for (const field of ['agent', 'model']) {
|
|
@@ -298,7 +288,7 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
298
288
|
const mainAgentInstructions = this.validateMainAgentInstructions(raw, expectedMainAgentInstructions, errors);
|
|
299
289
|
const results = this.loadChecklistResults(filePath, required);
|
|
300
290
|
for (const result of results)
|
|
301
|
-
result.remediation =
|
|
291
|
+
result.remediation = orangeFixes[result.id] ?? '';
|
|
302
292
|
for (const err of this.requiredChecklistErrors(required, results, filePath))
|
|
303
293
|
errors.push(err);
|
|
304
294
|
this.assertValidSummary(errors, filePath, expectedMainAgentInstructions, retryCommand);
|
|
@@ -332,7 +322,7 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
332
322
|
return actual;
|
|
333
323
|
}
|
|
334
324
|
/**
|
|
335
|
-
* The checklists that still OWE a verdict: no review
|
|
325
|
+
* The checklists that still OWE a verdict: no review-round<N>-<id>.json at all, a malformed one, or one whose
|
|
336
326
|
* verdict is an un-overridden FAIL. This is the set every message lists — a checklist already PASSed or
|
|
337
327
|
* OVERRIDDEN on this branch is deliberately NOT re-listed, because re-instructing it invites a redundant
|
|
338
328
|
* second run and reads as though the earlier verdict did not count.
|
|
@@ -343,9 +333,29 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
343
333
|
// CK_WARN must be listed here beside PASS/OVERRIDDEN. A yellow verdict SHIPS — leaving it out
|
|
344
334
|
// would mark the checklist owed forever, so `outstanding` never empties and the PR is refused
|
|
345
335
|
// permanently no matter how many times the reviewer runs.
|
|
346
|
-
return status !== review_json_data_1.CK_PASS && status !== review_json_data_1.CK_WARN && status !== review_json_data_1.CK_OVERRIDDEN && status !== review_json_data_1.
|
|
336
|
+
return status !== review_json_data_1.CK_PASS && status !== review_json_data_1.CK_WARN && status !== review_json_data_1.CK_OVERRIDDEN && status !== review_json_data_1.CK_ORANGE_FIXED;
|
|
347
337
|
});
|
|
348
338
|
}
|
|
339
|
+
/**
|
|
340
|
+
* The checklists whose latest verdict is ORANGE with no recorded author fix (issue #1053): a final-round
|
|
341
|
+
* must-fix. A strict subset of {@link pendingChecklists}, split out because its cure is neither a
|
|
342
|
+
* reviewer nor an override: the author fixes the code and records it with `wp-write-review-fixes`.
|
|
343
|
+
*/
|
|
344
|
+
orangeChecklists(required, results) {
|
|
345
|
+
return required.filter((req) => this.resolveVerdict(req, results).status === review_json_data_1.CK_ORANGE);
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* THE renderer for "this final-round reviewer marked ORANGE": the finding verbatim, then the ONE way past
|
|
349
|
+
* it. There is no re-review to ask for: the round cap is spent, and an orange is the reviewer saying so.
|
|
350
|
+
*/
|
|
351
|
+
orangeError(req, verdict) {
|
|
352
|
+
const finding = `${verdict.detail.split('\n').join('\n ')}\n`;
|
|
353
|
+
return `Checklist "${req.id}" is ORANGE — a final-round MUST-FIX that is never re-reviewed. The reviewer (${req.reviewer.agentName}) wrote:\n `
|
|
354
|
+
+ finding
|
|
355
|
+
+ ' Fix it in the code, best effort, and commit the fix. Then record it with pnpm wp-write-review-fixes\n'
|
|
356
|
+
+ ` (one response {checklistId: "${req.id}", resolution, files}) and re-run. Do NOT spawn a reviewer for it:\n`
|
|
357
|
+
+ ' that was the last review round, and no further verdict can be recorded.\n';
|
|
358
|
+
}
|
|
349
359
|
/**
|
|
350
360
|
* The OPTIONAL checklists (`required: false`) that matched the diff but have no verdict file at all.
|
|
351
361
|
*
|
|
@@ -390,23 +400,15 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
390
400
|
* JSON. The ship-anyway route is now a SEPARATE file the coordinating agent may write, and the command
|
|
391
401
|
* that writes it is printed ready to run. See {@link ChecklistOverrideService.writerRule}.
|
|
392
402
|
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
* retirement, and a human who already decided to accept this checklist is never asked again.
|
|
403
|
+
* A red verdict is never moved or deleted (issue #1053): the next round's verdict is a NEW file,
|
|
404
|
+
* `review-round<N+1>-<id>.json`, and the gate reads the highest round, so the refusal stays on disk as the
|
|
405
|
+
* record of what was found.
|
|
397
406
|
*/
|
|
398
|
-
|
|
399
|
-
refusalError(req, verdict, summaryJsonFilePath, archivedPath = '') {
|
|
407
|
+
refusalError(req, verdict, summaryJsonFilePath) {
|
|
400
408
|
const finding = `${verdict.detail.split('\n').join('\n ')}\n`;
|
|
401
409
|
const head = `Checklist "${req.id}" FAILED review (status:"${review_json_data_1.VERDICT_RED}"). The reviewer (${req.reviewer.agentName}) wrote:\n ` + finding;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
: // Re-spawning is said only after the finding, because an instruction to spawn a subagent is the
|
|
405
|
-
// one line an AI acts on first — see refusedChecklists for what that cost.
|
|
406
|
-
` That verdict has been RETIRED to ${archivedPath} (audit only — it is not a live verdict).\n` +
|
|
407
|
-
` A FRESH ${this.checklistFileName(req.id)} is now required. Fix the finding first, then have the ` +
|
|
408
|
-
`"${req.reviewer.agentName}" subagent review again and write a new verdict.\n`;
|
|
409
|
-
return head + retired + this.overrideRoute(req, summaryJsonFilePath);
|
|
410
|
+
return head + ' Fix it, commit the fix, record it with pnpm wp-write-review-fixes, then re-run pnpm wp-review-upsert-pr.\n'
|
|
411
|
+
+ this.overrideRoute(req, summaryJsonFilePath);
|
|
410
412
|
}
|
|
411
413
|
/**
|
|
412
414
|
* The ship-anyway paragraph: who may authorize, and the exact command that records it.
|
|
@@ -422,30 +424,28 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
422
424
|
' Run exactly this, replacing only the "reason" with what the human actually said:\n\n' +
|
|
423
425
|
`${this.overrides.writeCommand(summaryJsonFilePath, req.id)}\n`);
|
|
424
426
|
}
|
|
425
|
-
// Read the per
|
|
426
|
-
// A
|
|
427
|
-
// one is skipped (
|
|
428
|
-
//
|
|
429
|
-
// It looks up the EXACT `review-<id>.json` name per required id — never a directory scan, never a prefix
|
|
430
|
-
// match. That is what guarantees an archived `review-<id>.json.old` can never resolve as a live verdict:
|
|
431
|
-
// the retired file sits right beside the live path, and a scan that swept the directory would hand a
|
|
432
|
-
// RETIRED refusal (or worse, a retired pass) back as the current state, undoing the whole point of the
|
|
433
|
-
// move in {@link archiveChecklistResult}.
|
|
427
|
+
// Read the LIVE verdict per required checklist: its highest-round `review-round<N>-<id>.json` beside
|
|
428
|
+
// summary.json (issue #1053). A checklist with no verdict file is simply absent from the result (→ MISSING);
|
|
429
|
+
// a malformed one is skipped. The id is matched exactly (see latestVerdictRound), so neither the author's
|
|
430
|
+
// `review-round<N>-fixes.json` nor a provenance file can ever resolve as a verdict.
|
|
434
431
|
loadChecklistResults(summaryJsonFilePath, required) {
|
|
435
432
|
const results = [];
|
|
436
433
|
for (const req of required) {
|
|
437
|
-
const
|
|
438
|
-
if (
|
|
434
|
+
const round = this.latestVerdictRound(summaryJsonFilePath, req.id);
|
|
435
|
+
if (round === 0)
|
|
439
436
|
continue;
|
|
437
|
+
const p = this.checklistResultPath(summaryJsonFilePath, req.id, round);
|
|
440
438
|
// The human's authorization is read from its OWN file beside the verdict, in the same pass, so
|
|
441
439
|
// resolveVerdict never touches disk and every command resolves one outcome from one read.
|
|
442
440
|
const parsed = this.parseChecklistResult(p, req.id, this.overrides.load(summaryJsonFilePath, req.id));
|
|
443
|
-
if (parsed)
|
|
444
|
-
|
|
441
|
+
if (parsed === null)
|
|
442
|
+
continue;
|
|
443
|
+
parsed.round = round;
|
|
444
|
+
results.push(parsed);
|
|
445
445
|
}
|
|
446
446
|
return results;
|
|
447
447
|
}
|
|
448
|
-
// Resolve ONE checklist's verdict from its review
|
|
448
|
+
// Resolve ONE checklist's verdict from its review-round<N>-<id>.json. Central so summary.json enforcement AND the
|
|
449
449
|
// finish-command dashboard agree on the outcome. `problem` is checked FIRST: a file whose verdict cannot
|
|
450
450
|
// be read must not fall through to any shipping outcome.
|
|
451
451
|
resolveVerdict(req, results) {
|
|
@@ -458,8 +458,13 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
458
458
|
return new review_json_data_1.ChecklistVerdict(req.id, review_json_data_1.CK_PASS, result.output);
|
|
459
459
|
if (result.status === review_json_data_1.VERDICT_YELLOW)
|
|
460
460
|
return new review_json_data_1.ChecklistVerdict(req.id, review_json_data_1.CK_WARN, result.output);
|
|
461
|
-
|
|
462
|
-
|
|
461
|
+
// An ORANGE ships once the author has recorded a fix for it, and ONLY that way: it is the final
|
|
462
|
+
// round's must-fix, so there is no re-review to wait for and no override to hunt (issue #1053).
|
|
463
|
+
if (result.status === review_json_data_1.VERDICT_ORANGE) {
|
|
464
|
+
return result.remediation !== ''
|
|
465
|
+
? new review_json_data_1.ChecklistVerdict(req.id, review_json_data_1.CK_ORANGE_FIXED, result.remediation)
|
|
466
|
+
: new review_json_data_1.ChecklistVerdict(req.id, review_json_data_1.CK_ORANGE, result.output);
|
|
467
|
+
}
|
|
463
468
|
const override = result.override;
|
|
464
469
|
// A malformed authorization is reported as a FORMAT problem, never treated as one: an override with
|
|
465
470
|
// no stated reason authorizes nothing, and silently ignoring it would tell the reader their decision
|
|
@@ -487,7 +492,7 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
487
492
|
return errors;
|
|
488
493
|
}
|
|
489
494
|
// Every matched checklist whose verdict is FAIL (reviewed, found a problem, no override) or MISSING (no
|
|
490
|
-
// review
|
|
495
|
+
// review-round<N>-<id>.json written) → one error each, printing the reviewer's `output` verbatim.
|
|
491
496
|
requiredChecklistErrors(required, results, filePath) {
|
|
492
497
|
// Format complaints come from the ONE renderer, so wp-review-upsert-pr and wp-finish word them identically.
|
|
493
498
|
const errors = this.checklistFormatErrors(required, results);
|
|
@@ -497,9 +502,11 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
497
502
|
// The concern still reaches the PR, published in the checklist comment. Do not "fix" this.
|
|
498
503
|
if (verdict.status === review_json_data_1.CK_FAIL) {
|
|
499
504
|
// Through the ONE renderer, so this path and the command layer's refusal say the same thing.
|
|
500
|
-
// No archive path here: this is validation, not the act of retiring the verdict.
|
|
501
505
|
errors.push(this.refusalError(req, verdict, filePath));
|
|
502
506
|
}
|
|
507
|
+
else if (verdict.status === review_json_data_1.CK_ORANGE) {
|
|
508
|
+
errors.push(this.orangeError(req, verdict));
|
|
509
|
+
}
|
|
503
510
|
else if (verdict.status === review_json_data_1.CK_MISSING) {
|
|
504
511
|
// An OPTIONAL checklist with no verdict was legitimately not run — the human was offered it
|
|
505
512
|
// and declined (or `--no-optional` skipped the offer). Demanding it here would make
|
|
@@ -514,7 +521,7 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
514
521
|
return errors;
|
|
515
522
|
}
|
|
516
523
|
checklistFileName(checklistId) {
|
|
517
|
-
return
|
|
524
|
+
return `${VERDICT_FILE_PREFIX}<N>-${checklistId}.json`;
|
|
518
525
|
}
|
|
519
526
|
/**
|
|
520
527
|
* THE renderer for a reviewer's verdict schema — with the reviewer's own `id` already filled in.
|
|
@@ -586,7 +593,7 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
586
593
|
if (review_json_data_1.VERDICT_STATUSES.includes(status))
|
|
587
594
|
return '';
|
|
588
595
|
if ('success' in raw) {
|
|
589
|
-
return `Checklist "${id}" wrote its verdict with the REMOVED "success" field. It is now a
|
|
596
|
+
return `Checklist "${id}" wrote its verdict with the REMOVED "success" field. It is now a color ` + `"status" — there is no compatibility mode. Resubmit it as:\n${shape}`;
|
|
590
597
|
}
|
|
591
598
|
return `Checklist "${id}" wrote a verdict with no valid "status" (got ${JSON.stringify(status)}). ` + `It must be exactly one of ${review_json_data_1.VERDICT_STATUSES.join(', ')}:\n${shape}`;
|
|
592
599
|
}
|