@webpieces/pr-gate 0.4.825 → 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.
Files changed (56) hide show
  1. package/package.json +3 -3
  2. package/src/dashboard/checklist-comment-renderer.js +8 -6
  3. package/src/dashboard/checklist-comment-renderer.js.map +1 -1
  4. package/src/dashboard/checklist-comment-row.d.ts +6 -0
  5. package/src/dashboard/checklist-comment-row.js +6 -0
  6. package/src/dashboard/checklist-comment-row.js.map +1 -1
  7. package/src/dashboard/dashboard.d.ts +11 -0
  8. package/src/dashboard/dashboard.js +24 -6
  9. package/src/dashboard/dashboard.js.map +1 -1
  10. package/src/scripts/commands/await-reviews-command.d.ts +3 -3
  11. package/src/scripts/commands/await-reviews-command.js +25 -21
  12. package/src/scripts/commands/await-reviews-command.js.map +1 -1
  13. package/src/scripts/commands/finish-upsert-pr-command.js +26 -21
  14. package/src/scripts/commands/finish-upsert-pr-command.js.map +1 -1
  15. package/src/scripts/commands/review-upsert-pr-command.d.ts +3 -8
  16. package/src/scripts/commands/review-upsert-pr-command.js +16 -18
  17. package/src/scripts/commands/review-upsert-pr-command.js.map +1 -1
  18. package/src/scripts/commands/write-review-command.d.ts +43 -7
  19. package/src/scripts/commands/write-review-command.js +91 -12
  20. package/src/scripts/commands/write-review-command.js.map +1 -1
  21. package/src/scripts/commands/write-review-fixes-command.d.ts +5 -1
  22. package/src/scripts/commands/write-review-fixes-command.js +6 -2
  23. package/src/scripts/commands/write-review-fixes-command.js.map +1 -1
  24. package/src/scripts/pr-gate-app.d.ts +3 -1
  25. package/src/scripts/pr-gate-app.js +4 -0
  26. package/src/scripts/pr-gate-app.js.map +1 -1
  27. package/src/scripts/workflow/checklist-scanner.d.ts +61 -10
  28. package/src/scripts/workflow/checklist-scanner.js +105 -16
  29. package/src/scripts/workflow/checklist-scanner.js.map +1 -1
  30. package/src/scripts/workflow/hotfix-finish-preparer.js +1 -1
  31. package/src/scripts/workflow/hotfix-finish-preparer.js.map +1 -1
  32. package/src/scripts/workflow/provenance-enforcer.d.ts +2 -2
  33. package/src/scripts/workflow/provenance-enforcer.js +5 -5
  34. package/src/scripts/workflow/provenance-enforcer.js.map +1 -1
  35. package/src/scripts/workflow/review-report.d.ts +26 -8
  36. package/src/scripts/workflow/review-report.js +65 -39
  37. package/src/scripts/workflow/review-report.js.map +1 -1
  38. package/src/scripts/workflow/review-round-state.d.ts +90 -11
  39. package/src/scripts/workflow/review-round-state.js +256 -85
  40. package/src/scripts/workflow/review-round-state.js.map +1 -1
  41. package/src/scripts/workflow/review-round-text.d.ts +37 -0
  42. package/src/scripts/workflow/review-round-text.js +87 -0
  43. package/src/scripts/workflow/review-round-text.js.map +1 -0
  44. package/src/scripts/workflow/review-stage-receipt.d.ts +7 -6
  45. package/src/scripts/workflow/review-stage-receipt.js +7 -11
  46. package/src/scripts/workflow/review-stage-receipt.js.map +1 -1
  47. package/src/scripts/workflow/reviewer-briefing-builder.js +0 -1
  48. package/src/scripts/workflow/reviewer-briefing-builder.js.map +1 -1
  49. package/src/scripts/workflow/reviewer-verdict-gate.d.ts +14 -26
  50. package/src/scripts/workflow/reviewer-verdict-gate.js +38 -51
  51. package/src/scripts/workflow/reviewer-verdict-gate.js.map +1 -1
  52. package/src/scripts/workflow/verdict-provenance.d.ts +13 -7
  53. package/src/scripts/workflow/verdict-provenance.js +30 -22
  54. package/src/scripts/workflow/verdict-provenance.js.map +1 -1
  55. package/src/scripts/wp-write-review.js +7 -0
  56. package/src/scripts/wp-write-review.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/dashboard/dashboard.ts"],"names":[],"mappings":";;;;AAAA,yEAAoE;AACpE,0DAAiQ;AACjQ,yCAA2D;AAG3D;;;;;;;GAOG;AACU,QAAA,qBAAqB,GAAG,iCAAiC,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,qBAAqB,GAAG,8EAA8E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EO,WAAW,CAAC,QAAuB;QACvC,IAAI,QAAQ,CAAC,cAAc,KAAK,CAAC;YAAE,OAAO,qCAAqC,CAAC;QAChF,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnG,OAAO,oCAAoC,QAAQ,CAAC,cAAc,WAAW,KAAK,EAAE,CAAC;IACzF,CAAC;CACJ,CAAA;AAraY,8BAAS;oBAAT,SAAS;IADrB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,SAAS,CAqarB","sourcesContent":["import { ReviewIdentityRenderer } from './review-identity-renderer';\nimport { GateDefinition, WEBPIECES_DISABLE, RULE_NAMES, PrSummary, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_REMEDIATED, CK_FAIL, CK_MISSING, HOME_CONFIG_DIR, HOME_CONFIG_FILE, HOME_KEY_TURN_OFF_ALL_REVIEWERS, HOTFIX_AUDIT_BANNER } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AuthorIdentity } from './author-identity';\n\n/**\n * Hidden marker on the FULL-DASHBOARD comment — the \"1st comment\" the PR description points at — so\n * finish PATCHes its own comment on every push instead of appending a new one, exactly like the checklist\n * comment (see ChecklistCommentRenderer, which owns the 2nd).\n *\n * This comment did not exist before the PR description became the git-log body: the dashboard WAS the\n * description. Moving it here is what keeps a risk table out of every squash commit on main.\n */\nexport const DETAIL_COMMENT_MARKER = '<!-- webpieces-pr-detail v1 -->';\n\n/**\n * Footer on the full-dashboard comment. Names the tooling by REPO URL so a reader landing on a\n * generated comment in any consumer repo can find what generated it.\n *\n * It deliberately no longer asserts \"build ran via nx affected — not self-attested\": that sentence was\n * hard-coded and therefore wrong on every repo whose `buildCommand` is not nx. The build command is now\n * named for real, from config, in the PR-body footer — see {@link Dashboard.renderPrBody}.\n */\nconst DETAIL_COMMENT_FOOTER = 'Generated by https://github.com/deanhiller/webpieces-ts wp-finish-upsert-pr';\n\n/**\n * The last bullet of the PR description, and therefore of every squash commit body.\n *\n * Positional (\"1st\"/\"2nd\") on purpose — it is what a reader of `git log` can actually act on, far more\n * useful than naming an HTML marker they cannot see. On a PR opened by an OLDER release the checklist\n * comment already exists, so the dashboard comment lands second and this reads one off for that PR's\n * remaining life; it is cosmetic and self-corrects on the next PR.\n */\nconst DETAIL_POINTER = '(Full dashboard in 1st comment, reviewer checklist in 2nd — kept out of git log)';\n\nexport class GateResult {\n name: string;\n warningColor: string; // 'yellow' | 'red' — the color shown WHEN files matched (green is implicit)\n matchedFiles: string[];\n\n constructor(name: string, warningColor: string, matchedFiles: string[]) {\n this.name = name;\n this.warningColor = warningColor;\n this.matchedFiles = matchedFiles;\n }\n}\n\n// One row for a consumer review checklist the branch triggered. `status` is the resolved verdict (one of\n// CK_PASS | CK_WARN | CK_OVERRIDDEN | CK_FAIL | CK_MISSING | CK_BAD_FORMAT); `detail` is the reviewer\n// output / override justification. A row is always PASS/WARN/OVERRIDDEN by the time it renders — a failed,\n// missing or unreadable verdict throws before the dashboard is built. Rendered into the PR body so the\n// verdict reaches the server — the PR body is the artifact of the local flow that leaves the checkout\n// (alongside the HMAC gate token that proves the flow ran).\nexport class ChecklistRow {\n title: string; // the checklist id (= reviewer subagent name)\n status: string; // CK_* verdict\n detail: string; // reviewer output / override justification (surfaced for OVERRIDDEN)\n\n constructor(title: string, status: string, detail = '') {\n this.title = title;\n this.status = status;\n this.detail = detail;\n }\n}\n\n/**\n * One severity bucket of the rolled-up **Checklists** dashboard row: its emoji, the words that describe it,\n * and which checklists landed in it. Data-only.\n *\n * A bucket knows whether it should NAME its members: the non-green ones do (a reader has to know WHICH\n * reviewer to go read), the passed bucket does not (a list of what went fine is noise on a one-line row).\n */\nclass RollupBucket {\n label: string; // 'blocking' | 'overridden' | 'with concerns' | 'passed'\n emoji: string;\n named: boolean; // list the checklist ids on the row, or report a bare count\n titles: string[];\n\n constructor(label: string, emoji: string, named: boolean) {\n this.label = label;\n this.emoji = emoji;\n this.named = named;\n this.titles = [];\n }\n}\n\nexport class DisableCounts {\n webpiecesCount: number;\n eslintCount: number;\n webpiecesRules: string[];\n\n constructor(webpiecesCount: number, eslintCount: number, webpiecesRules: string[]) {\n this.webpiecesCount = webpiecesCount;\n this.eslintCount = eslintCount;\n this.webpiecesRules = webpiecesRules;\n }\n}\n\nexport class DashboardInput {\n title: string;\n gateResults: GateResult[];\n disables: DisableCounts;\n buildPassed: boolean;\n forkPoint: string;\n featureHead: string;\n mainHead: string;\n review: PrSummary; // AI-authored risk/violations/summary (from summary.json)\n checklists: ChecklistRow[]; // consumer checklists this branch triggered; [] for non-adopting repos\n /**\n * `commands.pr-gate.buildCommand` VERBATIM, named in the PR-body footer so `git log` records WHICH\n * command vouched for the commit. Read from config rather than hard-coded because the footer used to\n * assert \"build ran via nx affected\" on every repo, including those whose buildCommand is not nx.\n *\n * REQUIRED, with no default, and `checklists` lost its `= []` for the same reason. A defaulted\n * `buildCommand: string = ''` let every pre-existing 9-argument construction keep compiling while\n * silently rendering a footer that claims nothing — an absence that quietly means \"no build was\n * named\", which is the widening-by-omission the compatibility policy calls out. Making it required\n * means every caller states what vouched for the commit, and the empty string stays available for a\n * repo that genuinely has no build command, but only when someone writes it down.\n */\n buildCommand: string;\n /**\n * How many checklists WOULD have run but were disabled by either the project policy\n * (`reviewerAgents: 0`) or the machine kill switch — required ones included. `0` means no matching\n * checklist was suppressed; it is NOT a way of saying \"no checklist matched\", which\n * `checklists.length === 0` already says.\n *\n * The two states are byte-identical in `checklists` (both empty) and that is precisely the defect this\n * field closes: without it, a PR whose four REQUIRED reviewers were switched off is indistinguishable\n * in `main`'s history from a docs-only typo fix that legitimately matched nothing. REQUIRED with no\n * default, for the reason `buildCommand` is: a defaulted `0` would let every existing construction\n * keep compiling while asserting, silently, that nothing was suppressed.\n */\n suppressedChecklistCount: number;\n author: AuthorIdentity;\n hotfix: boolean;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n title: string,\n gateResults: GateResult[],\n disables: DisableCounts,\n buildPassed: boolean,\n forkPoint: string,\n featureHead: string,\n mainHead: string,\n review: PrSummary,\n checklists: ChecklistRow[],\n buildCommand: string,\n suppressedChecklistCount: number,\n author: AuthorIdentity,\n hotfix: boolean,\n ) {\n this.title = title;\n this.gateResults = gateResults;\n this.disables = disables;\n this.buildPassed = buildPassed;\n this.forkPoint = forkPoint;\n this.featureHead = featureHead;\n this.mainHead = mainHead;\n this.review = review;\n this.checklists = checklists;\n this.buildCommand = buildCommand;\n this.suppressedChecklistCount = suppressedChecklistCount;\n this.author = author;\n this.hotfix = hotfix;\n }\n}\n\n/** Renders the PR-gate dashboard markdown (gates × changed files, disables, risk, 3-point hashes). */\n@injectable(bindingScopeValues.Singleton)\nexport class Dashboard {\n // Disabled gates are in-file examples (JSON has no comments) — skip them entirely.\n computeGateResults(gates: GateDefinition[], changedFiles: string[]): GateResult[] {\n return gates\n .filter((gate: GateDefinition): boolean => !gate.disabled)\n .map((gate: GateDefinition): GateResult => {\n const matched = changedFiles.filter((file: string): boolean => this.matchesAny(gate.patterns, file));\n return new GateResult(gate.name, gate.warningColor, matched);\n });\n }\n\n // Count disables ADDED in this PR by scanning added (`+`) lines of the diff patch. Rule-aware:\n // reports which webpieces rules were disabled, using the canonical RULE_NAMES vocabulary.\n countAddedDisables(patch: string): DisableCounts {\n let webpiecesCount = 0;\n let eslintCount = 0;\n const rules = new Set<string>();\n const allRuleTokens = Object.keys(RULE_NAMES).map((key: string): string => (RULE_NAMES as Record<string, string>)[key]);\n\n for (const line of patch.split('\\n')) {\n if (!line.startsWith('+') || line.startsWith('+++')) continue;\n if (line.includes(WEBPIECES_DISABLE)) {\n webpiecesCount += 1;\n for (const token of allRuleTokens) {\n if (line.includes(token)) rules.add(token);\n }\n }\n if (line.includes('eslint-disable')) eslintCount += 1;\n }\n return new DisableCounts(webpiecesCount, eslintCount, Array.from(rules).sort());\n }\n\n /**\n * The FULL dashboard — every row (green included), the whole summary, the 3-point hash points.\n *\n * This is the **1st PR comment**, not the PR description. It used to be the description, and that is\n * exactly what put it into main's history: GitHub's `squash_merge_commit_message: PR_BODY` copies the\n * description verbatim into the squash commit, so every `git log` entry carried the risk table, the\n * hash points and the gate token. The description now holds {@link renderPrBody}'s compact form, and\n * everything long-form lives here where a reader can open it and `git log` never sees it.\n *\n * Machine-facing content belongs HERE too — this comment carries the HMAC gate token. That is the\n * whole rule that keeps the description clean: an HTML comment is invisible in rendered markdown but\n * perfectly visible in `git log`, so nothing hidden may live in the description.\n */\n renderDetailComment(input: DashboardInput): string {\n const lines: string[] = [];\n if (input.hotfix) {\n lines.push(HOTFIX_AUDIT_BANNER, '');\n }\n lines.push('## 🚦 PR Gate Dashboard');\n lines.push('');\n for (const line of this.riskLines(input.review)) lines.push(line);\n lines.push(new ReviewIdentityRenderer().renderAuthor(input.author.harness, input.author.model));\n lines.push(`**Build (${input.hotfix ? 'hotfix-ci: build + test only' : 'nx affected'}):** ${input.buildPassed ? '🟢 Passed' : '🔴 Failed'}`);\n for (const result of input.gateResults) lines.push(this.gateLine(result));\n lines.push(this.disableLine(input.disables));\n const eslintEmoji = input.disables.eslintCount === 0 ? '🟢 No' : `🟡 ${input.disables.eslintCount} line(s)`;\n lines.push(`**ESLint Disables Added:** ${eslintEmoji}`);\n // ONE rolled-up row for ALL triggered consumer checklists — a worst-of colour and a count, sitting\n // with the other status rows. It used to be one row PER checklist, each inlining that checklist's\n // whole verdict/override paragraph: on a six-checklist PR that was the same ~90-word override\n // repeated six times, burying the signal rows above it — and every word of it was already in the\n // checklist COMMENT, per reviewer, in full. ALWAYS emitted, including the zero case: \"no reviewer\n // looked at this PR\" is a fact a reader must be told, and an absent row silently reads as a green\n // all-clear (see checklistRollupLine).\n lines.push(input.hotfix ? '**Checklists:** ⚫ BYPASSED by /hotfix/ convention · 0 reviewer agents ran' : this.checklistRollupLine(input.checklists, input.suppressedChecklistCount));\n lines.push('');\n if (input.review.summary.trim() !== '') {\n lines.push('### Summary');\n lines.push(input.review.summary.trim());\n lines.push('');\n }\n lines.push('### 🔍 3-Point Hash Points');\n lines.push(`- Fork point (A): \\`${input.forkPoint.slice(0, 12)}\\``);\n lines.push(`- Feature HEAD (B): \\`${input.featureHead.slice(0, 12)}\\``);\n lines.push(`- Main HEAD (C): \\`${input.mainHead.slice(0, 12)}\\``);\n lines.push('');\n lines.push(`<sub>🤖 ${DETAIL_COMMENT_FOOTER}</sub>`);\n return lines.join('\\n');\n }\n\n /**\n * The PR DESCRIPTION — which is also, byte for byte, the squash-commit body that lands in main.\n *\n * ─── Why one string serves both ─────────────────────────────────────────────────────────────────\n * There used to be two: a long dashboard in the description and this compact form passed to\n * `gh pr merge --body-file`. That made the good `git log` reachable ONLY through an explicit\n * `--body-file` merge, because every other route (the GitHub Merge button, a bare `gh pr merge`)\n * takes its body from the repo's `squash_merge_commit_message`, and on `PR_BODY` that copied the\n * whole dashboard into history. Two repos ran that way for months.\n *\n * Making the DESCRIPTION the compact form inverts it: `PR_BODY` now yields exactly the right commit,\n * so the UI button, a bare `gh pr merge`, `wp-land-pr` and finish's own auto-merge all converge on\n * identical bytes. It rests on two GitHub repo settings — `squash_merge_commit_title: PR_TITLE` and\n * `squash_merge_commit_message: PR_BODY` — which are NOT a consumer's job: they are server-side, so no\n * config key can express them, and SquashSettingsEnforcer pins them on every run. That convergence is\n * the point, and `pr-body-is-merge-body.spec.ts` pins it.\n *\n * ─── The shape, and why each part earns its line ────────────────────────────────────────────────\n * The URL leads, BARE — no caption. It used to carry `(for git log)`, which was aimed at a reader on\n * the PR page (where the link is redundant, being the page you are already on) and was meant to stop\n * them deleting it. But this string is also the squash-commit body, so that caption landed verbatim in\n * `main`'s history on every commit, forever, to serve one transient reading. In `git log` a bare URL\n * is self-evidently the way back and needs no explanation. The permanent surface wins.\n * Then the risk score (always). Then ONLY the non-green flags, under a heading that SAYS the full list\n * is in the 1st comment — a `git log` reader has no page to glance at, so the heading has to carry\n * that itself rather than leaving \"why is this list short?\" to the pointer bullet alone. Then the\n * summary capped at 4 sentences, then the footer naming the build command that vouched for it.\n *\n * The hidden gate-token marker is appended AFTER this by the caller, so it is the very last line of\n * the description and therefore of the commit. It stays an HTML comment — invisible on the PR page,\n * visible in `git log` — which is a deliberate accepted trade: the alternative was reshaping a live\n * CI-critical surface that two consumer repos verify on every PR, to save one line of history.\n */\n renderPrBody(input: DashboardInput, prUrl: string): string {\n const lines: string[] = [];\n if (input.hotfix) {\n lines.push(HOTFIX_AUDIT_BANNER, '');\n }\n if (prUrl !== '') {\n lines.push(prUrl);\n lines.push('');\n }\n lines.push(`Risk: ${this.riskBar(input.review.riskScore)} ${input.review.riskScore}/100 ${input.review.riskEmoji} (${input.review.riskLevel})`);\n lines.push(new ReviewIdentityRenderer().renderAuthor(input.author.harness, input.author.model, false));\n lines.push('');\n const flags = this.nonGreenFlags(input);\n lines.push(flags.length === 0 ? 'Flags: 🟢 all green' : 'Non-green Flags (full list in first comment to avoid large git logs)');\n for (const flag of flags) lines.push(`- ${flag}`);\n // ALWAYS the last bullet, green case included. Without it the compact body reads as the whole\n // record, and the reader never learns that every green row, the full summary and each reviewer's\n // output are one click away.\n lines.push(`- ${DETAIL_POINTER}`);\n const summary = this.firstSentences(input.review.summary.trim(), 4);\n if (summary !== '') {\n lines.push('');\n lines.push(summary);\n }\n lines.push('');\n lines.push(this.prBodyFooter(input.buildCommand));\n return this.gitLogSafe(lines.join('\\n'));\n }\n\n /**\n * Makes THIS renderer own the invariant `wp-land-pr` checks: the compact body carries no markdown\n * heading and no table pipe.\n *\n * It is applied to the WHOLE joined string rather than to each author-supplied field, on purpose.\n * Every field this body interpolates — the review summary, an override justification, a checklist\n * title, a disabled rule name, `commands.pr-gate.buildCommand` — is text this package did not write,\n * and a `|` reaches all of them for entirely ordinary non-markdown reasons: a TypeScript union\n * (`'open' | 'paused'`), a regex alternation, a quoted shell pipeline, an OR in prose. Sanitizing at\n * the single exit point means a field added later is covered without anyone remembering to wrap it,\n * and none of this renderer's own literals contain either marker, so nothing of ours changes.\n *\n * Before this, `wp-finish-upsert-pr` would happily POST such a body and report success, and then\n * `wp-land-pr` refused those exact bytes — two commands in one flow disagreeing about what the\n * renderer produces, with a refusal that blamed an old release and prescribed re-running finish,\n * which re-rendered the identical pipe from the unchanged `summary.json`. An infinite loop costing a\n * CI cycle per turn.\n *\n * `¦` (BROKEN BAR) rather than `\\|`: this string's home is `git log` in a terminal, where a\n * backslash is literal punctuation and a markdown escape means nothing. The substitution is visible\n * and reads correctly; the full, unaltered text is one click away in the 1st comment, which this\n * body's last bullet always points at. `##` collapses to `#` for the same reason — a heading in a\n * summary is markdown a plain-text history cannot carry either.\n */\n private gitLogSafe(body: string): string {\n return body.replace(/\\|/g, '\\u00a6').replace(/#{2,}/g, '#');\n }\n\n /**\n * The footer, naming the build command from `commands.pr-gate.buildCommand` VERBATIM.\n *\n * No backticks: this string's primary home is `git log` in a terminal, where markdown ticks are\n * literal punctuation. \"run locally\" is the honest claim — this is the LOCAL gate's receipt, and the\n * server-side proof is the gate token in the 1st comment, not this sentence.\n */\n private prBodyFooter(buildCommand: string): string {\n const cmd = buildCommand.trim();\n const ran = cmd === '' ? '' : ` (${cmd} run locally)`;\n return `Generated by webpieces-ts wp-finish-upsert-pr${ran}`;\n }\n\n // Every dashboard row that is NOT green, as a flat bullet list for the commit body. Green rows\n // (build passed, gate did not match, zero disables/violations) are intentionally omitted.\n private nonGreenFlags(input: DashboardInput): string[] {\n const flags: string[] = [];\n if (input.hotfix) {\n flags.push('⚠️ HOTFIX — reviews, ticket enforcement, Webpieces rules, ESLint, and format checks bypassed; compilation and tests ran');\n }\n if (!input.buildPassed) flags.push('Build (nx affected): 🔴 Failed');\n if (input.review.violations.length > 0) flags.push(`Pattern Violations: 🟡 ${input.review.violations.length} violation(s)`);\n for (const result of input.gateResults) {\n if (result.matchedFiles.length === 0) continue;\n const emoji = result.warningColor === 'red' ? '🔴' : '🟡';\n flags.push(`${result.name}: ${emoji} ${result.matchedFiles.length} file(s)`);\n }\n if (input.disables.webpiecesCount > 0) {\n const which = input.disables.webpiecesRules.length > 0 ? ` — ${input.disables.webpiecesRules.join(', ')}` : '';\n flags.push(`Webpieces Disables Added: 🟡 ${input.disables.webpiecesCount} line(s)${which}`);\n }\n if (input.disables.eslintCount > 0) flags.push(`ESLint Disables Added: 🟡 ${input.disables.eslintCount} line(s)`);\n // A triggered checklist is noteworthy in main's history — carry each into the commit body.\n //\n // SUPPRESSED replaces those N bullets with exactly ONE, whatever N is. Not because the per-reviewer\n // bullets would lie — `checklistStatusText` was already hardened against a false \"passed\" — but\n // because with the kill switch on there are NO rows at all, and a body with no `Checklist — `\n // bullets is byte-identical to a PR that legitimately matched zero checklists (a docs-only typo\n // fix). Without this line, \"four REQUIRED reviewers were killed by a flag\" and \"nothing applied\n // here\" are indistinguishable in main's history forever. One compact bullet, in the existing\n // style — the loud version belongs in stage ②'s output and the 1st comment, not in `git log`.\n if (input.suppressedChecklistCount > 0) {\n flags.push(`Checklists — ${this.suppressedTail(input.suppressedChecklistCount)}`);\n }\n for (const row of input.checklists) {\n flags.push(`Checklist — ${row.title}: ${this.checklistStatusText(row)}`);\n }\n return flags;\n }\n\n // Emoji + words for a checklist verdict, shared by the dashboard row and the commit-body flag.\n // Every state is matched EXPLICITLY and the fallthrough names the status it did not recognize. The\n // previous `return '🟢 passed'` fallthrough meant any newly-added verdict rendered as a clean pass on\n // both the PR body and main's commit history until someone noticed — exactly the wrong default.\n private checklistStatusText(row: ChecklistRow): string {\n if (row.status === CK_OVERRIDDEN) {\n const why = row.detail.trim() !== '' ? ` — override: ${row.detail.trim()}` : '';\n return `🟠 OVERRIDDEN${why}`;\n }\n if (row.status === CK_REMEDIATED) return `🟠 AUTHOR-REMEDIATED AFTER REVIEW CAP — NOT RE-REVIEWED — ${row.detail}`;\n if (row.status === CK_WARN) return '🟡 passed with concerns';\n if (row.status === CK_FAIL) return '🔴 FAILED review';\n if (row.status === CK_MISSING) return '⚪ not reviewed';\n if (row.status === CK_PASS) return '🟢 passed';\n return `⚪ unknown verdict (${row.status})`;\n }\n\n // First `max` sentences of `text`. A sentence ends at `. ! ?` ONLY when followed by whitespace or\n // end-of-string, so interior dots in filenames/paths/versions (dependencies.json, runtime-graph.ts,\n // 0.4.447) do NOT split — and, unlike a greedy `[^.!?]+` regex, no text is ever dropped when such a\n // dot appears (that footgun silently deleted the run of prose up to the next real boundary). Keeps\n // the commit body scannable; the full summary still lives in the PR-body dashboard.\n private firstSentences(text: string, max: number): string {\n if (text === '') return '';\n const sentences: string[] = [];\n let start = 0;\n for (let i = 0; i < text.length && sentences.length < max; i++) {\n const ch = text[i];\n const isTerminator = ch === '.' || ch === '!' || ch === '?';\n const next = text[i + 1];\n if (isTerminator && (next === undefined || /\\s/.test(next))) {\n sentences.push(text.slice(start, i + 1).trim());\n start = i + 1;\n }\n }\n // Trailing text with no terminator still counts as a sentence (up to the cap).\n if (sentences.length < max && start < text.length) {\n const tail = text.slice(start).trim();\n if (tail !== '') sentences.push(tail);\n }\n return sentences.join(' ').trim();\n }\n\n // Self-contained glob matcher (** , * , ?) so pr-gate needs no extra runtime dependency.\n private globToRegex(pattern: string): RegExp {\n let re = '';\n let i = 0;\n while (i < pattern.length) {\n const ch = pattern[i];\n if (ch === '*' && pattern[i + 1] === '*') {\n re += '.*';\n i += 2;\n if (pattern[i] === '/') i += 1;\n continue;\n }\n if (ch === '*') {\n re += '[^/]*';\n i += 1;\n continue;\n }\n if (ch === '?') {\n re += '[^/]';\n i += 1;\n continue;\n }\n if ('.+^$(){}|[]\\\\'.includes(ch)) {\n re += '\\\\' + ch;\n i += 1;\n continue;\n }\n re += ch;\n i += 1;\n }\n return new RegExp('^' + re + '$');\n }\n\n private matchesAny(patterns: string[], file: string): boolean {\n for (const pattern of patterns) {\n if (this.globToRegex(pattern).test(file)) return true;\n }\n return false;\n }\n\n private gateLine(result: GateResult): string {\n if (result.matchedFiles.length === 0) return `**${result.name}:** 🟢 No`;\n const emoji = result.warningColor === 'red' ? '🔴' : '🟡';\n return `**${result.name}:** ${emoji} Yes (${result.matchedFiles.length} file(s))`;\n }\n\n /**\n * The ONE rolled-up **Checklists:** row, coloured worst-of across every checklist that ran, in the same\n * shape as its neighbours (`**Build (nx affected):** 🟢 Passed`). Counts and names only — never a line\n * of reviewer output or override justification, which is the whole reason this row exists.\n */\n private checklistRollupLine(rows: readonly ChecklistRow[], suppressedCount: number): string {\n // FIRST, and ahead of the zero-ran case below, which would say \"no review checklist matched this\n // PR\" — false here, and the one sentence that would turn a kill switch into an all-clear. ⚫ is a\n // colour no verdict uses, so it cannot be mistaken for a pass, a warning or a refusal.\n if (suppressedCount > 0) return this.suppressedChecklistLine(suppressedCount);\n const buckets = this.rollupBuckets(rows);\n const filled = buckets.filter((b: RollupBucket): boolean => b.titles.length > 0);\n // NO reviewer ran ⇒ the SKIPPED icon, never green. Green claims something was checked and came back\n // clean; ⚪ says nobody looked, which is what a reader has to be able to tell apart at a glance.\n if (filled.length === 0) {\n return '**Checklists:** ⚪ 0 ran — no review checklist matched this PR · see the checklist comment';\n }\n const allPassed = filled.length === 1 && !filled[0].named;\n const detail = allPassed ? 'all passed' : filled.map((b: RollupBucket): string => this.bucketPhrase(b)).join(', ');\n return `**Checklists:** ${filled[0].emoji} ${rows.length} ran — ${detail} · per-checklist detail in the checklist comment`;\n }\n\n /**\n * The four severity buckets, WORST FIRST, so `filled[0]` is the roll-up colour: red beats orange beats\n * yellow beats green. The colours are the same vocabulary the comment already uses (see verdictEmoji).\n *\n * OVERRIDDEN is deliberately NOT folded into passed: an override is a human knowingly accepting a red\n * verdict, and a dashboard that painted that green would hide the single most review-worthy thing on\n * the PR. The blocking bucket is the FALLTHROUGH — CK_FAIL, CK_MISSING, CK_BAD_FORMAT and any verdict\n * added later all land there, matching summary.json's own \"not pass|warn|overridden ⇒ refuse\" rule\n * rather than a second list that could silently drift green.\n */\n /**\n * The full-dashboard row for a suppressed PR. Verbose is FINE here — this lands in the PR's 1st\n * comment, not in `git log`.\n */\n private suppressedChecklistLine(suppressedCount: number): string {\n return `**Checklists:** ${this.suppressedTail(suppressedCount)}` + ' · NO reviewer subagent ran on this PR — use a positive reviewerAgents value and disable the machine kill switch to get them back';\n }\n\n /**\n * The ONE sentence both the dashboard row and the commit-body bullet are built from, so the two can\n * never disagree about what was switched off or by what.\n *\n * Every part of it earns its place in `main`'s permanent history:\n * • the COUNT, because \"suppressed 4\" and \"0 applicable\" are different facts and both must be\n * tellable apart forever — an absent bullet says the second while meaning the first;\n * • \"required included\", because otherwise it reads as an optional-only skip, which it is not;\n * • both supported controls, because this compact input carries the count but not the source.\n * ⚫ is deliberately outside the verdict palette (🟢🟡🔴🟠⚪ are all taken by checklistStatusText), so\n * nothing here can be mistaken for a verdict a reviewer actually returned.\n */\n private suppressedTail(suppressedCount: number): string {\n return `⚫ ALL ${suppressedCount} SUPPRESSED (required included) by ` + `reviewer policy (reviewerAgents: 0 or ${HOME_KEY_TURN_OFF_ALL_REVIEWERS} in ` + `~/${HOME_CONFIG_DIR}/${HOME_CONFIG_FILE})`;\n }\n\n private rollupBuckets(rows: readonly ChecklistRow[]): RollupBucket[] {\n const blocking = new RollupBucket('blocking', '🔴', true);\n const remediated = new RollupBucket('author-remediated after cap (not re-reviewed)', '🟠', true);\n const overridden = new RollupBucket('overridden', '🟠', true);\n const warned = new RollupBucket('with concerns', '🟡', true);\n const passed = new RollupBucket('passed', '🟢', false);\n for (const row of rows) {\n if (row.status === CK_PASS) passed.titles.push(row.title);\n else if (row.status === CK_WARN) warned.titles.push(row.title);\n else if (row.status === CK_REMEDIATED) remediated.titles.push(row.title);\n else if (row.status === CK_OVERRIDDEN) overridden.titles.push(row.title);\n else blocking.titles.push(row.title);\n }\n return [blocking, remediated, overridden, warned, passed];\n }\n\n // `2 overridden (a, b)` for the buckets a reviewer must act on; a bare `3 passed` for the one they need\n // no list of. Names are capped so a many-checklist repo still gets a ONE-LINE row.\n private bucketPhrase(bucket: RollupBucket): string {\n if (!bucket.named) return `${bucket.titles.length} ${bucket.label}`;\n return `${bucket.titles.length} ${bucket.label} (${this.compactNames(bucket.titles)})`;\n }\n\n private compactNames(titles: readonly string[]): string {\n const max = 4;\n if (titles.length <= max) return titles.join(', ');\n return `${titles.slice(0, max).join(', ')} +${titles.length - max} more`;\n }\n\n // 10-cell risk bar colored by band (🟩 ≤25, 🟨 ≤50, 🟧 ≤75, 🟥 >75), at least one filled cell.\n private riskBar(score: number): string {\n const clamped = Math.max(0, Math.min(100, score));\n const cell = clamped <= 25 ? '🟩' : clamped <= 50 ? '🟨' : clamped <= 75 ? '🟧' : '🟥';\n const filled = Math.max(1, Math.min(10, Math.round(clamped / 10)));\n return cell.repeat(filled) + '⬜'.repeat(10 - filled);\n }\n\n // RISK section (the AI half): Risk Score bar, Risk Level, Pattern Violations.\n private riskLines(review: PrSummary): string[] {\n const violations = review.violations.length;\n const violationLine = violations === 0 ? '🟢 No' : `🟡 Yes (${violations} violation(s))`;\n return [\n `**Risk Score:** ${this.riskBar(review.riskScore)} **${review.riskScore}/100** ${review.riskEmoji}`,\n new ReviewIdentityRenderer().render(review.agent, review.model, 'Summary agent'),\n `**Risk Level:** ${review.riskEmoji} **${review.riskLevel}**`,\n `**Pattern Violations:** ${violationLine}`,\n ];\n }\n\n private disableLine(disables: DisableCounts): string {\n if (disables.webpiecesCount === 0) return '**Webpieces Disables Added:** 🟢 No';\n const which = disables.webpiecesRules.length > 0 ? ` — ${disables.webpiecesRules.join(', ')}` : '';\n return `**Webpieces Disables Added:** 🟡 ${disables.webpiecesCount} line(s)${which}`;\n }\n}\n"]}
1
+ {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/dashboard/dashboard.ts"],"names":[],"mappings":";;;;AAAA,yEAAoE;AACpE,0DAAmQ;AACnQ,yCAA2D;AAG3D;;;;;;;GAOG;AACU,QAA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CAAC,CAAC;IACzD,CAAC;IAED,8EAA8E;IACtE,SAAS,CAAC,MAAiB;QAC/B,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;QAC5C,MAAM,aAAa,GAAG,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,UAAU,gBAAgB,CAAC;QACzF,OAAO;YACH,mBAAmB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,MAAM,CAAC,SAAS,UAAU,MAAM,CAAC,SAAS,EAAE;YACnG,IAAI,iDAAsB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC;YAChF,mBAAmB,MAAM,CAAC,SAAS,MAAM,MAAM,CAAC,SAAS,IAAI;YAC7D,2BAA2B,aAAa,EAAE;SAC7C,CAAC;IACN,CAAC;IAEO,WAAW,CAAC,QAAuB;QACvC,IAAI,QAAQ,CAAC,cAAc,KAAK,CAAC;YAAE,OAAO,qCAAqC,CAAC;QAChF,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnG,OAAO,oCAAoC,QAAQ,CAAC,cAAc,WAAW,KAAK,EAAE,CAAC;IACzF,CAAC;CACJ,CAAA;AA/aY,8BAAS;oBAAT,SAAS;IADrB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,SAAS,CA+arB","sourcesContent":["import { ReviewIdentityRenderer } from './review-identity-renderer';\nimport { GateDefinition, WEBPIECES_DISABLE, RULE_NAMES, PrSummary, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_ORANGE_FIXED, CK_FAIL, CK_MISSING, HOME_CONFIG_DIR, HOME_CONFIG_FILE, HOME_KEY_TURN_OFF_ALL_REVIEWERS, HOTFIX_AUDIT_BANNER } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AuthorIdentity } from './author-identity';\n\n/**\n * Hidden marker on the FULL-DASHBOARD comment — the \"1st comment\" the PR description points at — so\n * finish PATCHes its own comment on every push instead of appending a new one, exactly like the checklist\n * comment (see ChecklistCommentRenderer, which owns the 2nd).\n *\n * This comment did not exist before the PR description became the git-log body: the dashboard WAS the\n * description. Moving it here is what keeps a risk table out of every squash commit on main.\n */\nexport const DETAIL_COMMENT_MARKER = '<!-- webpieces-pr-detail v1 -->';\n\n/**\n * Footer on the full-dashboard comment. Names the tooling by REPO URL so a reader landing on a\n * generated comment in any consumer repo can find what generated it.\n *\n * It deliberately no longer asserts \"build ran via nx affected — not self-attested\": that sentence was\n * hard-coded and therefore wrong on every repo whose `buildCommand` is not nx. The build command is now\n * named for real, from config, in the PR-body footer — see {@link Dashboard.renderPrBody}.\n */\nconst DETAIL_COMMENT_FOOTER = 'Generated by https://github.com/deanhiller/webpieces-ts wp-finish-upsert-pr';\n\n/**\n * The last bullet of the PR description, and therefore of every squash commit body.\n *\n * Positional (\"1st\"/\"2nd\") on purpose — it is what a reader of `git log` can actually act on, far more\n * useful than naming an HTML marker they cannot see. On a PR opened by an OLDER release the checklist\n * comment already exists, so the dashboard comment lands second and this reads one off for that PR's\n * remaining life; it is cosmetic and self-corrects on the next PR.\n */\nconst DETAIL_POINTER = '(Full dashboard in 1st comment, reviewer checklist in 2nd — kept out of git log)';\n\nexport class GateResult {\n name: string;\n warningColor: string; // 'yellow' | 'red' — the color shown WHEN files matched (green is implicit)\n matchedFiles: string[];\n\n constructor(name: string, warningColor: string, matchedFiles: string[]) {\n this.name = name;\n this.warningColor = warningColor;\n this.matchedFiles = matchedFiles;\n }\n}\n\n// One row for a consumer review checklist the branch triggered. `status` is the resolved verdict (one of\n// CK_PASS | CK_WARN | CK_OVERRIDDEN | CK_FAIL | CK_MISSING | CK_BAD_FORMAT); `detail` is the reviewer\n// output / override justification. A row is always PASS/WARN/OVERRIDDEN by the time it renders — a failed,\n// missing or unreadable verdict throws before the dashboard is built. Rendered into the PR body so the\n// verdict reaches the server — the PR body is the artifact of the local flow that leaves the checkout\n// (alongside the HMAC gate token that proves the flow ran).\nexport class ChecklistRow {\n title: string; // the checklist id (= reviewer subagent name)\n status: string; // CK_* verdict\n detail: string; // reviewer output / override justification (surfaced for OVERRIDDEN)\n\n constructor(title: string, status: string, detail = '') {\n this.title = title;\n this.status = status;\n this.detail = detail;\n }\n}\n\n/**\n * One severity bucket of the rolled-up **Checklists** dashboard row: its emoji, the words that describe it,\n * and which checklists landed in it. Data-only.\n *\n * A bucket knows whether it should NAME its members: the non-green ones do (a reader has to know WHICH\n * reviewer to go read), the passed bucket does not (a list of what went fine is noise on a one-line row).\n */\nclass RollupBucket {\n label: string; // 'blocking' | 'overridden' | 'with concerns' | 'passed'\n emoji: string;\n named: boolean; // list the checklist ids on the row, or report a bare count\n titles: string[];\n\n constructor(label: string, emoji: string, named: boolean) {\n this.label = label;\n this.emoji = emoji;\n this.named = named;\n this.titles = [];\n }\n}\n\nexport class DisableCounts {\n webpiecesCount: number;\n eslintCount: number;\n webpiecesRules: string[];\n\n constructor(webpiecesCount: number, eslintCount: number, webpiecesRules: string[]) {\n this.webpiecesCount = webpiecesCount;\n this.eslintCount = eslintCount;\n this.webpiecesRules = webpiecesRules;\n }\n}\n\nexport class DashboardInput {\n title: string;\n gateResults: GateResult[];\n disables: DisableCounts;\n buildPassed: boolean;\n forkPoint: string;\n featureHead: string;\n mainHead: string;\n review: PrSummary; // AI-authored risk/violations/summary (from summary.json)\n checklists: ChecklistRow[]; // consumer checklists this branch triggered; [] for non-adopting repos\n /**\n * `commands.pr-gate.buildCommand` VERBATIM, named in the PR-body footer so `git log` records WHICH\n * command vouched for the commit. Read from config rather than hard-coded because the footer used to\n * assert \"build ran via nx affected\" on every repo, including those whose buildCommand is not nx.\n *\n * REQUIRED, with no default, and `checklists` lost its `= []` for the same reason. A defaulted\n * `buildCommand: string = ''` let every pre-existing 9-argument construction keep compiling while\n * silently rendering a footer that claims nothing — an absence that quietly means \"no build was\n * named\", which is the widening-by-omission the compatibility policy calls out. Making it required\n * means every caller states what vouched for the commit, and the empty string stays available for a\n * repo that genuinely has no build command, but only when someone writes it down.\n */\n buildCommand: string;\n /**\n * How many checklists WOULD have run but were disabled by either the project policy\n * (`reviewerAgents: 0`) or the machine kill switch — required ones included. `0` means no matching\n * checklist was suppressed; it is NOT a way of saying \"no checklist matched\", which\n * `checklists.length === 0` already says.\n *\n * The two states are byte-identical in `checklists` (both empty) and that is precisely the defect this\n * field closes: without it, a PR whose four REQUIRED reviewers were switched off is indistinguishable\n * in `main`'s history from a docs-only typo fix that legitimately matched nothing. REQUIRED with no\n * default, for the reason `buildCommand` is: a defaulted `0` would let every existing construction\n * keep compiling while asserting, silently, that nothing was suppressed.\n */\n suppressedChecklistCount: number;\n author: AuthorIdentity;\n hotfix: boolean;\n /**\n * Checklists the final diff matches that were never briefed, because a review round had already started\n * when a later commit first triggered them (issue #1053). NON-BLOCKING and informational: the checklist\n * set is frozen at the briefing. Assigned after construction; empty on most PRs.\n */\n notBriefed: string[];\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n title: string,\n gateResults: GateResult[],\n disables: DisableCounts,\n buildPassed: boolean,\n forkPoint: string,\n featureHead: string,\n mainHead: string,\n review: PrSummary,\n checklists: ChecklistRow[],\n buildCommand: string,\n suppressedChecklistCount: number,\n author: AuthorIdentity,\n hotfix: boolean,\n ) {\n this.title = title;\n this.gateResults = gateResults;\n this.disables = disables;\n this.buildPassed = buildPassed;\n this.forkPoint = forkPoint;\n this.featureHead = featureHead;\n this.mainHead = mainHead;\n this.review = review;\n this.checklists = checklists;\n this.buildCommand = buildCommand;\n this.suppressedChecklistCount = suppressedChecklistCount;\n this.author = author;\n this.hotfix = hotfix;\n this.notBriefed = [];\n }\n}\n\n/** Renders the PR-gate dashboard markdown (gates × changed files, disables, risk, 3-point hashes). */\n@injectable(bindingScopeValues.Singleton)\nexport class Dashboard {\n // Disabled gates are in-file examples (JSON has no comments) — skip them entirely.\n computeGateResults(gates: GateDefinition[], changedFiles: string[]): GateResult[] {\n return gates\n .filter((gate: GateDefinition): boolean => !gate.disabled)\n .map((gate: GateDefinition): GateResult => {\n const matched = changedFiles.filter((file: string): boolean => this.matchesAny(gate.patterns, file));\n return new GateResult(gate.name, gate.warningColor, matched);\n });\n }\n\n // Count disables ADDED in this PR by scanning added (`+`) lines of the diff patch. Rule-aware:\n // reports which webpieces rules were disabled, using the canonical RULE_NAMES vocabulary.\n countAddedDisables(patch: string): DisableCounts {\n let webpiecesCount = 0;\n let eslintCount = 0;\n const rules = new Set<string>();\n const allRuleTokens = Object.keys(RULE_NAMES).map((key: string): string => (RULE_NAMES as Record<string, string>)[key]);\n\n for (const line of patch.split('\\n')) {\n if (!line.startsWith('+') || line.startsWith('+++')) continue;\n if (line.includes(WEBPIECES_DISABLE)) {\n webpiecesCount += 1;\n for (const token of allRuleTokens) {\n if (line.includes(token)) rules.add(token);\n }\n }\n if (line.includes('eslint-disable')) eslintCount += 1;\n }\n return new DisableCounts(webpiecesCount, eslintCount, Array.from(rules).sort());\n }\n\n /**\n * The FULL dashboard — every row (green included), the whole summary, the 3-point hash points.\n *\n * This is the **1st PR comment**, not the PR description. It used to be the description, and that is\n * exactly what put it into main's history: GitHub's `squash_merge_commit_message: PR_BODY` copies the\n * description verbatim into the squash commit, so every `git log` entry carried the risk table, the\n * hash points and the gate token. The description now holds {@link renderPrBody}'s compact form, and\n * everything long-form lives here where a reader can open it and `git log` never sees it.\n *\n * Machine-facing content belongs HERE too — this comment carries the HMAC gate token. That is the\n * whole rule that keeps the description clean: an HTML comment is invisible in rendered markdown but\n * perfectly visible in `git log`, so nothing hidden may live in the description.\n */\n renderDetailComment(input: DashboardInput): string {\n const lines: string[] = [];\n if (input.hotfix) {\n lines.push(HOTFIX_AUDIT_BANNER, '');\n }\n lines.push('## 🚦 PR Gate Dashboard');\n lines.push('');\n for (const line of this.riskLines(input.review)) lines.push(line);\n lines.push(new ReviewIdentityRenderer().renderAuthor(input.author.harness, input.author.model));\n lines.push(`**Build (${input.hotfix ? 'hotfix-ci: build + test only' : 'nx affected'}):** ${input.buildPassed ? '🟢 Passed' : '🔴 Failed'}`);\n for (const result of input.gateResults) lines.push(this.gateLine(result));\n lines.push(this.disableLine(input.disables));\n const eslintEmoji = input.disables.eslintCount === 0 ? '🟢 No' : `🟡 ${input.disables.eslintCount} line(s)`;\n lines.push(`**ESLint Disables Added:** ${eslintEmoji}`);\n // ONE rolled-up row for ALL triggered consumer checklists — a worst-of colour and a count, sitting\n // with the other status rows. It used to be one row PER checklist, each inlining that checklist's\n // whole verdict/override paragraph: on a six-checklist PR that was the same ~90-word override\n // repeated six times, burying the signal rows above it — and every word of it was already in the\n // checklist COMMENT, per reviewer, in full. ALWAYS emitted, including the zero case: \"no reviewer\n // looked at this PR\" is a fact a reader must be told, and an absent row silently reads as a green\n // all-clear (see checklistRollupLine).\n lines.push(input.hotfix ? '**Checklists:** ⚫ BYPASSED by /hotfix/ convention · 0 reviewer agents ran' : this.checklistRollupLine(input.checklists, input.suppressedChecklistCount));\n if (input.notBriefed.length > 0) lines.push(this.notBriefedLine(input.notBriefed));\n lines.push('');\n if (input.review.summary.trim() !== '') {\n lines.push('### Summary');\n lines.push(input.review.summary.trim());\n lines.push('');\n }\n lines.push('### 🔍 3-Point Hash Points');\n lines.push(`- Fork point (A): \\`${input.forkPoint.slice(0, 12)}\\``);\n lines.push(`- Feature HEAD (B): \\`${input.featureHead.slice(0, 12)}\\``);\n lines.push(`- Main HEAD (C): \\`${input.mainHead.slice(0, 12)}\\``);\n lines.push('');\n lines.push(`<sub>🤖 ${DETAIL_COMMENT_FOOTER}</sub>`);\n return lines.join('\\n');\n }\n\n /**\n * The PR DESCRIPTION — which is also, byte for byte, the squash-commit body that lands in main.\n *\n * ─── Why one string serves both ─────────────────────────────────────────────────────────────────\n * There used to be two: a long dashboard in the description and this compact form passed to\n * `gh pr merge --body-file`. That made the good `git log` reachable ONLY through an explicit\n * `--body-file` merge, because every other route (the GitHub Merge button, a bare `gh pr merge`)\n * takes its body from the repo's `squash_merge_commit_message`, and on `PR_BODY` that copied the\n * whole dashboard into history. Two repos ran that way for months.\n *\n * Making the DESCRIPTION the compact form inverts it: `PR_BODY` now yields exactly the right commit,\n * so the UI button, a bare `gh pr merge`, `wp-land-pr` and finish's own auto-merge all converge on\n * identical bytes. It rests on two GitHub repo settings — `squash_merge_commit_title: PR_TITLE` and\n * `squash_merge_commit_message: PR_BODY` — which are NOT a consumer's job: they are server-side, so no\n * config key can express them, and SquashSettingsEnforcer pins them on every run. That convergence is\n * the point, and `pr-body-is-merge-body.spec.ts` pins it.\n *\n * ─── The shape, and why each part earns its line ────────────────────────────────────────────────\n * The URL leads, BARE — no caption. It used to carry `(for git log)`, which was aimed at a reader on\n * the PR page (where the link is redundant, being the page you are already on) and was meant to stop\n * them deleting it. But this string is also the squash-commit body, so that caption landed verbatim in\n * `main`'s history on every commit, forever, to serve one transient reading. In `git log` a bare URL\n * is self-evidently the way back and needs no explanation. The permanent surface wins.\n * Then the risk score (always). Then ONLY the non-green flags, under a heading that SAYS the full list\n * is in the 1st comment — a `git log` reader has no page to glance at, so the heading has to carry\n * that itself rather than leaving \"why is this list short?\" to the pointer bullet alone. Then the\n * summary capped at 4 sentences, then the footer naming the build command that vouched for it.\n *\n * The hidden gate-token marker is appended AFTER this by the caller, so it is the very last line of\n * the description and therefore of the commit. It stays an HTML comment — invisible on the PR page,\n * visible in `git log` — which is a deliberate accepted trade: the alternative was reshaping a live\n * CI-critical surface that two consumer repos verify on every PR, to save one line of history.\n */\n renderPrBody(input: DashboardInput, prUrl: string): string {\n const lines: string[] = [];\n if (input.hotfix) {\n lines.push(HOTFIX_AUDIT_BANNER, '');\n }\n if (prUrl !== '') {\n lines.push(prUrl);\n lines.push('');\n }\n lines.push(`Risk: ${this.riskBar(input.review.riskScore)} ${input.review.riskScore}/100 ${input.review.riskEmoji} (${input.review.riskLevel})`);\n lines.push(new ReviewIdentityRenderer().renderAuthor(input.author.harness, input.author.model, false));\n lines.push('');\n const flags = this.nonGreenFlags(input);\n lines.push(flags.length === 0 ? 'Flags: 🟢 all green' : 'Non-green Flags (full list in first comment to avoid large git logs)');\n for (const flag of flags) lines.push(`- ${flag}`);\n // ALWAYS the last bullet, green case included. Without it the compact body reads as the whole\n // record, and the reader never learns that every green row, the full summary and each reviewer's\n // output are one click away.\n lines.push(`- ${DETAIL_POINTER}`);\n const summary = this.firstSentences(input.review.summary.trim(), 4);\n if (summary !== '') {\n lines.push('');\n lines.push(summary);\n }\n lines.push('');\n lines.push(this.prBodyFooter(input.buildCommand));\n return this.gitLogSafe(lines.join('\\n'));\n }\n\n /**\n * Makes THIS renderer own the invariant `wp-land-pr` checks: the compact body carries no markdown\n * heading and no table pipe.\n *\n * It is applied to the WHOLE joined string rather than to each author-supplied field, on purpose.\n * Every field this body interpolates — the review summary, an override justification, a checklist\n * title, a disabled rule name, `commands.pr-gate.buildCommand` — is text this package did not write,\n * and a `|` reaches all of them for entirely ordinary non-markdown reasons: a TypeScript union\n * (`'open' | 'paused'`), a regex alternation, a quoted shell pipeline, an OR in prose. Sanitizing at\n * the single exit point means a field added later is covered without anyone remembering to wrap it,\n * and none of this renderer's own literals contain either marker, so nothing of ours changes.\n *\n * Before this, `wp-finish-upsert-pr` would happily POST such a body and report success, and then\n * `wp-land-pr` refused those exact bytes — two commands in one flow disagreeing about what the\n * renderer produces, with a refusal that blamed an old release and prescribed re-running finish,\n * which re-rendered the identical pipe from the unchanged `summary.json`. An infinite loop costing a\n * CI cycle per turn.\n *\n * `¦` (BROKEN BAR) rather than `\\|`: this string's home is `git log` in a terminal, where a\n * backslash is literal punctuation and a markdown escape means nothing. The substitution is visible\n * and reads correctly; the full, unaltered text is one click away in the 1st comment, which this\n * body's last bullet always points at. `##` collapses to `#` for the same reason — a heading in a\n * summary is markdown a plain-text history cannot carry either.\n */\n private gitLogSafe(body: string): string {\n return body.replace(/\\|/g, '\\u00a6').replace(/#{2,}/g, '#');\n }\n\n /**\n * The footer, naming the build command from `commands.pr-gate.buildCommand` VERBATIM.\n *\n * No backticks: this string's primary home is `git log` in a terminal, where markdown ticks are\n * literal punctuation. \"run locally\" is the honest claim — this is the LOCAL gate's receipt, and the\n * server-side proof is the gate token in the 1st comment, not this sentence.\n */\n private prBodyFooter(buildCommand: string): string {\n const cmd = buildCommand.trim();\n const ran = cmd === '' ? '' : ` (${cmd} run locally)`;\n return `Generated by webpieces-ts wp-finish-upsert-pr${ran}`;\n }\n\n // Every dashboard row that is NOT green, as a flat bullet list for the commit body. Green rows\n // (build passed, gate did not match, zero disables/violations) are intentionally omitted.\n private nonGreenFlags(input: DashboardInput): string[] {\n const flags: string[] = [];\n if (input.hotfix) {\n flags.push('⚠️ HOTFIX — reviews, ticket enforcement, Webpieces rules, ESLint, and format checks bypassed; compilation and tests ran');\n }\n if (!input.buildPassed) flags.push('Build (nx affected): 🔴 Failed');\n if (input.review.violations.length > 0) flags.push(`Pattern Violations: 🟡 ${input.review.violations.length} violation(s)`);\n for (const result of input.gateResults) {\n if (result.matchedFiles.length === 0) continue;\n const emoji = result.warningColor === 'red' ? '🔴' : '🟡';\n flags.push(`${result.name}: ${emoji} ${result.matchedFiles.length} file(s)`);\n }\n if (input.disables.webpiecesCount > 0) {\n const which = input.disables.webpiecesRules.length > 0 ? ` — ${input.disables.webpiecesRules.join(', ')}` : '';\n flags.push(`Webpieces Disables Added: 🟡 ${input.disables.webpiecesCount} line(s)${which}`);\n }\n if (input.disables.eslintCount > 0) flags.push(`ESLint Disables Added: 🟡 ${input.disables.eslintCount} line(s)`);\n // A triggered checklist is noteworthy in main's history — carry each into the commit body.\n //\n // SUPPRESSED replaces those N bullets with exactly ONE, whatever N is. Not because the per-reviewer\n // bullets would lie — `checklistStatusText` was already hardened against a false \"passed\" — but\n // because with the kill switch on there are NO rows at all, and a body with no `Checklist — `\n // bullets is byte-identical to a PR that legitimately matched zero checklists (a docs-only typo\n // fix). Without this line, \"four REQUIRED reviewers were killed by a flag\" and \"nothing applied\n // here\" are indistinguishable in main's history forever. One compact bullet, in the existing\n // style — the loud version belongs in stage ②'s output and the 1st comment, not in `git log`.\n if (input.suppressedChecklistCount > 0) {\n flags.push(`Checklists — ${this.suppressedTail(input.suppressedChecklistCount)}`);\n }\n for (const row of input.checklists) {\n flags.push(`Checklist — ${row.title}: ${this.checklistStatusText(row)}`);\n }\n if (input.notBriefed.length > 0) flags.push(`Checklists — ${this.notBriefedLine(input.notBriefed)}`);\n return flags;\n }\n\n /**\n * The ONE informational line for checklists first triggered after the review was briefed (issue #1053).\n * ⚪ and \"not blocking\" both, so it can be read neither as a pass nor as something the PR still owes.\n */\n private notBriefedLine(ids: readonly string[]): string {\n return `⚪ not reviewed (not blocking): ${ids.join(', ')} — first triggered after the review was briefed`;\n }\n\n // Emoji + words for a checklist verdict, shared by the dashboard row and the commit-body flag.\n // Every state is matched EXPLICITLY and the fallthrough names the status it did not recognize. The\n // previous `return '🟢 passed'` fallthrough meant any newly-added verdict rendered as a clean pass on\n // both the PR body and main's commit history until someone noticed — exactly the wrong default.\n private checklistStatusText(row: ChecklistRow): string {\n if (row.status === CK_OVERRIDDEN) {\n const why = row.detail.trim() !== '' ? ` — override: ${row.detail.trim()}` : '';\n return `🟠 OVERRIDDEN${why}`;\n }\n if (row.status === CK_ORANGE_FIXED) return `🟠 ${row.detail}`;\n if (row.status === CK_WARN) return '🟡 passed with concerns';\n if (row.status === CK_FAIL) return '🔴 FAILED review';\n if (row.status === CK_MISSING) return '⚪ not reviewed';\n if (row.status === CK_PASS) return '🟢 passed';\n return `⚪ unknown verdict (${row.status})`;\n }\n\n // First `max` sentences of `text`. A sentence ends at `. ! ?` ONLY when followed by whitespace or\n // end-of-string, so interior dots in filenames/paths/versions (dependencies.json, runtime-graph.ts,\n // 0.4.447) do NOT split — and, unlike a greedy `[^.!?]+` regex, no text is ever dropped when such a\n // dot appears (that footgun silently deleted the run of prose up to the next real boundary). Keeps\n // the commit body scannable; the full summary still lives in the PR-body dashboard.\n private firstSentences(text: string, max: number): string {\n if (text === '') return '';\n const sentences: string[] = [];\n let start = 0;\n for (let i = 0; i < text.length && sentences.length < max; i++) {\n const ch = text[i];\n const isTerminator = ch === '.' || ch === '!' || ch === '?';\n const next = text[i + 1];\n if (isTerminator && (next === undefined || /\\s/.test(next))) {\n sentences.push(text.slice(start, i + 1).trim());\n start = i + 1;\n }\n }\n // Trailing text with no terminator still counts as a sentence (up to the cap).\n if (sentences.length < max && start < text.length) {\n const tail = text.slice(start).trim();\n if (tail !== '') sentences.push(tail);\n }\n return sentences.join(' ').trim();\n }\n\n // Self-contained glob matcher (** , * , ?) so pr-gate needs no extra runtime dependency.\n private globToRegex(pattern: string): RegExp {\n let re = '';\n let i = 0;\n while (i < pattern.length) {\n const ch = pattern[i];\n if (ch === '*' && pattern[i + 1] === '*') {\n re += '.*';\n i += 2;\n if (pattern[i] === '/') i += 1;\n continue;\n }\n if (ch === '*') {\n re += '[^/]*';\n i += 1;\n continue;\n }\n if (ch === '?') {\n re += '[^/]';\n i += 1;\n continue;\n }\n if ('.+^$(){}|[]\\\\'.includes(ch)) {\n re += '\\\\' + ch;\n i += 1;\n continue;\n }\n re += ch;\n i += 1;\n }\n return new RegExp('^' + re + '$');\n }\n\n private matchesAny(patterns: string[], file: string): boolean {\n for (const pattern of patterns) {\n if (this.globToRegex(pattern).test(file)) return true;\n }\n return false;\n }\n\n private gateLine(result: GateResult): string {\n if (result.matchedFiles.length === 0) return `**${result.name}:** 🟢 No`;\n const emoji = result.warningColor === 'red' ? '🔴' : '🟡';\n return `**${result.name}:** ${emoji} Yes (${result.matchedFiles.length} file(s))`;\n }\n\n /**\n * The ONE rolled-up **Checklists:** row, coloured worst-of across every checklist that ran, in the same\n * shape as its neighbours (`**Build (nx affected):** 🟢 Passed`). Counts and names only — never a line\n * of reviewer output or override justification, which is the whole reason this row exists.\n */\n private checklistRollupLine(rows: readonly ChecklistRow[], suppressedCount: number): string {\n // FIRST, and ahead of the zero-ran case below, which would say \"no review checklist matched this\n // PR\" — false here, and the one sentence that would turn a kill switch into an all-clear. ⚫ is a\n // colour no verdict uses, so it cannot be mistaken for a pass, a warning or a refusal.\n if (suppressedCount > 0) return this.suppressedChecklistLine(suppressedCount);\n const buckets = this.rollupBuckets(rows);\n const filled = buckets.filter((b: RollupBucket): boolean => b.titles.length > 0);\n // NO reviewer ran ⇒ the SKIPPED icon, never green. Green claims something was checked and came back\n // clean; ⚪ says nobody looked, which is what a reader has to be able to tell apart at a glance.\n if (filled.length === 0) {\n return '**Checklists:** ⚪ 0 ran — no review checklist matched this PR · see the checklist comment';\n }\n const allPassed = filled.length === 1 && !filled[0].named;\n const detail = allPassed ? 'all passed' : filled.map((b: RollupBucket): string => this.bucketPhrase(b)).join(', ');\n return `**Checklists:** ${filled[0].emoji} ${rows.length} ran — ${detail} · per-checklist detail in the checklist comment`;\n }\n\n /**\n * The four severity buckets, WORST FIRST, so `filled[0]` is the roll-up colour: red beats orange beats\n * yellow beats green. The colours are the same vocabulary the comment already uses (see verdictEmoji).\n *\n * OVERRIDDEN is deliberately NOT folded into passed: an override is a human knowingly accepting a red\n * verdict, and a dashboard that painted that green would hide the single most review-worthy thing on\n * the PR. The blocking bucket is the FALLTHROUGH — CK_FAIL, CK_MISSING, CK_BAD_FORMAT and any verdict\n * added later all land there, matching summary.json's own \"not pass|warn|overridden ⇒ refuse\" rule\n * rather than a second list that could silently drift green.\n */\n /**\n * The full-dashboard row for a suppressed PR. Verbose is FINE here — this lands in the PR's 1st\n * comment, not in `git log`.\n */\n private suppressedChecklistLine(suppressedCount: number): string {\n return `**Checklists:** ${this.suppressedTail(suppressedCount)}` + ' · NO reviewer subagent ran on this PR — use a positive reviewerAgents value and disable the machine kill switch to get them back';\n }\n\n /**\n * The ONE sentence both the dashboard row and the commit-body bullet are built from, so the two can\n * never disagree about what was switched off or by what.\n *\n * Every part of it earns its place in `main`'s permanent history:\n * • the COUNT, because \"suppressed 4\" and \"0 applicable\" are different facts and both must be\n * tellable apart forever — an absent bullet says the second while meaning the first;\n * • \"required included\", because otherwise it reads as an optional-only skip, which it is not;\n * • both supported controls, because this compact input carries the count but not the source.\n * ⚫ is deliberately outside the verdict palette (🟢🟡🔴🟠⚪ are all taken by checklistStatusText), so\n * nothing here can be mistaken for a verdict a reviewer actually returned.\n */\n private suppressedTail(suppressedCount: number): string {\n return `⚫ ALL ${suppressedCount} SUPPRESSED (required included) by ` + `reviewer policy (reviewerAgents: 0 or ${HOME_KEY_TURN_OFF_ALL_REVIEWERS} in ` + `~/${HOME_CONFIG_DIR}/${HOME_CONFIG_FILE})`;\n }\n\n private rollupBuckets(rows: readonly ChecklistRow[]): RollupBucket[] {\n const blocking = new RollupBucket('blocking', '🔴', true);\n const orangeFixed = new RollupBucket('orange, author-fixed (not re-reviewed)', '🟠', true);\n const overridden = new RollupBucket('overridden', '🟠', true);\n const warned = new RollupBucket('with concerns', '🟡', true);\n const passed = new RollupBucket('passed', '🟢', false);\n for (const row of rows) {\n if (row.status === CK_PASS) passed.titles.push(row.title);\n else if (row.status === CK_WARN) warned.titles.push(row.title);\n else if (row.status === CK_ORANGE_FIXED) orangeFixed.titles.push(row.title);\n else if (row.status === CK_OVERRIDDEN) overridden.titles.push(row.title);\n else blocking.titles.push(row.title);\n }\n return [blocking, orangeFixed, overridden, warned, passed];\n }\n\n // `2 overridden (a, b)` for the buckets a reviewer must act on; a bare `3 passed` for the one they need\n // no list of. Names are capped so a many-checklist repo still gets a ONE-LINE row.\n private bucketPhrase(bucket: RollupBucket): string {\n if (!bucket.named) return `${bucket.titles.length} ${bucket.label}`;\n return `${bucket.titles.length} ${bucket.label} (${this.compactNames(bucket.titles)})`;\n }\n\n private compactNames(titles: readonly string[]): string {\n const max = 4;\n if (titles.length <= max) return titles.join(', ');\n return `${titles.slice(0, max).join(', ')} +${titles.length - max} more`;\n }\n\n // 10-cell risk bar colored by band (🟩 ≤25, 🟨 ≤50, 🟧 ≤75, 🟥 >75), at least one filled cell.\n private riskBar(score: number): string {\n const clamped = Math.max(0, Math.min(100, score));\n const cell = clamped <= 25 ? '🟩' : clamped <= 50 ? '🟨' : clamped <= 75 ? '🟧' : '🟥';\n const filled = Math.max(1, Math.min(10, Math.round(clamped / 10)));\n return cell.repeat(filled) + '⬜'.repeat(10 - filled);\n }\n\n // RISK section (the AI half): Risk Score bar, Risk Level, Pattern Violations.\n private riskLines(review: PrSummary): string[] {\n const violations = review.violations.length;\n const violationLine = violations === 0 ? '🟢 No' : `🟡 Yes (${violations} violation(s))`;\n return [\n `**Risk Score:** ${this.riskBar(review.riskScore)} **${review.riskScore}/100** ${review.riskEmoji}`,\n new ReviewIdentityRenderer().render(review.agent, review.model, 'Summary agent'),\n `**Risk Level:** ${review.riskEmoji} **${review.riskLevel}**`,\n `**Pattern Violations:** ${violationLine}`,\n ];\n }\n\n private disableLine(disables: DisableCounts): string {\n if (disables.webpiecesCount === 0) return '**Webpieces Disables Added:** 🟢 No';\n const which = disables.webpiecesRules.length > 0 ? ` — ${disables.webpiecesRules.join(', ')}` : '';\n return `**Webpieces Disables Added:** 🟡 ${disables.webpiecesCount} line(s)${which}`;\n }\n}\n"]}
@@ -16,7 +16,7 @@ import { StageOutputLog } from '../workflow/stage-output-log';
16
16
  *
17
17
  * ─── It INVENTS NO STATE ───────────────────────────────────────────────────────────────────────────
18
18
  * The set of reviewers a branch owes is `ChecklistScanner`'s answer — the SAME one `wp-review-upsert-pr`
19
- * lists and `wp-finish-upsert-pr` blocks on — and the verdicts are the `review-<id>.json` files those
19
+ * lists and `wp-finish-upsert-pr` blocks on — and the verdicts are the `review-round<N>-<id>.json` files those
20
20
  * two already read. Nothing here writes anything, and there is no third opinion about who is owed: a
21
21
  * waiter that computed its own set could finish while finish still refused, which is the one outcome
22
22
  * that would make waiting worse than not waiting.
@@ -54,11 +54,11 @@ export declare class ReviewerWaitProbe implements WaitProbe {
54
54
  private readonly summaryPath;
55
55
  private readonly waitedOn;
56
56
  private readonly applicable;
57
- private readonly sinceMs;
57
+ private readonly briefedRound;
58
58
  readonly label = "reviewers";
59
59
  readonly pollMs = 3000;
60
60
  private results;
61
- constructor(reviewJsonService: ReviewJsonService, summaryPath: string, waitedOn: readonly RequiredChecklist[], applicable: readonly RequiredChecklist[], sinceMs: number);
61
+ constructor(reviewJsonService: ReviewJsonService, summaryPath: string, waitedOn: readonly RequiredChecklist[], applicable: readonly RequiredChecklist[], briefedRound: number);
62
62
  /**
63
63
  * Done when every awaited reviewer has ANSWERED — not when every answer is a pass.
64
64
  *
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReviewerWaitProbe = exports.AwaitReviewsCommand = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const fs = tslib_1.__importStar(require("fs"));
6
5
  const rules_config_1 = require("@webpieces/rules-config");
7
6
  const inversify_1 = require("inversify");
8
7
  const await_loop_1 = require("../workflow/await-loop");
@@ -22,7 +21,7 @@ const stage_output_log_1 = require("../workflow/stage-output-log");
22
21
  *
23
22
  * ─── It INVENTS NO STATE ───────────────────────────────────────────────────────────────────────────
24
23
  * The set of reviewers a branch owes is `ChecklistScanner`'s answer — the SAME one `wp-review-upsert-pr`
25
- * lists and `wp-finish-upsert-pr` blocks on — and the verdicts are the `review-<id>.json` files those
24
+ * lists and `wp-finish-upsert-pr` blocks on — and the verdicts are the `review-round<N>-<id>.json` files those
26
25
  * two already read. Nothing here writes anything, and there is no third opinion about who is owed: a
27
26
  * waiter that computed its own set could finish while finish still refused, which is the one outcome
28
27
  * that would make waiting worse than not waiting.
@@ -59,7 +58,7 @@ let AwaitReviewsCommand = class AwaitReviewsCommand {
59
58
  // contextStage '' — a WAIT must not write pr-context.json. That file records the diff a review
60
59
  // was briefed against, and rewriting it mid-review would restate the briefing under the
61
60
  // reviewers currently reading it.
62
- const scan = this.checklistScanner.scan(repoRoot, config.checklists, new checklist_scanner_1.ChecklistScanOptions(true, ''));
61
+ const scan = this.checklistScanner.scan(repoRoot, config.checklists, new checklist_scanner_1.ChecklistScanOptions(config.maxReviewerRounds, true, ''));
63
62
  if (scan.reviewersDisabled)
64
63
  return this.reportDisabled(scan.suppressed);
65
64
  if (scan.applicable.length === 0)
@@ -69,10 +68,10 @@ let AwaitReviewsCommand = class AwaitReviewsCommand {
69
68
  // not wait for them, and a wait that did would never end, because nothing is ever going to write
70
69
  // a verdict for a reviewer that was deliberately never spawned. (The SET is shared with finish;
71
70
  // the PREDICATE is not — see `done()` for why a wait ends on arrival and finish does not.)
72
- // A verdict file older than the last stage ② is NOT an arrival: it is the stale green or rejected
73
- // file that stage just re-briefed (issue #863), and counting it would end the wait on the spot.
74
- const since = this.receipts.writtenAtMs(repoRoot, this.aiBranchName.getFeatureName());
75
- const probe = new ReviewerWaitProbe(this.reviewJsonService, scan.summaryPath, scan.outstanding, scan.applicable, since);
71
+ // A verdict from an EARLIER round than the one stage ② last briefed is NOT an arrival: it is the red
72
+ // that round re-briefed (issue #1053), and counting it would end the wait on the spot.
73
+ const round = this.receipts.read(repoRoot, this.aiBranchName.getFeatureName())?.round ?? 0;
74
+ const probe = new ReviewerWaitProbe(this.reviewJsonService, scan.summaryPath, scan.outstanding, scan.applicable, round);
76
75
  const outcome = await this.awaitLoop.run(probe);
77
76
  this.report(probe, outcome);
78
77
  }
@@ -111,20 +110,20 @@ class ReviewerWaitProbe {
111
110
  summaryPath;
112
111
  waitedOn;
113
112
  applicable;
114
- sinceMs;
113
+ briefedRound;
115
114
  label = 'reviewers';
116
115
  // Verdict files are local reads, so polling them costs nothing worth economizing on. Fast enough
117
116
  // that the command returns within seconds of the last reviewer finishing, which is the point.
118
117
  pollMs = 3_000;
119
118
  results = [];
120
119
  constructor(reviewJsonService, summaryPath, waitedOn, applicable,
121
- // Epoch ms of the last stage ② (0 = none): a verdict file last written before it is not an answer.
122
- sinceMs) {
120
+ // The round stage ② last briefed (0 = none): a verdict from an earlier round is not an answer.
121
+ briefedRound) {
123
122
  this.reviewJsonService = reviewJsonService;
124
123
  this.summaryPath = summaryPath;
125
124
  this.waitedOn = waitedOn;
126
125
  this.applicable = applicable;
127
- this.sinceMs = sinceMs;
126
+ this.briefedRound = briefedRound;
128
127
  this.reload();
129
128
  }
130
129
  /**
@@ -182,13 +181,15 @@ class ReviewerWaitProbe {
182
181
  // Only a NON-passing verdict's detail is printed. A green reviewer's output is already on the PR,
183
182
  // and reprinting four of them here would bury the one line that needs acting on.
184
183
  detail(verdict) {
185
- if (verdict.status !== rules_config_1.CK_FAIL || verdict.detail === '')
184
+ if ((verdict.status !== rules_config_1.CK_FAIL && verdict.status !== rules_config_1.CK_ORANGE) || verdict.detail === '')
186
185
  return '';
187
186
  return `\n ${verdict.detail.split('\n').join('\n ')}`;
188
187
  }
189
188
  icon(verdict) {
190
189
  if (verdict.status === rules_config_1.CK_FAIL)
191
190
  return '🔴';
191
+ if (verdict.status === rules_config_1.CK_ORANGE)
192
+ return '🟠';
192
193
  if (verdict.status === rules_config_1.CK_MISSING || verdict.status === rules_config_1.CK_BAD_FORMAT)
193
194
  return '❓';
194
195
  return '🟢';
@@ -196,11 +197,16 @@ class ReviewerWaitProbe {
196
197
  // Named because a wait that ends without saying what it unblocked leaves the agent to guess, and
197
198
  // guessing here means spinning again. A red verdict changes the next move, so it is called out.
198
199
  nextStep() {
199
- const anyRed = this.applicable.some((req) => this.reviewJsonService.resolveVerdict(req, this.results).status === rules_config_1.CK_FAIL);
200
- return anyRed
201
- ? '\n A reviewer REFUSED. Fix what it found — re-spawning it against unchanged code buys the\n'
202
- + ' same answer — then re-run the review stage.\n'
203
- : '\n Nothing is owed on the review front.\n';
200
+ const statuses = this.applicable.map((req) => this.reviewJsonService.resolveVerdict(req, this.results).status);
201
+ if (statuses.includes(rules_config_1.CK_FAIL)) {
202
+ return '\n A reviewer REFUSED. Fix what it found — re-spawning it against unchanged code buys the\n'
203
+ + ' same answer — then re-run the review stage.\n';
204
+ }
205
+ if (statuses.includes(rules_config_1.CK_ORANGE)) {
206
+ return '\n A final-round reviewer marked ORANGE. Fix what it found, best effort, commit, and record the\n'
207
+ + ' fixes with pnpm wp-write-review-fixes. Do NOT spawn a reviewer: that was the last review round.\n';
208
+ }
209
+ return '\n Nothing is owed on the review front.\n';
204
210
  }
205
211
  // The awaited checklists whose verdict file has not appeared yet — see `done()` for why this is
206
212
  // arrival and not the gate's own "still owed".
@@ -208,10 +214,8 @@ class ReviewerWaitProbe {
208
214
  return this.waitedOn.filter((req) => this.reviewJsonService.resolveVerdict(req, this.results).status === rules_config_1.CK_MISSING || this.predates(req));
209
215
  }
210
216
  predates(req) {
211
- if (this.sinceMs === 0)
212
- return false;
213
- const file = this.reviewJsonService.checklistResultPath(this.summaryPath, req.id);
214
- return fs.existsSync(file) && fs.statSync(file).mtimeMs < this.sinceMs;
217
+ const result = this.results.find((r) => r.id === req.id);
218
+ return result !== undefined && result.round < this.briefedRound;
215
219
  }
216
220
  reload() {
217
221
  this.results = this.reviewJsonService.loadChecklistResults(this.summaryPath, this.applicable);
@@ -1 +1 @@
1
- {"version":3,"file":"await-reviews-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/await-reviews-command.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,0DAGiC;AACjC,yCAA2D;AAE3D,uDAA2E;AAC3E,qEAAuF;AACvF,2EAAgE;AAChE,2EAA6E;AAC7E,mEAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAEP;IACA;IACA;IACA;IACA;IACA;IACA;IAPrB,YACqB,cAA8B,EAC9B,gBAAkC,EAClC,iBAAoC,EACpC,SAAoB,EACpB,YAA4B,EAC5B,QAAmC,EACnC,YAA0B;QAN1B,mBAAc,GAAd,cAAc,CAAgB;QAC9B,qBAAgB,G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,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,sBAAO,CAAC,CAAC;QACjF,OAAO,MAAM;YACT,CAAC,CAAC,+FAA+F;kBAC3F,kDAAkD;YACxD,CAAC,CAAC,6CAA6C,CAAC;IACxD,CAAC;IAED,gGAAgG;IAChG,+CAA+C;IACvC,OAAO;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAsB,EAAW,EAAE,CAC5D,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,yBAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9G,CAAC;IAEO,QAAQ,CAAC,GAAsB;QACnC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAClF,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC3E,CAAC;IAEO,MAAM;QACV,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAClG,CAAC;CACJ;AAnHD,8CAmHC","sourcesContent":["import * as fs from 'fs';\nimport {\n ChecklistResult, ChecklistVerdict, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, loadAndValidate,\n RepoRootFinder, RequiredChecklist, ReviewJsonService,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { AwaitLoop, WaitOutcome, WaitProbe } from '../workflow/await-loop';\nimport { ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { ReviewStageReceiptService } from '../workflow/review-stage-receipt';\nimport { StageOutputLog } from '../workflow/stage-output-log';\n\n/**\n * `wp-await-reviews` — BLOCK until every reviewer stage ② requested for this branch has written its\n * verdict, then print what each one said.\n *\n * ─── Why a command and not an instruction ──────────────────────────────────────────────────────────\n * An agent that has just spawned four reviewer subagents has nothing to do until they answer, and a\n * worktree-isolated subagent cannot simply wait: ending its turn ends its run. See {@link AwaitLoop}\n * for the full chain and the measurement (18.3% of all fleet tokens in one day spent on `echo .`).\n * A blocking Bash call is the only wait primitive it has, so webpieces provides one.\n *\n * ─── It INVENTS NO STATE ───────────────────────────────────────────────────────────────────────────\n * The set of reviewers a branch owes is `ChecklistScanner`'s answer — the SAME one `wp-review-upsert-pr`\n * lists and `wp-finish-upsert-pr` blocks on — and the verdicts are the `review-<id>.json` files those\n * two already read. Nothing here writes anything, and there is no third opinion about who is owed: a\n * waiter that computed its own set could finish while finish still refused, which is the one outcome\n * that would make waiting worse than not waiting.\n *\n * The scan runs ONCE. Its `applicable` set is a function of the diff, which does not change while the\n * agent sits still, so re-scanning per poll would re-run `git diff` every few seconds to re-derive an\n * unchanged answer. Only the verdict FILES are re-read, which is the only thing a reviewer changes.\n *\n * ─── What it does NOT do ───────────────────────────────────────────────────────────────────────────\n * It does not judge. A red verdict is a completed review, so this command RETURNS on it and prints it;\n * refusing the PR over it is `wp-finish-upsert-pr`'s job and stays there. It exits non-zero only when it\n * cannot do its own job at all.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class AwaitReviewsCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly checklistScanner: ChecklistScanner,\n private readonly reviewJsonService: ReviewJsonService,\n private readonly awaitLoop: AwaitLoop,\n private readonly stageConsole: StageOutputLog,\n private readonly receipts: ReviewStageReceiptService,\n private readonly aiBranchName: AiBranchName,\n ) {}\n\n async run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n const config = loadAndValidate(repoRoot).prGate;\n // contextStage '' — a WAIT must not write pr-context.json. That file records the diff a review\n // was briefed against, and rewriting it mid-review would restate the briefing under the\n // reviewers currently reading it.\n const scan = this.checklistScanner.scan(repoRoot, config.checklists, new ChecklistScanOptions(true, ''));\n if (scan.reviewersDisabled) return this.reportDisabled(scan.suppressed);\n if (scan.applicable.length === 0) return this.reportNothingOwed();\n // WAIT on the set finish blocks on (`outstanding`), REPORT on everything that applies. The two\n // sets differ by exactly the optional checklists nobody ran — `required: false` means the PR does\n // not wait for them, and a wait that did would never end, because nothing is ever going to write\n // a verdict for a reviewer that was deliberately never spawned. (The SET is shared with finish;\n // the PREDICATE is not — see `done()` for why a wait ends on arrival and finish does not.)\n // A verdict file older than the last stage ② is NOT an arrival: it is the stale green or rejected\n // file that stage just re-briefed (issue #863), and counting it would end the wait on the spot.\n const since = this.receipts.writtenAtMs(repoRoot, this.aiBranchName.getFeatureName());\n const probe = new ReviewerWaitProbe(\n this.reviewJsonService, scan.summaryPath, scan.outstanding, scan.applicable, since);\n const outcome = await this.awaitLoop.run(probe);\n this.report(probe, outcome);\n }\n\n // Nothing to wait for, and saying so is the whole value: an agent that got no answer here would\n // otherwise assume the wait is still owed and start spinning again.\n private reportNothingOwed(): void {\n this.stageConsole.say('\\n✅ No reviewer was requested for this branch — nothing to wait for.\\n');\n }\n\n private reportDisabled(suppressed: readonly RequiredChecklist[]): void {\n this.stageConsole.say(\n `\\n⚫ Every reviewer is switched off on this machine (experimental.turnOffAllReviewers), so `\n + `${String(suppressed.length)} checklist(s) that would have run are not running. There is `\n + 'nothing to wait for.\\n');\n }\n\n private report(probe: ReviewerWaitProbe, outcome: WaitOutcome): void {\n this.stageConsole.say(outcome.done ? probe.verdictReport(outcome) : probe.stillWaitingReport(outcome));\n }\n}\n\n/**\n * The reviewer wait itself: which checklists are owed, and what the files on disk say about them right\n * now. It owns the reporting too, because every line it prints is derived from the same verdict read —\n * a report that re-read the files could disagree with the answer that ended the wait.\n */\nexport class ReviewerWaitProbe implements WaitProbe {\n readonly label = 'reviewers';\n // Verdict files are local reads, so polling them costs nothing worth economizing on. Fast enough\n // that the command returns within seconds of the last reviewer finishing, which is the point.\n readonly pollMs = 3_000;\n\n private results: ChecklistResult[] = [];\n\n constructor(\n private readonly reviewJsonService: ReviewJsonService,\n private readonly summaryPath: string,\n private readonly waitedOn: readonly RequiredChecklist[],\n private readonly applicable: readonly RequiredChecklist[],\n // Epoch ms of the last stage ② (0 = none): a verdict file last written before it is not an answer.\n private readonly sinceMs: number,\n ) {\n this.reload();\n }\n\n /**\n * Done when every awaited reviewer has ANSWERED — not when every answer is a pass.\n *\n * That distinction is the whole contract of a wait, and getting it wrong makes the command useless\n * in the case it matters most. `ReviewJsonService.pendingChecklists` is finish's GATE predicate and\n * counts a RED verdict as still owed, correctly: the PR is refused until the finding is fixed. But\n * a red reviewer has finished; it will never write a different answer on its own, so waiting for it\n * to stop being red is waiting forever. The wait therefore ends on ARRIVAL — a verdict file that\n * exists, whatever it says — and `wp-finish-upsert-pr` keeps sole ownership of the gate.\n *\n * `CK_BAD_FORMAT` counts as arrived too: the file is there and unreadable, which is a thing to FIX\n * (four characters of JSON), not a thing to wait longer for.\n */\n done(): boolean {\n this.reload();\n return this.pending().length === 0;\n }\n\n describe(): string {\n const owed = this.pending().length;\n const total = this.waitedOn.length;\n return `${String(total - owed)} of ${String(total)} verdicts in`;\n }\n\n /** Every reviewer's answer, printed once the wait is over — the reason to wait rather than sleep. */\n verdictReport(outcome: WaitOutcome): string {\n // The headline counts what was WAITED ON; the list below covers everything that APPLIES, so an\n // optional checklist nobody ran shows as ❓ rather than being quietly dropped. Reporting only the\n // waited-on set would let a shorter list imply the others passed.\n const lines = [\n `\\n✅ All ${String(this.waitedOn.length)} awaited reviewer verdict(s) are in after `\n + `${String(outcome.waitedSeconds)}s:\\n`,\n ];\n for (const req of this.applicable) lines.push(this.oneVerdict(req));\n lines.push(this.nextStep());\n return lines.join('\\n') + '\\n';\n }\n\n /**\n * The timeout report. It is a NORMAL exit and says so, because an agent that reads this as a failure\n * goes hunting for a broken reviewer instead of running one more plain command.\n */\n stillWaitingReport(outcome: WaitOutcome): string {\n const owed = this.pending();\n return `\\n⏳ Still waiting after ${String(outcome.waitedSeconds)}s — run me again: pnpm wp-await-reviews\\n`\n + ' (This is not a failure. The wait returns before the harness kills a quiet command, so a\\n'\n + ' long review costs a handful of calls instead of hundreds of keep-alive turns.)\\n\\n'\n + ` ${String(owed.length)} of ${String(this.waitedOn.length)} still owe a verdict: `\n + `${owed.map((r: RequiredChecklist): string => r.id).join(', ')}\\n`;\n }\n\n private oneVerdict(req: RequiredChecklist): string {\n const verdict = this.reviewJsonService.resolveVerdict(req, this.results);\n return ` ${this.icon(verdict)} ${verdict.id} — ${verdict.status}${this.detail(verdict)}`;\n }\n\n // Only a NON-passing verdict's detail is printed. A green reviewer's output is already on the PR,\n // and reprinting four of them here would bury the one line that needs acting on.\n private detail(verdict: ChecklistVerdict): string {\n if (verdict.status !== CK_FAIL || verdict.detail === '') return '';\n return `\\n ${verdict.detail.split('\\n').join('\\n ')}`;\n }\n\n private icon(verdict: ChecklistVerdict): string {\n if (verdict.status === CK_FAIL) return '🔴';\n if (verdict.status === CK_MISSING || verdict.status === CK_BAD_FORMAT) return '❓';\n return '🟢';\n }\n\n // Named because a wait that ends without saying what it unblocked leaves the agent to guess, and\n // guessing here means spinning again. A red verdict changes the next move, so it is called out.\n private nextStep(): string {\n const anyRed = this.applicable.some((req: RequiredChecklist): boolean =>\n this.reviewJsonService.resolveVerdict(req, this.results).status === CK_FAIL);\n return anyRed\n ? '\\n A reviewer REFUSED. Fix what it found — re-spawning it against unchanged code buys the\\n'\n + ' same answer — then re-run the review stage.\\n'\n : '\\n Nothing is owed on the review front.\\n';\n }\n\n // The awaited checklists whose verdict file has not appeared yet — see `done()` for why this is\n // arrival and not the gate's own \"still owed\".\n private pending(): RequiredChecklist[] {\n return this.waitedOn.filter((req: RequiredChecklist): boolean =>\n this.reviewJsonService.resolveVerdict(req, this.results).status === CK_MISSING || this.predates(req));\n }\n\n private predates(req: RequiredChecklist): boolean {\n if (this.sinceMs === 0) return false;\n const file = this.reviewJsonService.checklistResultPath(this.summaryPath, req.id);\n return fs.existsSync(file) && fs.statSync(file).mtimeMs < this.sinceMs;\n }\n\n private reload(): void {\n this.results = this.reviewJsonService.loadChecklistResults(this.summaryPath, this.applicable);\n }\n}\n"]}
1
+ {"version":3,"file":"await-reviews-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/await-reviews-command.ts"],"names":[],"mappings":";;;;AAAA,0DAGiC;AACjC,yCAA2D;AAE3D,uDAA2E;AAC3E,qEAAuF;AACvF,2EAAgE;AAChE,2EAA6E;AAC7E,mEAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAEP;IACA;IACA;IACA;IACA;IACA;IACA;IAPrB,YACqB,cAA8B,EAC9B,gBAAkC,EAClC,iBAAoC,EACpC,SAAoB,EACpB,YAA4B,EAC5B,QAAmC,EACnC,YAA0B;QAN1B,mBAAc,GAAd,cAAc,CAAgB;QAC9B,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,cAAS,GAAT,SAAS,CAAW;QACpB,iBAAY,GAAZ,YAAY,CAAgB;QAC5B,aAAQ,GAAR,QAAQ,CAA2B;QACnC,iBAAY,GAAZ,YAAY,CAAc;IAC5C,CAAC;IAEJ,KAAK,CAAC,GAAG;QACL,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,IAAA,8BAAe,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;QAChD,+FAA+F;QAC/F,wFAAwF;QACxF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AsG,CAAC;QACjH,CAAC;QACD,OAAO,6CAA6C,CAAC;IACzD,CAAC;IAED,gGAAgG;IAChG,+CAA+C;IACvC,OAAO;QACX,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAsB,EAAW,EAAE,CAC5D,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,yBAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9G,CAAC;IAEO,QAAQ,CAAC,GAAsB;QACnC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAkB,EAAW,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;QACnF,OAAO,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;IACpE,CAAC;IAEO,MAAM;QACV,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAClG,CAAC;CACJ;AAxHD,8CAwHC","sourcesContent":["import {\n ChecklistResult, ChecklistVerdict, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, CK_ORANGE, loadAndValidate,\n RepoRootFinder, RequiredChecklist, ReviewJsonService,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { AwaitLoop, WaitOutcome, WaitProbe } from '../workflow/await-loop';\nimport { ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { ReviewStageReceiptService } from '../workflow/review-stage-receipt';\nimport { StageOutputLog } from '../workflow/stage-output-log';\n\n/**\n * `wp-await-reviews` — BLOCK until every reviewer stage ② requested for this branch has written its\n * verdict, then print what each one said.\n *\n * ─── Why a command and not an instruction ──────────────────────────────────────────────────────────\n * An agent that has just spawned four reviewer subagents has nothing to do until they answer, and a\n * worktree-isolated subagent cannot simply wait: ending its turn ends its run. See {@link AwaitLoop}\n * for the full chain and the measurement (18.3% of all fleet tokens in one day spent on `echo .`).\n * A blocking Bash call is the only wait primitive it has, so webpieces provides one.\n *\n * ─── It INVENTS NO STATE ───────────────────────────────────────────────────────────────────────────\n * The set of reviewers a branch owes is `ChecklistScanner`'s answer — the SAME one `wp-review-upsert-pr`\n * lists and `wp-finish-upsert-pr` blocks on — and the verdicts are the `review-round<N>-<id>.json` files those\n * two already read. Nothing here writes anything, and there is no third opinion about who is owed: a\n * waiter that computed its own set could finish while finish still refused, which is the one outcome\n * that would make waiting worse than not waiting.\n *\n * The scan runs ONCE. Its `applicable` set is a function of the diff, which does not change while the\n * agent sits still, so re-scanning per poll would re-run `git diff` every few seconds to re-derive an\n * unchanged answer. Only the verdict FILES are re-read, which is the only thing a reviewer changes.\n *\n * ─── What it does NOT do ───────────────────────────────────────────────────────────────────────────\n * It does not judge. A red verdict is a completed review, so this command RETURNS on it and prints it;\n * refusing the PR over it is `wp-finish-upsert-pr`'s job and stays there. It exits non-zero only when it\n * cannot do its own job at all.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class AwaitReviewsCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly checklistScanner: ChecklistScanner,\n private readonly reviewJsonService: ReviewJsonService,\n private readonly awaitLoop: AwaitLoop,\n private readonly stageConsole: StageOutputLog,\n private readonly receipts: ReviewStageReceiptService,\n private readonly aiBranchName: AiBranchName,\n ) {}\n\n async run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n const config = loadAndValidate(repoRoot).prGate;\n // contextStage '' — a WAIT must not write pr-context.json. That file records the diff a review\n // was briefed against, and rewriting it mid-review would restate the briefing under the\n // reviewers currently reading it.\n const scan = this.checklistScanner.scan(repoRoot, config.checklists, new ChecklistScanOptions(config.maxReviewerRounds, true, ''));\n if (scan.reviewersDisabled) return this.reportDisabled(scan.suppressed);\n if (scan.applicable.length === 0) return this.reportNothingOwed();\n // WAIT on the set finish blocks on (`outstanding`), REPORT on everything that applies. The two\n // sets differ by exactly the optional checklists nobody ran — `required: false` means the PR does\n // not wait for them, and a wait that did would never end, because nothing is ever going to write\n // a verdict for a reviewer that was deliberately never spawned. (The SET is shared with finish;\n // the PREDICATE is not — see `done()` for why a wait ends on arrival and finish does not.)\n // A verdict from an EARLIER round than the one stage ② last briefed is NOT an arrival: it is the red\n // that round re-briefed (issue #1053), and counting it would end the wait on the spot.\n const round = this.receipts.read(repoRoot, this.aiBranchName.getFeatureName())?.round ?? 0;\n const probe = new ReviewerWaitProbe(\n this.reviewJsonService, scan.summaryPath, scan.outstanding, scan.applicable, round);\n const outcome = await this.awaitLoop.run(probe);\n this.report(probe, outcome);\n }\n\n // Nothing to wait for, and saying so is the whole value: an agent that got no answer here would\n // otherwise assume the wait is still owed and start spinning again.\n private reportNothingOwed(): void {\n this.stageConsole.say('\\n✅ No reviewer was requested for this branch — nothing to wait for.\\n');\n }\n\n private reportDisabled(suppressed: readonly RequiredChecklist[]): void {\n this.stageConsole.say(\n `\\n⚫ Every reviewer is switched off on this machine (experimental.turnOffAllReviewers), so `\n + `${String(suppressed.length)} checklist(s) that would have run are not running. There is `\n + 'nothing to wait for.\\n');\n }\n\n private report(probe: ReviewerWaitProbe, outcome: WaitOutcome): void {\n this.stageConsole.say(outcome.done ? probe.verdictReport(outcome) : probe.stillWaitingReport(outcome));\n }\n}\n\n/**\n * The reviewer wait itself: which checklists are owed, and what the files on disk say about them right\n * now. It owns the reporting too, because every line it prints is derived from the same verdict read —\n * a report that re-read the files could disagree with the answer that ended the wait.\n */\nexport class ReviewerWaitProbe implements WaitProbe {\n readonly label = 'reviewers';\n // Verdict files are local reads, so polling them costs nothing worth economizing on. Fast enough\n // that the command returns within seconds of the last reviewer finishing, which is the point.\n readonly pollMs = 3_000;\n\n private results: ChecklistResult[] = [];\n\n constructor(\n private readonly reviewJsonService: ReviewJsonService,\n private readonly summaryPath: string,\n private readonly waitedOn: readonly RequiredChecklist[],\n private readonly applicable: readonly RequiredChecklist[],\n // The round stage ② last briefed (0 = none): a verdict from an earlier round is not an answer.\n private readonly briefedRound: number,\n ) {\n this.reload();\n }\n\n /**\n * Done when every awaited reviewer has ANSWERED — not when every answer is a pass.\n *\n * That distinction is the whole contract of a wait, and getting it wrong makes the command useless\n * in the case it matters most. `ReviewJsonService.pendingChecklists` is finish's GATE predicate and\n * counts a RED verdict as still owed, correctly: the PR is refused until the finding is fixed. But\n * a red reviewer has finished; it will never write a different answer on its own, so waiting for it\n * to stop being red is waiting forever. The wait therefore ends on ARRIVAL — a verdict file that\n * exists, whatever it says — and `wp-finish-upsert-pr` keeps sole ownership of the gate.\n *\n * `CK_BAD_FORMAT` counts as arrived too: the file is there and unreadable, which is a thing to FIX\n * (four characters of JSON), not a thing to wait longer for.\n */\n done(): boolean {\n this.reload();\n return this.pending().length === 0;\n }\n\n describe(): string {\n const owed = this.pending().length;\n const total = this.waitedOn.length;\n return `${String(total - owed)} of ${String(total)} verdicts in`;\n }\n\n /** Every reviewer's answer, printed once the wait is over — the reason to wait rather than sleep. */\n verdictReport(outcome: WaitOutcome): string {\n // The headline counts what was WAITED ON; the list below covers everything that APPLIES, so an\n // optional checklist nobody ran shows as ❓ rather than being quietly dropped. Reporting only the\n // waited-on set would let a shorter list imply the others passed.\n const lines = [\n `\\n✅ All ${String(this.waitedOn.length)} awaited reviewer verdict(s) are in after `\n + `${String(outcome.waitedSeconds)}s:\\n`,\n ];\n for (const req of this.applicable) lines.push(this.oneVerdict(req));\n lines.push(this.nextStep());\n return lines.join('\\n') + '\\n';\n }\n\n /**\n * The timeout report. It is a NORMAL exit and says so, because an agent that reads this as a failure\n * goes hunting for a broken reviewer instead of running one more plain command.\n */\n stillWaitingReport(outcome: WaitOutcome): string {\n const owed = this.pending();\n return `\\n⏳ Still waiting after ${String(outcome.waitedSeconds)}s — run me again: pnpm wp-await-reviews\\n`\n + ' (This is not a failure. The wait returns before the harness kills a quiet command, so a\\n'\n + ' long review costs a handful of calls instead of hundreds of keep-alive turns.)\\n\\n'\n + ` ${String(owed.length)} of ${String(this.waitedOn.length)} still owe a verdict: `\n + `${owed.map((r: RequiredChecklist): string => r.id).join(', ')}\\n`;\n }\n\n private oneVerdict(req: RequiredChecklist): string {\n const verdict = this.reviewJsonService.resolveVerdict(req, this.results);\n return ` ${this.icon(verdict)} ${verdict.id} — ${verdict.status}${this.detail(verdict)}`;\n }\n\n // Only a NON-passing verdict's detail is printed. A green reviewer's output is already on the PR,\n // and reprinting four of them here would bury the one line that needs acting on.\n private detail(verdict: ChecklistVerdict): string {\n if ((verdict.status !== CK_FAIL && verdict.status !== CK_ORANGE) || verdict.detail === '') return '';\n return `\\n ${verdict.detail.split('\\n').join('\\n ')}`;\n }\n\n private icon(verdict: ChecklistVerdict): string {\n if (verdict.status === CK_FAIL) return '🔴';\n if (verdict.status === CK_ORANGE) return '🟠';\n if (verdict.status === CK_MISSING || verdict.status === CK_BAD_FORMAT) return '❓';\n return '🟢';\n }\n\n // Named because a wait that ends without saying what it unblocked leaves the agent to guess, and\n // guessing here means spinning again. A red verdict changes the next move, so it is called out.\n private nextStep(): string {\n const statuses = this.applicable.map((req: RequiredChecklist): string =>\n this.reviewJsonService.resolveVerdict(req, this.results).status);\n if (statuses.includes(CK_FAIL)) {\n return '\\n A reviewer REFUSED. Fix what it found — re-spawning it against unchanged code buys the\\n'\n + ' same answer — then re-run the review stage.\\n';\n }\n if (statuses.includes(CK_ORANGE)) {\n return '\\n A final-round reviewer marked ORANGE. Fix what it found, best effort, commit, and record the\\n'\n + ' fixes with pnpm wp-write-review-fixes. Do NOT spawn a reviewer: that was the last review round.\\n';\n }\n return '\\n Nothing is owed on the review front.\\n';\n }\n\n // The awaited checklists whose verdict file has not appeared yet — see `done()` for why this is\n // arrival and not the gate's own \"still owed\".\n private pending(): RequiredChecklist[] {\n return this.waitedOn.filter((req: RequiredChecklist): boolean =>\n this.reviewJsonService.resolveVerdict(req, this.results).status === CK_MISSING || this.predates(req));\n }\n\n private predates(req: RequiredChecklist): boolean {\n const result = this.results.find((r: ChecklistResult): boolean => r.id === req.id);\n return result !== undefined && result.round < this.briefedRound;\n }\n\n private reload(): void {\n this.results = this.reviewJsonService.loadChecklistResults(this.summaryPath, this.applicable);\n }\n}\n"]}
@@ -189,24 +189,21 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
189
189
  }
190
190
  // 1. REQUIRE stage ② — see assertStageTwoRan. Returns true when its receipt covers THIS commit,
191
191
  // which is what lets the build gate below be skipped rather than re-run for a foregone answer.
192
+ const featureName = this.aiBranchName.getFeatureName();
193
+ const config = (0, rules_config_1.loadAndValidate)(repoRoot).prGate;
192
194
  const buildAlreadyGreen = this.assertStageTwoRan(repoRoot);
193
195
  // 2. REQUIRE the AI-authored summary.json (throws InformAiError with the schema if missing/invalid).
194
196
  // Compute the consumer checklists this diff triggered FIRST so an unacknowledged BLOCK throws
195
197
  // here — BEFORE any `gh pr create` — matching the guarantee buildCommand already provides.
196
198
  // The SAME scan wp-review-upsert-pr runs, with filterAlreadyReviewed:true so `outstanding` is exactly what
197
199
  // still owes a verdict (Z of N of X). Sharing the computation is the point: the command that REPORTS
198
- // and the command that GATES must not be able to disagree about what is owed. review-<id>.json files
200
+ // and the command that GATES must not be able to disagree about what is owed. review-round<N>-<id>.json files
199
201
  // persist locally, so a re-run re-validates the EXISTING verdicts against the (possibly changed)
200
202
  // applicable set for free — an unchanged checklist needs no re-review, a newly-applicable one refuses
201
203
  // until its file is written.
202
- const featureName = this.aiBranchName.getFeatureName();
203
- const config = (0, rules_config_1.loadAndValidate)(repoRoot).prGate;
204
- const scan = this.checklistScanner.scan(repoRoot, config.checklists, new checklist_scanner_1.ChecklistScanOptions(true, 'stage3-finish'));
205
- const receipt = this.receipts.read(repoRoot, featureName);
206
- const remediations = this.rounds.capRemediations(repoRoot, scan.summaryPath, receipt, config.maxReviewerRounds);
207
- for (const result of scan.results)
208
- result.remediation = remediations[result.id] ?? '';
209
- scan.outstanding = scan.outstanding.filter((req) => remediations[req.id] === undefined);
204
+ // The scan judges ONLY the checklists that were briefed (issue #1053) — never one a later commit newly
205
+ // triggered — and it has already folded every recorded orange fix into its results.
206
+ const scan = this.checklistScanner.scan(repoRoot, config.checklists, new checklist_scanner_1.ChecklistScanOptions(config.maxReviewerRounds, true, 'stage3-finish'));
210
207
  const required = scan.applicable;
211
208
  // The applicable checklists that are supposed to HAVE a verdict — everything except the optional ones
212
209
  // nobody ran. Used for provenance and for the dashboard rows, both of which ask "who reviewed this?"
@@ -217,10 +214,10 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
217
214
  // FAIL FAST on an unclear checklist, BEFORE summary.json is parsed and before the build gate runs. A
218
215
  // missing reviewer is not a summary.json defect (folding it in made the AI fix the wrong thing), and
219
216
  // nobody should wait on a build to be told a reviewer never ran. ReviewerVerdictGate owns the
220
- // distinction between unreadable / REFUSED / never-ran, and retires the red verdicts it acts on.
217
+ // distinction between unreadable / ORANGE / REFUSED / never-ran.
221
218
  this.verdictGate.assertEveryReviewerRan(scan);
222
- const review = this.reviewJsonService.loadSummaryJson((0, rules_config_1.summaryJsonPath)(repoRoot, featureName), required, '', remediations);
223
- this.applyRoundAudits(review, scan, receipt);
219
+ const review = this.reviewJsonService.loadSummaryJson((0, rules_config_1.summaryJsonPath)(repoRoot, featureName), required, '', scan.orangeFixes);
220
+ this.applyRoundAudits(review, scan, config.maxReviewerRounds);
224
221
  // 2c. For every verdicted checklist, VERIFY (from the harness's own artifacts) that a real reviewer
225
222
  // SUBAGENT actually ran on this branch — the coding agent may not self-certify. Its NAME is not
226
223
  // checked; see SubagentProvenanceService.isReviewerRun. Absent CLAUDE_CODE_SESSION_ID this skips with a warning (CI / plain terminal).
@@ -245,9 +242,9 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
245
242
  this.stageConsole.say(this.banner.render(bannerInput));
246
243
  this.stageConsole.say(this.banner.linkDirective(bannerInput));
247
244
  }
248
- applyRoundAudits(review, scan, receipt) {
245
+ applyRoundAudits(review, scan, maxReviewerRounds) {
249
246
  for (const result of review.results) {
250
- const trail = this.rounds.auditTrail(scan.summaryPath, result.id, receipt);
247
+ const trail = this.rounds.auditTrail(scan.summaryPath, result.id, maxReviewerRounds);
251
248
  if (trail === '')
252
249
  continue;
253
250
  result.output = trail;
@@ -356,11 +353,12 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
356
353
  }
357
354
  if (receipt.headSha === headSha)
358
355
  return true;
359
- // Not fatal. Re-reviewing on every follow-up commit would be intolerable, and most drift is a typo
360
- // fix. But it is never silent: the build re-runs here, and the PR says the reviewers saw an older tree.
356
+ // Not fatal, and never a re-review (issue #1053): a green or yellow verdict stands whatever changed
357
+ // since, and only a RED with a round left ever opens another round. Suggesting a re-review here
358
+ // would be an instruction the gate itself refuses. It is never silent either: the build re-runs.
361
359
  process.stderr.write(`\n⚠️ HEAD moved since stage ② ran (reviewed ${receipt.headSha.slice(0, 8)}, now ${headSha.slice(0, 8)}).\n` +
362
- ' The build gate will re-run, and the PR will record that reviewers judged an earlier tree.\n' +
363
- ' If the change was substantive, re-run pnpm wp-review-upsert-pr and re-spawn the reviewers.\n\n');
360
+ ' The build gate will re-run. No further review runs for this: every verdict is carried forward\n' +
361
+ ' from the reviewed tree, and the PR records that the reviewers judged an earlier commit.\n\n');
364
362
  return false;
365
363
  }
366
364
  /**
@@ -427,7 +425,9 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
427
425
  // `scan.suppressed.length`, never `scan.reviewersDisabled` alone: the dashboard and the commit
428
426
  // body have to state HOW MANY reviewers were killed, because a suppressed 4 and an applicable 0
429
427
  // are different facts that both render as an empty `rows`. See DashboardInput.
430
- return new dashboard_1.DashboardInput(title, gateResults, disables, buildPassed, forkPoint, featureHead, mainHead, review, rows, this.buildAffected.resolveBuildCommand(repoRoot), scan.suppressed.length, this.authorIdentity.resolve(review.model), hotfix);
428
+ const input = new dashboard_1.DashboardInput(title, gateResults, disables, buildPassed, forkPoint, featureHead, mainHead, review, rows, this.buildAffected.resolveBuildCommand(repoRoot), scan.suppressed.length, this.authorIdentity.resolve(review.model), hotfix);
429
+ input.notBriefed = scan.notBriefed.map((r) => r.id);
430
+ return input;
431
431
  }
432
432
  /**
433
433
  * The applicable checklists MINUS the optional ones nobody ran.
@@ -466,15 +466,20 @@ let FinishUpsertPrCommand = class FinishUpsertPrCommand {
466
466
  const readByChecklist = new Map();
467
467
  for (const e of provenance.evidence)
468
468
  readByChecklist.set(e.checklistId, e.readDiff);
469
+ const judged = new Set(scan.applicable.map((r) => r.id));
470
+ const notBriefed = new Set(scan.notBriefed.map((r) => r.id));
469
471
  return scan.roster.entries.map((entry) => {
470
- const ran = entry.matchedFiles.length > 0;
472
+ // A briefed checklist is judged whether or not the final diff still matches it (the set is
473
+ // frozen at the briefing, issue #1053); a newly-triggered one is shown, never judged.
474
+ const ran = judged.has(entry.def.id) || entry.matchedFiles.length > 0;
471
475
  const req = new rules_config_1.RequiredChecklist(entry.def.id, entry.def.reviewer, entry.def.doc, entry.matchedFiles, entry.matchedPatterns, entry.def.required);
472
476
  // A skipped checklist has no verdict to resolve — asking for one would report it as MISSING,
473
477
  // i.e. as an unreviewed obligation, when in fact it never had one.
474
- const verdict = ran ? this.reviewJsonService.resolveVerdict(req, review.results) : new rules_config_1.ChecklistVerdict(entry.def.id, '', '');
478
+ const verdict = ran && !notBriefed.has(entry.def.id) ? this.reviewJsonService.resolveVerdict(req, review.results) : new rules_config_1.ChecklistVerdict(entry.def.id, '', '');
475
479
  const identity = review.results.find((result) => result.id === entry.def.id);
476
480
  const row = new checklist_comment_row_1.ChecklistCommentRow(identity?.agent ?? 'unknown', identity?.model ?? 'unknown', entry.def.id, verdict.status, verdict.detail, ran, entry.def.patterns, entry.matchedPatterns, entry.matchedFiles, scan.roster.changedFileCount);
477
481
  row.required = entry.def.required;
482
+ row.notBriefed = notBriefed.has(entry.def.id);
478
483
  const read = readByChecklist.get(entry.def.id);
479
484
  row.diffRead = read === undefined ? '' : read ? 'yes' : 'no';
480
485
  return row;