@webpieces/pr-gate 0.4.975 → 0.4.977

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 (182) hide show
  1. package/package.json +6 -6
  2. package/src/scripts/commands/await-checks-command.d.ts +6 -3
  3. package/src/scripts/commands/await-checks-command.js +17 -12
  4. package/src/scripts/commands/await-checks-command.js.map +1 -1
  5. package/src/scripts/commands/await-reviews-command.d.ts +1 -1
  6. package/src/scripts/commands/await-reviews-command.js +3 -3
  7. package/src/scripts/commands/await-reviews-command.js.map +1 -1
  8. package/src/scripts/commands/check-pr-command.d.ts +3 -1
  9. package/src/scripts/commands/check-pr-command.js +12 -9
  10. package/src/scripts/commands/check-pr-command.js.map +1 -1
  11. package/src/scripts/commands/cleanup-command.js +12 -12
  12. package/src/scripts/commands/cleanup-command.js.map +1 -1
  13. package/src/scripts/commands/finish-push-dev-command.js +3 -4
  14. package/src/scripts/commands/finish-push-dev-command.js.map +1 -1
  15. package/src/scripts/commands/finish-update-command.js +1 -1
  16. package/src/scripts/commands/finish-update-command.js.map +1 -1
  17. package/src/scripts/commands/finish-upsert-pr-command.d.ts +4 -1
  18. package/src/scripts/commands/finish-upsert-pr-command.js +65 -62
  19. package/src/scripts/commands/finish-upsert-pr-command.js.map +1 -1
  20. package/src/scripts/commands/human-post-pr-command.d.ts +8 -6
  21. package/src/scripts/commands/human-post-pr-command.js +33 -32
  22. package/src/scripts/commands/human-post-pr-command.js.map +1 -1
  23. package/src/scripts/commands/land-pr-command.d.ts +5 -1
  24. package/src/scripts/commands/land-pr-command.js +37 -23
  25. package/src/scripts/commands/land-pr-command.js.map +1 -1
  26. package/src/scripts/commands/main-checkout.d.ts +4 -1
  27. package/src/scripts/commands/main-checkout.js +22 -22
  28. package/src/scripts/commands/main-checkout.js.map +1 -1
  29. package/src/scripts/commands/push-dev-command.js +28 -29
  30. package/src/scripts/commands/push-dev-command.js.map +1 -1
  31. package/src/scripts/commands/reap-worktree-command.js +4 -5
  32. package/src/scripts/commands/reap-worktree-command.js.map +1 -1
  33. package/src/scripts/commands/review-upsert-pr-command.js +10 -10
  34. package/src/scripts/commands/review-upsert-pr-command.js.map +1 -1
  35. package/src/scripts/commands/start-update-command.d.ts +1 -1
  36. package/src/scripts/commands/start-update-command.js +3 -3
  37. package/src/scripts/commands/start-update-command.js.map +1 -1
  38. package/src/scripts/commands/start-upsert-pr-command.js +4 -4
  39. package/src/scripts/commands/start-upsert-pr-command.js.map +1 -1
  40. package/src/scripts/commands/sync-main-command.js +6 -6
  41. package/src/scripts/commands/sync-main-command.js.map +1 -1
  42. package/src/scripts/commands/upsert-hotfix-pr-command.d.ts +6 -4
  43. package/src/scripts/commands/upsert-hotfix-pr-command.js +46 -43
  44. package/src/scripts/commands/upsert-hotfix-pr-command.js.map +1 -1
  45. package/src/scripts/commands/working-tree-gate.d.ts +4 -1
  46. package/src/scripts/commands/working-tree-gate.js +14 -11
  47. package/src/scripts/commands/working-tree-gate.js.map +1 -1
  48. package/src/scripts/commands/worktree-cleanup.d.ts +4 -4
  49. package/src/scripts/commands/worktree-cleanup.js +4 -4
  50. package/src/scripts/commands/worktree-cleanup.js.map +1 -1
  51. package/src/scripts/commands/write-review-command.js +4 -6
  52. package/src/scripts/commands/write-review-command.js.map +1 -1
  53. package/src/scripts/commands/write-review-fixes-command.js +3 -4
  54. package/src/scripts/commands/write-review-fixes-command.js.map +1 -1
  55. package/src/scripts/git-finishUpsertPr.js +2 -2
  56. package/src/scripts/git-finishUpsertPr.js.map +1 -1
  57. package/src/scripts/git-gatherInfo.js +6 -7
  58. package/src/scripts/git-gatherInfo.js.map +1 -1
  59. package/src/scripts/pr-gate-container.d.ts +9 -0
  60. package/src/scripts/pr-gate-container.js +19 -0
  61. package/src/scripts/pr-gate-container.js.map +1 -0
  62. package/src/scripts/workflow/await-loop.d.ts +1 -1
  63. package/src/scripts/workflow/await-loop.js +1 -1
  64. package/src/scripts/workflow/await-loop.js.map +1 -1
  65. package/src/scripts/workflow/build-affected.js +1 -1
  66. package/src/scripts/workflow/build-affected.js.map +1 -1
  67. package/src/scripts/workflow/build-artifact-gate.d.ts +1 -1
  68. package/src/scripts/workflow/build-artifact-gate.js +3 -3
  69. package/src/scripts/workflow/build-artifact-gate.js.map +1 -1
  70. package/src/scripts/workflow/build-gate-log.d.ts +9 -6
  71. package/src/scripts/workflow/build-gate-log.js +34 -40
  72. package/src/scripts/workflow/build-gate-log.js.map +1 -1
  73. package/src/scripts/workflow/checklist-detector.d.ts +2 -2
  74. package/src/scripts/workflow/checklist-detector.js +4 -4
  75. package/src/scripts/workflow/checklist-detector.js.map +1 -1
  76. package/src/scripts/workflow/checklist-scanner.d.ts +1 -1
  77. package/src/scripts/workflow/checklist-scanner.js +11 -11
  78. package/src/scripts/workflow/checklist-scanner.js.map +1 -1
  79. package/src/scripts/workflow/checklist-scope-hasher.d.ts +1 -1
  80. package/src/scripts/workflow/checklist-scope-hasher.js +2 -2
  81. package/src/scripts/workflow/checklist-scope-hasher.js.map +1 -1
  82. package/src/scripts/workflow/dev-deploy-refs.d.ts +5 -5
  83. package/src/scripts/workflow/dev-deploy-refs.js +8 -8
  84. package/src/scripts/workflow/dev-deploy-refs.js.map +1 -1
  85. package/src/scripts/workflow/dev-resolve-runner.d.ts +3 -3
  86. package/src/scripts/workflow/dev-resolve-runner.js +30 -30
  87. package/src/scripts/workflow/dev-resolve-runner.js.map +1 -1
  88. package/src/scripts/workflow/diff-basis.d.ts +4 -2
  89. package/src/scripts/workflow/diff-basis.js +18 -15
  90. package/src/scripts/workflow/diff-basis.js.map +1 -1
  91. package/src/scripts/workflow/diff-materializer.d.ts +5 -3
  92. package/src/scripts/workflow/diff-materializer.js +18 -15
  93. package/src/scripts/workflow/diff-materializer.js.map +1 -1
  94. package/src/scripts/workflow/gated-pr-publisher.d.ts +8 -6
  95. package/src/scripts/workflow/gated-pr-publisher.js +23 -22
  96. package/src/scripts/workflow/gated-pr-publisher.js.map +1 -1
  97. package/src/scripts/workflow/generated-artifact-registry.d.ts +4 -2
  98. package/src/scripts/workflow/generated-artifact-registry.js +11 -8
  99. package/src/scripts/workflow/generated-artifact-registry.js.map +1 -1
  100. package/src/scripts/workflow/git-exec.d.ts +22 -12
  101. package/src/scripts/workflow/git-exec.js +45 -29
  102. package/src/scripts/workflow/git-exec.js.map +1 -1
  103. package/src/scripts/workflow/git-findForkPoint.d.ts +6 -2
  104. package/src/scripts/workflow/git-findForkPoint.js +31 -23
  105. package/src/scripts/workflow/git-findForkPoint.js.map +1 -1
  106. package/src/scripts/workflow/git-readAiBranchName.d.ts +4 -2
  107. package/src/scripts/workflow/git-readAiBranchName.js +8 -5
  108. package/src/scripts/workflow/git-readAiBranchName.js.map +1 -1
  109. package/src/scripts/workflow/hotfix-pr-publisher.d.ts +4 -3
  110. package/src/scripts/workflow/hotfix-pr-publisher.js +7 -6
  111. package/src/scripts/workflow/hotfix-pr-publisher.js.map +1 -1
  112. package/src/scripts/workflow/landed-tree-resolver.d.ts +4 -2
  113. package/src/scripts/workflow/landed-tree-resolver.js +11 -8
  114. package/src/scripts/workflow/landed-tree-resolver.js.map +1 -1
  115. package/src/scripts/workflow/landed-worktree-reaper.d.ts +4 -2
  116. package/src/scripts/workflow/landed-worktree-reaper.js +12 -9
  117. package/src/scripts/workflow/landed-worktree-reaper.js.map +1 -1
  118. package/src/scripts/workflow/merge-end.d.ts +5 -4
  119. package/src/scripts/workflow/merge-end.js +28 -27
  120. package/src/scripts/workflow/merge-end.js.map +1 -1
  121. package/src/scripts/workflow/merge-start.d.ts +5 -1
  122. package/src/scripts/workflow/merge-start.js +56 -49
  123. package/src/scripts/workflow/merge-start.js.map +1 -1
  124. package/src/scripts/workflow/open-pr-check.d.ts +4 -2
  125. package/src/scripts/workflow/open-pr-check.js +11 -8
  126. package/src/scripts/workflow/open-pr-check.js.map +1 -1
  127. package/src/scripts/workflow/pr-comment-upserter.d.ts +5 -3
  128. package/src/scripts/workflow/pr-comment-upserter.js +15 -14
  129. package/src/scripts/workflow/pr-comment-upserter.js.map +1 -1
  130. package/src/scripts/workflow/pr-context-writer.d.ts +1 -1
  131. package/src/scripts/workflow/pr-context-writer.js +3 -3
  132. package/src/scripts/workflow/pr-context-writer.js.map +1 -1
  133. package/src/scripts/workflow/pr-merger.d.ts +8 -5
  134. package/src/scripts/workflow/pr-merger.js +32 -27
  135. package/src/scripts/workflow/pr-merger.js.map +1 -1
  136. package/src/scripts/workflow/provenance-enforcer.d.ts +4 -2
  137. package/src/scripts/workflow/provenance-enforcer.js +19 -17
  138. package/src/scripts/workflow/provenance-enforcer.js.map +1 -1
  139. package/src/scripts/workflow/review-round-state.d.ts +7 -6
  140. package/src/scripts/workflow/review-round-state.js +33 -38
  141. package/src/scripts/workflow/review-round-state.js.map +1 -1
  142. package/src/scripts/workflow/run-update.js +1 -1
  143. package/src/scripts/workflow/run-update.js.map +1 -1
  144. package/src/scripts/workflow/squash-settings-enforcer.d.ts +6 -3
  145. package/src/scripts/workflow/squash-settings-enforcer.js +19 -14
  146. package/src/scripts/workflow/squash-settings-enforcer.js.map +1 -1
  147. package/src/scripts/wp-await-checks.js +2 -2
  148. package/src/scripts/wp-await-checks.js.map +1 -1
  149. package/src/scripts/wp-await-reviews.js +2 -2
  150. package/src/scripts/wp-await-reviews.js.map +1 -1
  151. package/src/scripts/wp-build.js +2 -2
  152. package/src/scripts/wp-build.js.map +1 -1
  153. package/src/scripts/wp-check-pr.js +2 -2
  154. package/src/scripts/wp-check-pr.js.map +1 -1
  155. package/src/scripts/wp-cleanup.js +2 -2
  156. package/src/scripts/wp-cleanup.js.map +1 -1
  157. package/src/scripts/wp-finish-push-dev.js +2 -2
  158. package/src/scripts/wp-finish-push-dev.js.map +1 -1
  159. package/src/scripts/wp-finish-update.js +2 -2
  160. package/src/scripts/wp-finish-update.js.map +1 -1
  161. package/src/scripts/wp-human-post-pr.js +2 -2
  162. package/src/scripts/wp-human-post-pr.js.map +1 -1
  163. package/src/scripts/wp-land-pr.js +2 -2
  164. package/src/scripts/wp-land-pr.js.map +1 -1
  165. package/src/scripts/wp-push-dev.js +2 -2
  166. package/src/scripts/wp-push-dev.js.map +1 -1
  167. package/src/scripts/wp-reap-worktree.js +2 -2
  168. package/src/scripts/wp-reap-worktree.js.map +1 -1
  169. package/src/scripts/wp-review-upsert-pr.js +2 -2
  170. package/src/scripts/wp-review-upsert-pr.js.map +1 -1
  171. package/src/scripts/wp-start-update.js +2 -2
  172. package/src/scripts/wp-start-update.js.map +1 -1
  173. package/src/scripts/wp-start-upsert-pr.js +2 -2
  174. package/src/scripts/wp-start-upsert-pr.js.map +1 -1
  175. package/src/scripts/wp-sync-main.js +2 -2
  176. package/src/scripts/wp-sync-main.js.map +1 -1
  177. package/src/scripts/wp-upsert-hotfix-pr.js +2 -2
  178. package/src/scripts/wp-upsert-hotfix-pr.js.map +1 -1
  179. package/src/scripts/wp-write-review-fixes.js +2 -2
  180. package/src/scripts/wp-write-review-fixes.js.map +1 -1
  181. package/src/scripts/wp-write-review.js +2 -2
  182. package/src/scripts/wp-write-review.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"checklist-scanner.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/checklist-scanner.ts"],"names":[],"mappings":";;;;AAAA,0DAGiC;AACjC,yCAA2D;AAC3D,iEAAsD;AACtD,6DAA8F;AAC9F,6CAA4D;AAC5D,2DAAsD;AACtD,qEAAgE;AAChE,6DAE8B;AAC9B,iEAAmE;AACnE,6DAA+D;AAE/D,uEAAuE;AACvE,MAAa,oBAAoB;IAC7B;;;;OAIG;IACH,qBAAqB,CAAU;IAC/B;;;;;;;;;;;;OAYG;IACH,YAAY,CAAS;IACrB;;;;OAIG;IACH,iBAAiB,CAAS;IAE1B,YAAY,iBAAyB,EAAE,qBAAqB,GAAG,KAAK,EAAE,YAAY,GAAG,YAAY;QAC7F,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,qBAAqB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,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;CACJ,CAAA;AArMY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGF,mCAAY;QACP,sCAAiB;QACzB,wBAAS;QACD,8BAAiB;QACnB,mCAAe;QACb,gCAAiB;QAGxB,gCAAiB;QAChB,6CAAoB;QACd,6CAAwB;QACjC,gDAAyB;QAC3B,4CAAuB;GAd3C,gBAAgB,CAqM5B","sourcesContent":["import {\n ChangedFilesOptions, ChecklistDefinition, ChecklistResult, ChecklistReviewContext, DiffScope,\n HomeConfigService, RequiredChecklist, ReviewJsonService, VERDICT_RED, summaryJsonPath,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from './git-readAiBranchName';\nimport { ChecklistDetector, ChecklistRoster, TriggeredChecklist } from './checklist-detector';\nimport { DiffBasis, DiffBasisResolver } from './diff-basis';\nimport { PrContextWriter } from './pr-context-writer';\nimport { ChecklistScopeHasher } from './checklist-scope-hasher';\nimport {\n STANDING_CARRIED, STANDING_REJECTED, STANDING_STALE, VerdictProvenanceService, VerdictStanding,\n} from './verdict-provenance';\nimport { ReviewStageReceiptService } from './review-stage-receipt';\nimport { ReviewRoundStateService } from './review-round-state';\n\n/** How a caller wants the scan filtered. Data-only (per CLAUDE.md). */\nexport class ChecklistScanOptions {\n /**\n * false — `outstanding` is every applicable checklist (what `wp-review-upsert-pr` LISTS).\n * true — `outstanding` drops the ones already carrying a passing/overridden verdict, leaving only what\n * still owes review (what `wp-finish-upsert-pr` BLOCKS on).\n */\n filterAlreadyReviewed: boolean;\n /**\n * Which per-stage snapshot this scan should persist ('stage3-finish', …), or '' for \"do not write\n * pr-context.json here\".\n *\n * '' exists for stage ②, which cannot write yet: the context records `diffDir`, and the diff has not\n * been materialized at scan time. Letting the scan write anyway meant stage ② wrote the file twice,\n * ~60 lines apart, the first time with an empty diffDir. Now it writes once, after materializing.\n *\n * The DEFAULT is deliberately non-empty, so writing is what you get by NOT thinking about it. A\n * reviewer block that lost its diff command because nobody had written pr-context.json is a bug this\n * codebase has already shipped once (see PrContextWriter's docstring); opting out must be an explicit,\n * visible act by a caller that takes responsibility for writing it later — not an omission.\n */\n contextStage: string;\n /**\n * `commands.pr-gate.maxReviewerRounds`, as the caller's validated config states it. REQUIRED and first,\n * so a scan always states the budget its CARRIED verdicts were judged under (issue #1053: a stale green\n * or yellow is carried whatever round it came from, and the reason names the budget).\n */\n maxReviewerRounds: number;\n\n constructor(maxReviewerRounds: number, filterAlreadyReviewed = false, contextStage = 'stage-scan') {\n this.maxReviewerRounds = maxReviewerRounds;\n this.filterAlreadyReviewed = filterAlreadyReviewed;\n this.contextStage = contextStage;\n }\n}\n\n/**\n * The answer to \"what review does this branch owe?\", in the X → N → Z terms the commands report:\n * X = `defined` — every checklist in pr-gate.checklists\n * N = `applicable` — those whose patterns matched (or that have no patterns, so always run)\n * Z = `outstanding` — of N, those still owing a verdict (only when filterAlreadyReviewed)\n * Data-only.\n */\nexport class ChecklistScan {\n defined: ChecklistDefinition[]; // X\n applicable: RequiredChecklist[]; // N\n reviewed: RequiredChecklist[]; // N − Z: already have a passing/warned/overridden verdict\n outstanding: RequiredChecklist[]; // Z (== applicable when not filtering)\n context: ChecklistReviewContext; // fork-point sha + pr-context.json path\n summaryPath: string; // the branch's summary.json; verdict files sit beside it\n forkPoint: string; // '' when no fork point resolved\n // ALL X, matched or not, with why — what the PR comment publishes as its roster. Skipped checklists are\n // absent from `applicable` by construction, and recovering them downstream would mean a second\n // changed-file computation with different semantics (see the class comment).\n roster: ChecklistRoster;\n // Verdict files that exist but cannot be read as a verdict (e.g. still using the removed `success`).\n // Carried on the SCAN because wp-finish-upsert-pr refuses on missing reviewers before it ever parses\n // summary.json — a complaint raised only in there would never reach the AI.\n formatErrors: string[];\n /**\n * The basis the matching ACTUALLY ran against. Carried out so a caller that materializes the diff\n * (stage ②) reuses the identical range instead of resolving its own — two independent resolutions is\n * exactly how the changed-file set and the printed `git diff` command came to disagree.\n */\n basis: DiffBasis;\n changedFiles: string[]; // the full changed-file set the matching ran against\n /**\n * The verdict files the scan ALREADY read, carried out rather than dropped.\n *\n * `outstanding` answers \"who still owes a verdict?\" but not \"why\" — and the two reasons demand opposite\n * actions from the reader: a reviewer that never ran must be SPAWNED, a reviewer that ran and REFUSED\n * must not be (it will refuse again; the finding has to be fixed first). Telling them apart means\n * resolving each checklist's verdict, and without the results here every caller either re-reads the same\n * files off disk — a second read that can disagree with this one — or merges the two cases into one\n * message, which is exactly the loop this field exists to break.\n */\n results: ChecklistResult[];\n /**\n * The OPTIONAL (`required: false`) applicable checklists carrying no verdict file — i.e. nobody ran them.\n *\n * Deliberately NOT in `outstanding` when filtering: that is the exemption that makes `required: false`\n * mean something. Carried out as its own set rather than merely subtracted, because both readers need it\n * BY NAME and neither can recover it from what is left: stage ② offers exactly these to the human, and\n * the PR dashboard must publish them as \"not run\" rather than let a shorter roster imply everything\n * passed. An optional checklist that ran and went RED is absent from here and stays in `outstanding`.\n */\n optionalNotRun: RequiredChecklist[];\n /**\n * TRUE when either this machine's `experimental.turnOffAllReviewers` switch is on or the project sets\n * `commands.pr-gate.reviewerAgents: 0`, and therefore when `applicable`, `reviewed`,\n * `outstanding`, `results`, `optionalNotRun` and `formatErrors` above are ALL EMPTY BY DECREE rather\n * than because nothing matched. Those two states are indistinguishable from the empty lists alone,\n * and telling them apart is the entire reason this field exists: an unreviewed PR must never render\n * as a reviewed one.\n *\n * `defined`, `roster`, `basis`, `changedFiles` and `context` are deliberately left INTACT under\n * suppression, so every reader can still say WHAT was switched off — including which REQUIRED\n * checklists would otherwise have run.\n *\n * See `HOME_KEY_TURN_OFF_ALL_REVIEWERS` in rules-config for the flag's contract; it is an\n * `experimental.*` flag, so only a human ever ends it.\n */\n reviewersDisabled: boolean;\n /**\n * The checklists that WOULD have been `applicable` had the reviewers not been suppressed — required\n * ones included. EMPTY on every ordinary run, and empty is not ambiguous there because\n * `reviewersDisabled` is false.\n *\n * Carried by NAME and not as a count because every reader needs a different slice of it: stage ②\n * prints them so a human can see exactly which required reviewer was killed, the dashboard names them\n * in the 1st comment, and the compact PR body needs only `.length`. Recomputing any of that\n * downstream would mean a second changed-file computation that can disagree with this one.\n */\n suppressed: RequiredChecklist[];\n /**\n * How every EXISTING verdict file stands (issue #863): CURRENT (submitted through `wp-write-review` and\n * its checklist's in-scope diff is unchanged), CARRIED (its in-scope diff changed since, but it counts\n * anyway — staleness never re-reviews, issue #1053, and a human override always wins, issue #1051),\n * STALE (a red whose in-scope diff changed: it still refuses) or REJECTED (no bin provenance, or edited\n * after submission — it is not a review, and is left OUT of `results` so it is owed like one that never\n * ran). Empty under suppression.\n */\n standings: VerdictStanding[];\n /** checklist id → ChecklistScopeHasher's hash of its in-scope diff NOW. Recorded in the stage-② receipt. */\n scopeHashes: Record<string, string>;\n /**\n * The checklists this diff matches NOW that were never briefed, because a review round had already\n * started when a later commit first triggered them (issue #1053). The checklist set is FROZEN at the\n * briefing, so these never block and are never owed a reviewer: the dashboard names them on one\n * informational line. Empty before any round starts, and under suppression.\n */\n notBriefed: RequiredChecklist[];\n /**\n * checklist id → the dashboard stamp of every ORANGE whose final-round fix the author recorded (issue\n * #1053). Already folded into `results` (as `remediation`) — carried out so `wp-finish-upsert-pr` hands\n * the identical stamps to its summary.json load, which reads the verdicts afresh.\n */\n orangeFixes: Record<string, string>;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n defined: ChecklistDefinition[],\n applicable: RequiredChecklist[],\n reviewed: RequiredChecklist[],\n outstanding: RequiredChecklist[],\n context: ChecklistReviewContext,\n summaryPath: string,\n forkPoint: string,\n roster: ChecklistRoster,\n formatErrors: string[],\n // REQUIRED, and placed BEFORE the defaulted tail deliberately. A defaulted `reviewersDisabled =\n // false` would let every existing construction keep compiling while asserting, silently, that no\n // reviewer was switched off — the widening-by-omission `.claude/rules/no-backwards-compat.md`\n // rejects, and on the one field whose whole job is to stop an unreviewed PR reading as reviewed.\n reviewersDisabled: boolean,\n suppressed: RequiredChecklist[],\n basis: DiffBasis = new DiffBasis(),\n changedFiles: string[] = [],\n // Defaulted so a caller that only cares about the X/N/Z counts (and every existing test construction)\n // stays a one-liner; the scanner itself always passes the real set.\n results: ChecklistResult[] = [],\n optionalNotRun: RequiredChecklist[] = [],\n ) {\n this.defined = defined;\n this.applicable = applicable;\n this.reviewed = reviewed;\n this.outstanding = outstanding;\n this.context = context;\n this.summaryPath = summaryPath;\n this.forkPoint = forkPoint;\n this.roster = roster;\n this.formatErrors = formatErrors;\n this.reviewersDisabled = reviewersDisabled;\n this.suppressed = suppressed;\n this.basis = basis;\n this.changedFiles = changedFiles;\n this.results = results;\n this.optionalNotRun = optionalNotRun;\n this.standings = [];\n this.scopeHashes = {};\n this.notBriefed = [];\n this.orangeFixes = {};\n }\n}\n\n/** The checklists a scan JUDGES, and the ones the diff matches that it deliberately does not (#1053). Data-only. */\nexport class JudgedScope {\n applicable: RequiredChecklist[];\n notBriefed: RequiredChecklist[];\n\n constructor(applicable: RequiredChecklist[], notBriefed: RequiredChecklist[]) {\n this.applicable = applicable;\n this.notBriefed = notBriefed;\n }\n}\n\n/**\n * The ONE computation of which reviewer subagents a branch owes, shared by `wp-review-upsert-pr` (which lists) and\n * `wp-finish-upsert-pr` (which blocks). They previously each assembled this from the same parts in slightly\n * different ways, and any divergence means the command that reports and the command that gates disagree.\n *\n * Two properties are deliberate and load-bearing:\n *\n * 1. **The base is the FORK POINT of main, computed directly** — never `DiffScope.resolveBase`, which\n * overlays `NX_BASE`/`NX_HEAD` from the environment. That made review coverage depend on an env var.\n * It now arrives via {@link DiffBasisResolver}, which injects ForkPoint; same sha, one resolution.\n * 2. **UNCOMMITTED work counts.** `getChangedFiles` is called with NO head, which is the branch of it that\n * diffs base → WORKING TREE and unions in untracked files. Passing a head would diff commit-to-commit and\n * silently miss staged, unstaged and untracked changes — so a checklist matching only uncommitted files\n * would never fire and its reviewer would never be listed.\n * 3. **The range and the command it prints are the SAME basis.** Property 2 used to be true of the file set\n * only: reviewers were handed `git diff <base> HEAD`, which on a dirty tree covers a different range and\n * prints nothing. Both now derive from one {@link DiffBasis}, carried on the scan so a materializing\n * caller cannot re-resolve and drift.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ChecklistScanner {\n constructor(\n private readonly aiBranchName: AiBranchName,\n private readonly checklistDetector: ChecklistDetector,\n private readonly diffScope: DiffScope,\n private readonly diffBasisResolver: DiffBasisResolver,\n private readonly prContextWriter: PrContextWriter,\n private readonly reviewJsonService: ReviewJsonService,\n // Injected BY TYPE (no Symbol token, per CLAUDE.md) so the ONE reviewer kill switch is read in the\n // ONE place that computes what a branch owes — see the suppression note on `scan`.\n private readonly homeConfig: HomeConfigService,\n private readonly scopeHasher: ChecklistScopeHasher,\n private readonly verdictProvenance: VerdictProvenanceService,\n private readonly receipts: ReviewStageReceiptService,\n private readonly rounds: ReviewRoundStateService,\n ) {}\n\n /**\n * `defined` is the caller's ALREADY-VALIDATED `prGate.checklists`. The scanner deliberately does not load\n * config itself: `loadAndValidate` is the one gate on the checklist set (it rejects a non-array\n * `checklists`, including the removed `{ doc }` manifest shape, and verifies every guidance doc and\n * reviewer-agent file exists), both callers already run it for other fields, and keeping the read out of\n * here leaves this a function of its inputs rather than of the filesystem.\n */\n scan(repoRoot: string, defined: ChecklistDefinition[], opts: ChecklistScanOptions): ChecklistScan {\n const featureName = this.aiBranchName.getFeatureName();\n const summaryPath = summaryJsonPath(repoRoot, featureName);\n // ONE basis for the file set, the reproduce command and any downstream materialization. The fork\n // point still comes from ForkPoint (never DiffScope.resolveBase) — DiffBasisResolver injects it.\n const basis = this.diffBasisResolver.resolve(repoRoot);\n const base = basis.base;\n // ONE changed-file computation feeds both the roster (all X) and the applicable set (N). `detect` is\n // pure and defined as the roster minus its empty entries, so the two cannot disagree about a match.\n const changedFiles = this.changedFiles(repoRoot, base);\n const roster = new ChecklistRoster(\n this.checklistDetector.roster(defined, changedFiles), changedFiles.length, base !== '');\n const matched = this.checklistDetector.toRequired(this.checklistDetector.detect(defined, changedFiles));\n // THE ONE CHOKE POINT for both reviewer opt-outs. Suppressing HERE — rather than in\n // `wp-review-upsert-pr` and again in `wp-finish-upsert-pr` — is what keeps the command that LISTS\n // and the command that BLOCKS in agreement by construction, which is this class's whole reason for\n // existing. A second check in either command would be a second answer to one question.\n const context = opts.contextStage === ''\n ? this.prContextWriter.contextFor(repoRoot, featureName, basis)\n : this.prContextWriter.ensure(repoRoot, featureName, basis, opts.contextStage, changedFiles);\n const homeConfig = this.homeConfig.load();\n const projectDisabled = defined.some((d: ChecklistDefinition): boolean => d.reviewer.maxAgents === 0);\n if (homeConfig.turnOffAllReviewers || projectDisabled) {\n // EMPTY: applicable, reviewed, outstanding, formatErrors, results, optionalNotRun. INTACT:\n // defined, roster, basis, changedFiles, context — so every downstream reader can still say\n // WHAT was suppressed, which is the difference between an honest record and a silent one.\n return new ChecklistScan(\n defined, [], [], [], context, summaryPath, base, roster, [], true, matched, basis,\n changedFiles, [], []);\n }\n const judged = this.judgedScope(repoRoot, summaryPath, roster, matched);\n const applicable = judged.applicable;\n const scopeHashes = this.scopeHasher.hashes(repoRoot, basis, applicable);\n const loaded = this.reviewJsonService.loadChecklistResults(summaryPath, applicable);\n const orangeFixes = this.rounds.orangeFixes(repoRoot, summaryPath, loaded);\n for (const result of loaded) result.remediation = orangeFixes[result.id] ?? '';\n const standings = this.standingsOf(summaryPath, loaded, scopeHashes)\n .map((s: VerdictStanding): VerdictStanding => this.carried(s, loaded, opts.maxReviewerRounds));\n const results = this.liveResults(loaded, standings);\n const stillOwed = this.reviewJsonService.pendingChecklists(applicable, results);\n const owedIds = new Set(stillOwed.map((r: RequiredChecklist): string => r.id));\n // NOT `!owedIds.has(...)`-with-the-optional-exemption-folded-in: an optional checklist nobody ran is\n // neither reviewed nor blocking, and calling it \"reviewed\" would put a ✓ on the dashboard for a review\n // that never happened.\n const reviewed = applicable.filter((r: RequiredChecklist): boolean => !owedIds.has(r.id));\n const optionalNotRun = this.reviewJsonService.optionalWithoutVerdict(applicable, results);\n const scan = new ChecklistScan(\n defined,\n applicable,\n reviewed,\n opts.filterAlreadyReviewed ? this.blocking(stillOwed, optionalNotRun) : applicable,\n context,\n summaryPath,\n base,\n roster,\n this.reviewJsonService.checklistFormatErrors(applicable, results),\n false,\n [],\n basis,\n changedFiles,\n results,\n optionalNotRun,\n );\n scan.standings = standings;\n scan.scopeHashes = scopeHashes;\n scan.notBriefed = judged.notBriefed;\n scan.orangeFixes = orangeFixes;\n return scan;\n }\n\n /**\n * FROZEN at the briefing (issue #1053): once a review round has started, the checklists this branch owes\n * are the ones that were briefed (still defined, with whatever the current diff matches for each) — never\n * ones a later commit newly triggers, which no round will ever brief. Recomputing them from the current\n * diff is exactly the deadlock that drove an agent to move the review directory aside to get unstuck.\n * Before any round starts, the set is simply what the diff matches.\n */\n // eslint-disable-next-line @typescript-eslint/max-params\n private judgedScope(repoRoot: string, summaryPath: string, roster: ChecklistRoster, matched: RequiredChecklist[]): JudgedScope {\n const receipt = this.receipts.read(repoRoot, this.aiBranchName.getFeatureName());\n if (!this.rounds.roundStarted(summaryPath, receipt)) return new JudgedScope(matched, []);\n const briefedIds = new Set(this.rounds.briefedChecklistIds(summaryPath, receipt));\n const briefed = roster.entries.filter((t: TriggeredChecklist): boolean => briefedIds.has(t.def.id));\n return new JudgedScope(\n this.checklistDetector.toRequired(briefed),\n matched.filter((r: RequiredChecklist): boolean => !briefedIds.has(r.id)));\n }\n\n /**\n * Judge every READABLE verdict against its bin provenance and the in-scope diff as it is now. A file\n * with a format problem is left to the format complaint, which names the fix; it is not assessed.\n */\n // eslint-disable-next-line @typescript-eslint/max-params\n private standingsOf(\n summaryPath: string, loaded: readonly ChecklistResult[], scopeHashes: Record<string, string>,\n ): VerdictStanding[] {\n return loaded\n .filter((r: ChecklistResult): boolean => r.problem === '')\n .map((r: ChecklistResult): VerdictStanding =>\n this.verdictProvenance.assess(summaryPath, r, scopeHashes[r.id] ?? ''));\n }\n\n /**\n * A STALE verdict that must NOT be owed again, re-stood as CARRIED with the reason.\n *\n * 1. A human override for the checklist stands (issue #1051). Staleness is judged BEFORE the verdict is\n * resolved, so without this a stale verdict read as \"never ran\" and the override written for it was\n * never looked at — the human's in-session decision was shadowed by a hash comparison.\n * 2. Otherwise a green, yellow or orange ALWAYS carries (issue #1053): staleness never triggers a\n * re-review. `maxReviewerRounds` is a hard ceiling, and the only thing that ever opens another round is\n * a RED with a round left — a verdict that went stale because the author kept working is not one.\n *\n * A RED stays STALE: it still refuses, and stage ② re-briefs it while a round remains. A REJECTED verdict\n * is never carried: it is not a review.\n */\n private carried(s: VerdictStanding, loaded: readonly ChecklistResult[], maxRounds: number): VerdictStanding {\n if (s.standing !== STANDING_STALE) return s;\n const result = loaded.find((r: ChecklistResult): boolean => r.id === s.checklistId);\n const override = result?.override ?? null;\n if (override !== null && override.problem === '') {\n return new VerdictStanding(s.checklistId, STANDING_CARRIED, s.status, s.fromSha,\n `${s.reason}, but a human override (authorized by ${override.authorizedBy}) stands — the verdict counts`);\n }\n if (s.status === VERDICT_RED) return s;\n return new VerdictStanding(s.checklistId, STANDING_CARRIED, s.status, s.fromSha,\n `${s.reason}; CARRIED FORWARD without re-review — a ${s.status} verdict stands whatever round it came from, `\n + `and only a red opens another of the ${maxRounds} allowed round(s)`);\n }\n\n /**\n * The verdicts that still COUNT: every one except a REJECTED verdict, which is not a review. A stale\n * verdict still counts (see {@link carried}): a stale green, yellow or orange stands, and a stale red\n * still refuses — a refusal is not lifted by changing other code in its scope.\n */\n private liveResults(loaded: readonly ChecklistResult[], standings: readonly VerdictStanding[]): ChecklistResult[] {\n const dropped = new Set(standings\n .filter((s: VerdictStanding): boolean => s.standing === STANDING_REJECTED)\n .map((s: VerdictStanding): string => s.checklistId));\n return loaded.filter((r: ChecklistResult): boolean => !dropped.has(r.id));\n }\n\n /**\n * What `wp-finish-upsert-pr` actually REFUSES on: everything still owing a verdict, minus the optional\n * checklists nobody ran.\n *\n * The subtraction happens HERE — in the one place `outstanding` is computed — and not in the gate, so\n * there is a single answer to \"does this branch owe review?\". When the gate did its own filtering, the\n * command that lists and the command that blocks were two implementations of the same question, which is\n * exactly the divergence this class's docstring exists to prevent.\n */\n private blocking(stillOwed: readonly RequiredChecklist[], optionalNotRun: readonly RequiredChecklist[]): RequiredChecklist[] {\n const skipped = new Set(optionalNotRun.map((r: RequiredChecklist): string => r.id));\n return stillOwed.filter((r: RequiredChecklist): boolean => !skipped.has(r.id));\n }\n\n /**\n * Every file changed since the fork point, INCLUDING uncommitted and untracked ones. Two non-default\n * options, both load-bearing:\n *\n * `tsOnly:false` — the default drops every *.sql / Dockerfile / .env* file a checklist most wants\n * to key on, which would silently shrink the set a reviewer is pointed at.\n * `includeDeletions:true` — the default is `--diff-filter=d`, so a DELETED file is invisible. A PR that\n * deletes a migration, an auth check or a terraform rule changed exactly what a\n * checklist exists to catch, and under the default no checklist fires at all.\n */\n private changedFiles(repoRoot: string, base: string): string[] {\n if (base === '') return [];\n const opts = new ChangedFilesOptions();\n opts.tsOnly = false;\n opts.includeDeletions = true;\n // No head argument — see the class comment. This is what includes the working tree.\n return this.diffScope.getChangedFiles(repoRoot, base, undefined, opts);\n }\n}\n"]}
1
+ {"version":3,"file":"checklist-scanner.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/checklist-scanner.ts"],"names":[],"mappings":";;;;AAAA,0DAGiC;AACjC,yCAA2D;AAC3D,iEAAsD;AACtD,6DAA8F;AAC9F,6CAA4D;AAC5D,2DAAsD;AACtD,qEAAgE;AAChE,6DAE8B;AAC9B,iEAAmE;AACnE,6DAA+D;AAE/D,uEAAuE;AACvE,MAAa,oBAAoB;IAC7B;;;;OAIG;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C,CAAC;IACnF,CAAC;IAED;;;;;;;;;OASG;IACK,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,IAAY;QACrD,IAAI,IAAI,KAAK,EAAE;YAAE,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,IAAI,kCAAmB,EAAE,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,oFAAoF;QACpF,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3E,CAAC;CACJ,CAAA;AArMY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGF,mCAAY;QACP,sCAAiB;QACzB,wBAAS;QACD,8BAAiB;QACnB,mCAAe;QACb,gCAAiB;QAGxB,gCAAiB;QAChB,6CAAoB;QACd,6CAAwB;QACjC,gDAAyB;QAC3B,4CAAuB;GAd3C,gBAAgB,CAqM5B","sourcesContent":["import {\n ChangedFilesOptions, ChecklistDefinition, ChecklistResult, ChecklistReviewContext, DiffScope,\n HomeConfigService, RequiredChecklist, ReviewJsonService, VERDICT_RED, summaryJsonPath,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from './git-readAiBranchName';\nimport { ChecklistDetector, ChecklistRoster, TriggeredChecklist } from './checklist-detector';\nimport { DiffBasis, DiffBasisResolver } from './diff-basis';\nimport { PrContextWriter } from './pr-context-writer';\nimport { ChecklistScopeHasher } from './checklist-scope-hasher';\nimport {\n STANDING_CARRIED, STANDING_REJECTED, STANDING_STALE, VerdictProvenanceService, VerdictStanding,\n} from './verdict-provenance';\nimport { ReviewStageReceiptService } from './review-stage-receipt';\nimport { ReviewRoundStateService } from './review-round-state';\n\n/** How a caller wants the scan filtered. Data-only (per CLAUDE.md). */\nexport class ChecklistScanOptions {\n /**\n * false — `outstanding` is every applicable checklist (what `wp-review-upsert-pr` LISTS).\n * true — `outstanding` drops the ones already carrying a passing/overridden verdict, leaving only what\n * still owes review (what `wp-finish-upsert-pr` BLOCKS on).\n */\n filterAlreadyReviewed: boolean;\n /**\n * Which per-stage snapshot this scan should persist ('stage3-finish', …), or '' for \"do not write\n * pr-context.json here\".\n *\n * '' exists for stage ②, which cannot write yet: the context records `diffDir`, and the diff has not\n * been materialized at scan time. Letting the scan write anyway meant stage ② wrote the file twice,\n * ~60 lines apart, the first time with an empty diffDir. Now it writes once, after materializing.\n *\n * The DEFAULT is deliberately non-empty, so writing is what you get by NOT thinking about it. A\n * reviewer block that lost its diff command because nobody had written pr-context.json is a bug this\n * codebase has already shipped once (see PrContextWriter's docstring); opting out must be an explicit,\n * visible act by a caller that takes responsibility for writing it later — not an omission.\n */\n contextStage: string;\n /**\n * `commands.pr-gate.maxReviewerRounds`, as the caller's validated config states it. REQUIRED and first,\n * so a scan always states the budget its CARRIED verdicts were judged under (issue #1053: a stale green\n * or yellow is carried whatever round it came from, and the reason names the budget).\n */\n maxReviewerRounds: number;\n\n constructor(maxReviewerRounds: number, filterAlreadyReviewed = false, contextStage = 'stage-scan') {\n this.maxReviewerRounds = maxReviewerRounds;\n this.filterAlreadyReviewed = filterAlreadyReviewed;\n this.contextStage = contextStage;\n }\n}\n\n/**\n * The answer to \"what review does this branch owe?\", in the X → N → Z terms the commands report:\n * X = `defined` — every checklist in pr-gate.checklists\n * N = `applicable` — those whose patterns matched (or that have no patterns, so always run)\n * Z = `outstanding` — of N, those still owing a verdict (only when filterAlreadyReviewed)\n * Data-only.\n */\nexport class ChecklistScan {\n defined: ChecklistDefinition[]; // X\n applicable: RequiredChecklist[]; // N\n reviewed: RequiredChecklist[]; // N − Z: already have a passing/warned/overridden verdict\n outstanding: RequiredChecklist[]; // Z (== applicable when not filtering)\n context: ChecklistReviewContext; // fork-point sha + pr-context.json path\n summaryPath: string; // the branch's summary.json; verdict files sit beside it\n forkPoint: string; // '' when no fork point resolved\n // ALL X, matched or not, with why — what the PR comment publishes as its roster. Skipped checklists are\n // absent from `applicable` by construction, and recovering them downstream would mean a second\n // changed-file computation with different semantics (see the class comment).\n roster: ChecklistRoster;\n // Verdict files that exist but cannot be read as a verdict (e.g. still using the removed `success`).\n // Carried on the SCAN because wp-finish-upsert-pr refuses on missing reviewers before it ever parses\n // summary.json — a complaint raised only in there would never reach the AI.\n formatErrors: string[];\n /**\n * The basis the matching ACTUALLY ran against. Carried out so a caller that materializes the diff\n * (stage ②) reuses the identical range instead of resolving its own — two independent resolutions is\n * exactly how the changed-file set and the printed `git diff` command came to disagree.\n */\n basis: DiffBasis;\n changedFiles: string[]; // the full changed-file set the matching ran against\n /**\n * The verdict files the scan ALREADY read, carried out rather than dropped.\n *\n * `outstanding` answers \"who still owes a verdict?\" but not \"why\" — and the two reasons demand opposite\n * actions from the reader: a reviewer that never ran must be SPAWNED, a reviewer that ran and REFUSED\n * must not be (it will refuse again; the finding has to be fixed first). Telling them apart means\n * resolving each checklist's verdict, and without the results here every caller either re-reads the same\n * files off disk — a second read that can disagree with this one — or merges the two cases into one\n * message, which is exactly the loop this field exists to break.\n */\n results: ChecklistResult[];\n /**\n * The OPTIONAL (`required: false`) applicable checklists carrying no verdict file — i.e. nobody ran them.\n *\n * Deliberately NOT in `outstanding` when filtering: that is the exemption that makes `required: false`\n * mean something. Carried out as its own set rather than merely subtracted, because both readers need it\n * BY NAME and neither can recover it from what is left: stage ② offers exactly these to the human, and\n * the PR dashboard must publish them as \"not run\" rather than let a shorter roster imply everything\n * passed. An optional checklist that ran and went RED is absent from here and stays in `outstanding`.\n */\n optionalNotRun: RequiredChecklist[];\n /**\n * TRUE when either this machine's `experimental.turnOffAllReviewers` switch is on or the project sets\n * `commands.pr-gate.reviewerAgents: 0`, and therefore when `applicable`, `reviewed`,\n * `outstanding`, `results`, `optionalNotRun` and `formatErrors` above are ALL EMPTY BY DECREE rather\n * than because nothing matched. Those two states are indistinguishable from the empty lists alone,\n * and telling them apart is the entire reason this field exists: an unreviewed PR must never render\n * as a reviewed one.\n *\n * `defined`, `roster`, `basis`, `changedFiles` and `context` are deliberately left INTACT under\n * suppression, so every reader can still say WHAT was switched off — including which REQUIRED\n * checklists would otherwise have run.\n *\n * See `HOME_KEY_TURN_OFF_ALL_REVIEWERS` in rules-config for the flag's contract; it is an\n * `experimental.*` flag, so only a human ever ends it.\n */\n reviewersDisabled: boolean;\n /**\n * The checklists that WOULD have been `applicable` had the reviewers not been suppressed — required\n * ones included. EMPTY on every ordinary run, and empty is not ambiguous there because\n * `reviewersDisabled` is false.\n *\n * Carried by NAME and not as a count because every reader needs a different slice of it: stage ②\n * prints them so a human can see exactly which required reviewer was killed, the dashboard names them\n * in the 1st comment, and the compact PR body needs only `.length`. Recomputing any of that\n * downstream would mean a second changed-file computation that can disagree with this one.\n */\n suppressed: RequiredChecklist[];\n /**\n * How every EXISTING verdict file stands (issue #863): CURRENT (submitted through `wp-write-review` and\n * its checklist's in-scope diff is unchanged), CARRIED (its in-scope diff changed since, but it counts\n * anyway — staleness never re-reviews, issue #1053, and a human override always wins, issue #1051),\n * STALE (a red whose in-scope diff changed: it still refuses) or REJECTED (no bin provenance, or edited\n * after submission — it is not a review, and is left OUT of `results` so it is owed like one that never\n * ran). Empty under suppression.\n */\n standings: VerdictStanding[];\n /** checklist id → ChecklistScopeHasher's hash of its in-scope diff NOW. Recorded in the stage-② receipt. */\n scopeHashes: Record<string, string>;\n /**\n * The checklists this diff matches NOW that were never briefed, because a review round had already\n * started when a later commit first triggered them (issue #1053). The checklist set is FROZEN at the\n * briefing, so these never block and are never owed a reviewer: the dashboard names them on one\n * informational line. Empty before any round starts, and under suppression.\n */\n notBriefed: RequiredChecklist[];\n /**\n * checklist id → the dashboard stamp of every ORANGE whose final-round fix the author recorded (issue\n * #1053). Already folded into `results` (as `remediation`) — carried out so `wp-finish-upsert-pr` hands\n * the identical stamps to its summary.json load, which reads the verdicts afresh.\n */\n orangeFixes: Record<string, string>;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n defined: ChecklistDefinition[],\n applicable: RequiredChecklist[],\n reviewed: RequiredChecklist[],\n outstanding: RequiredChecklist[],\n context: ChecklistReviewContext,\n summaryPath: string,\n forkPoint: string,\n roster: ChecklistRoster,\n formatErrors: string[],\n // REQUIRED, and placed BEFORE the defaulted tail deliberately. A defaulted `reviewersDisabled =\n // false` would let every existing construction keep compiling while asserting, silently, that no\n // reviewer was switched off — the widening-by-omission `.claude/rules/no-backwards-compat.md`\n // rejects, and on the one field whose whole job is to stop an unreviewed PR reading as reviewed.\n reviewersDisabled: boolean,\n suppressed: RequiredChecklist[],\n basis: DiffBasis = new DiffBasis(),\n changedFiles: string[] = [],\n // Defaulted so a caller that only cares about the X/N/Z counts (and every existing test construction)\n // stays a one-liner; the scanner itself always passes the real set.\n results: ChecklistResult[] = [],\n optionalNotRun: RequiredChecklist[] = [],\n ) {\n this.defined = defined;\n this.applicable = applicable;\n this.reviewed = reviewed;\n this.outstanding = outstanding;\n this.context = context;\n this.summaryPath = summaryPath;\n this.forkPoint = forkPoint;\n this.roster = roster;\n this.formatErrors = formatErrors;\n this.reviewersDisabled = reviewersDisabled;\n this.suppressed = suppressed;\n this.basis = basis;\n this.changedFiles = changedFiles;\n this.results = results;\n this.optionalNotRun = optionalNotRun;\n this.standings = [];\n this.scopeHashes = {};\n this.notBriefed = [];\n this.orangeFixes = {};\n }\n}\n\n/** The checklists a scan JUDGES, and the ones the diff matches that it deliberately does not (#1053). Data-only. */\nexport class JudgedScope {\n applicable: RequiredChecklist[];\n notBriefed: RequiredChecklist[];\n\n constructor(applicable: RequiredChecklist[], notBriefed: RequiredChecklist[]) {\n this.applicable = applicable;\n this.notBriefed = notBriefed;\n }\n}\n\n/**\n * The ONE computation of which reviewer subagents a branch owes, shared by `wp-review-upsert-pr` (which lists) and\n * `wp-finish-upsert-pr` (which blocks). They previously each assembled this from the same parts in slightly\n * different ways, and any divergence means the command that reports and the command that gates disagree.\n *\n * Two properties are deliberate and load-bearing:\n *\n * 1. **The base is the FORK POINT of main, computed directly** — never `DiffScope.resolveBase`, which\n * overlays `NX_BASE`/`NX_HEAD` from the environment. That made review coverage depend on an env var.\n * It now arrives via {@link DiffBasisResolver}, which injects ForkPoint; same sha, one resolution.\n * 2. **UNCOMMITTED work counts.** `getChangedFiles` is called with NO head, which is the branch of it that\n * diffs base → WORKING TREE and unions in untracked files. Passing a head would diff commit-to-commit and\n * silently miss staged, unstaged and untracked changes — so a checklist matching only uncommitted files\n * would never fire and its reviewer would never be listed.\n * 3. **The range and the command it prints are the SAME basis.** Property 2 used to be true of the file set\n * only: reviewers were handed `git diff <base> HEAD`, which on a dirty tree covers a different range and\n * prints nothing. Both now derive from one {@link DiffBasis}, carried on the scan so a materializing\n * caller cannot re-resolve and drift.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ChecklistScanner {\n constructor(\n private readonly aiBranchName: AiBranchName,\n private readonly checklistDetector: ChecklistDetector,\n private readonly diffScope: DiffScope,\n private readonly diffBasisResolver: DiffBasisResolver,\n private readonly prContextWriter: PrContextWriter,\n private readonly reviewJsonService: ReviewJsonService,\n // Injected BY TYPE (no Symbol token, per CLAUDE.md) so the ONE reviewer kill switch is read in the\n // ONE place that computes what a branch owes — see the suppression note on `scan`.\n private readonly homeConfig: HomeConfigService,\n private readonly scopeHasher: ChecklistScopeHasher,\n private readonly verdictProvenance: VerdictProvenanceService,\n private readonly receipts: ReviewStageReceiptService,\n private readonly rounds: ReviewRoundStateService,\n ) {}\n\n /**\n * `defined` is the caller's ALREADY-VALIDATED `prGate.checklists`. The scanner deliberately does not load\n * config itself: `loadAndValidate` is the one gate on the checklist set (it rejects a non-array\n * `checklists`, including the removed `{ doc }` manifest shape, and verifies every guidance doc and\n * reviewer-agent file exists), both callers already run it for other fields, and keeping the read out of\n * here leaves this a function of its inputs rather than of the filesystem.\n */\n async scan(repoRoot: string, defined: ChecklistDefinition[], opts: ChecklistScanOptions): Promise<ChecklistScan> {\n const featureName = await this.aiBranchName.getFeatureName();\n const summaryPath = summaryJsonPath(repoRoot, featureName);\n // ONE basis for the file set, the reproduce command and any downstream materialization. The fork\n // point still comes from ForkPoint (never DiffScope.resolveBase) — DiffBasisResolver injects it.\n const basis = await this.diffBasisResolver.resolve(repoRoot);\n const base = basis.base;\n // ONE changed-file computation feeds both the roster (all X) and the applicable set (N). `detect` is\n // pure and defined as the roster minus its empty entries, so the two cannot disagree about a match.\n const changedFiles = await this.changedFiles(repoRoot, base);\n const roster = new ChecklistRoster(\n this.checklistDetector.roster(defined, changedFiles), changedFiles.length, base !== '');\n const matched = this.checklistDetector.toRequired(this.checklistDetector.detect(defined, changedFiles));\n // THE ONE CHOKE POINT for both reviewer opt-outs. Suppressing HERE — rather than in\n // `wp-review-upsert-pr` and again in `wp-finish-upsert-pr` — is what keeps the command that LISTS\n // and the command that BLOCKS in agreement by construction, which is this class's whole reason for\n // existing. A second check in either command would be a second answer to one question.\n const context = opts.contextStage === ''\n ? this.prContextWriter.contextFor(repoRoot, featureName, basis)\n : await this.prContextWriter.ensure(repoRoot, featureName, basis, opts.contextStage, changedFiles);\n const homeConfig = this.homeConfig.load();\n const projectDisabled = defined.some((d: ChecklistDefinition): boolean => d.reviewer.maxAgents === 0);\n if (homeConfig.turnOffAllReviewers || projectDisabled) {\n // EMPTY: applicable, reviewed, outstanding, formatErrors, results, optionalNotRun. INTACT:\n // defined, roster, basis, changedFiles, context — so every downstream reader can still say\n // WHAT was suppressed, which is the difference between an honest record and a silent one.\n return new ChecklistScan(\n defined, [], [], [], context, summaryPath, base, roster, [], true, matched, basis,\n changedFiles, [], []);\n }\n const judged = this.judgedScope(repoRoot, featureName, summaryPath, roster, matched);\n const applicable = judged.applicable;\n const scopeHashes = await this.scopeHasher.hashes(repoRoot, basis, applicable);\n const loaded = this.reviewJsonService.loadChecklistResults(summaryPath, applicable);\n const orangeFixes = await this.rounds.orangeFixes(repoRoot, summaryPath, loaded);\n for (const result of loaded) result.remediation = orangeFixes[result.id] ?? '';\n const standings = this.standingsOf(summaryPath, loaded, scopeHashes)\n .map((s: VerdictStanding): VerdictStanding => this.carried(s, loaded, opts.maxReviewerRounds));\n const results = this.liveResults(loaded, standings);\n const stillOwed = this.reviewJsonService.pendingChecklists(applicable, results);\n const owedIds = new Set(stillOwed.map((r: RequiredChecklist): string => r.id));\n // NOT `!owedIds.has(...)`-with-the-optional-exemption-folded-in: an optional checklist nobody ran is\n // neither reviewed nor blocking, and calling it \"reviewed\" would put a ✓ on the dashboard for a review\n // that never happened.\n const reviewed = applicable.filter((r: RequiredChecklist): boolean => !owedIds.has(r.id));\n const optionalNotRun = this.reviewJsonService.optionalWithoutVerdict(applicable, results);\n const scan = new ChecklistScan(\n defined,\n applicable,\n reviewed,\n opts.filterAlreadyReviewed ? this.blocking(stillOwed, optionalNotRun) : applicable,\n context,\n summaryPath,\n base,\n roster,\n this.reviewJsonService.checklistFormatErrors(applicable, results),\n false,\n [],\n basis,\n changedFiles,\n results,\n optionalNotRun,\n );\n scan.standings = standings;\n scan.scopeHashes = scopeHashes;\n scan.notBriefed = judged.notBriefed;\n scan.orangeFixes = orangeFixes;\n return scan;\n }\n\n /**\n * FROZEN at the briefing (issue #1053): once a review round has started, the checklists this branch owes\n * are the ones that were briefed (still defined, with whatever the current diff matches for each) — never\n * ones a later commit newly triggers, which no round will ever brief. Recomputing them from the current\n * diff is exactly the deadlock that drove an agent to move the review directory aside to get unstuck.\n * Before any round starts, the set is simply what the diff matches.\n */\n // eslint-disable-next-line @typescript-eslint/max-params\n private judgedScope(repoRoot: string, featureName: string, summaryPath: string, roster: ChecklistRoster, matched: RequiredChecklist[]): JudgedScope {\n const receipt = this.receipts.read(repoRoot, featureName);\n if (!this.rounds.roundStarted(summaryPath, receipt)) return new JudgedScope(matched, []);\n const briefedIds = new Set(this.rounds.briefedChecklistIds(summaryPath, receipt));\n const briefed = roster.entries.filter((t: TriggeredChecklist): boolean => briefedIds.has(t.def.id));\n return new JudgedScope(\n this.checklistDetector.toRequired(briefed),\n matched.filter((r: RequiredChecklist): boolean => !briefedIds.has(r.id)));\n }\n\n /**\n * Judge every READABLE verdict against its bin provenance and the in-scope diff as it is now. A file\n * with a format problem is left to the format complaint, which names the fix; it is not assessed.\n */\n // eslint-disable-next-line @typescript-eslint/max-params\n private standingsOf(\n summaryPath: string, loaded: readonly ChecklistResult[], scopeHashes: Record<string, string>,\n ): VerdictStanding[] {\n return loaded\n .filter((r: ChecklistResult): boolean => r.problem === '')\n .map((r: ChecklistResult): VerdictStanding =>\n this.verdictProvenance.assess(summaryPath, r, scopeHashes[r.id] ?? ''));\n }\n\n /**\n * A STALE verdict that must NOT be owed again, re-stood as CARRIED with the reason.\n *\n * 1. A human override for the checklist stands (issue #1051). Staleness is judged BEFORE the verdict is\n * resolved, so without this a stale verdict read as \"never ran\" and the override written for it was\n * never looked at — the human's in-session decision was shadowed by a hash comparison.\n * 2. Otherwise a green, yellow or orange ALWAYS carries (issue #1053): staleness never triggers a\n * re-review. `maxReviewerRounds` is a hard ceiling, and the only thing that ever opens another round is\n * a RED with a round left — a verdict that went stale because the author kept working is not one.\n *\n * A RED stays STALE: it still refuses, and stage ② re-briefs it while a round remains. A REJECTED verdict\n * is never carried: it is not a review.\n */\n private carried(s: VerdictStanding, loaded: readonly ChecklistResult[], maxRounds: number): VerdictStanding {\n if (s.standing !== STANDING_STALE) return s;\n const result = loaded.find((r: ChecklistResult): boolean => r.id === s.checklistId);\n const override = result?.override ?? null;\n if (override !== null && override.problem === '') {\n return new VerdictStanding(s.checklistId, STANDING_CARRIED, s.status, s.fromSha,\n `${s.reason}, but a human override (authorized by ${override.authorizedBy}) stands — the verdict counts`);\n }\n if (s.status === VERDICT_RED) return s;\n return new VerdictStanding(s.checklistId, STANDING_CARRIED, s.status, s.fromSha,\n `${s.reason}; CARRIED FORWARD without re-review — a ${s.status} verdict stands whatever round it came from, `\n + `and only a red opens another of the ${maxRounds} allowed round(s)`);\n }\n\n /**\n * The verdicts that still COUNT: every one except a REJECTED verdict, which is not a review. A stale\n * verdict still counts (see {@link carried}): a stale green, yellow or orange stands, and a stale red\n * still refuses — a refusal is not lifted by changing other code in its scope.\n */\n private liveResults(loaded: readonly ChecklistResult[], standings: readonly VerdictStanding[]): ChecklistResult[] {\n const dropped = new Set(standings\n .filter((s: VerdictStanding): boolean => s.standing === STANDING_REJECTED)\n .map((s: VerdictStanding): string => s.checklistId));\n return loaded.filter((r: ChecklistResult): boolean => !dropped.has(r.id));\n }\n\n /**\n * What `wp-finish-upsert-pr` actually REFUSES on: everything still owing a verdict, minus the optional\n * checklists nobody ran.\n *\n * The subtraction happens HERE — in the one place `outstanding` is computed — and not in the gate, so\n * there is a single answer to \"does this branch owe review?\". When the gate did its own filtering, the\n * command that lists and the command that blocks were two implementations of the same question, which is\n * exactly the divergence this class's docstring exists to prevent.\n */\n private blocking(stillOwed: readonly RequiredChecklist[], optionalNotRun: readonly RequiredChecklist[]): RequiredChecklist[] {\n const skipped = new Set(optionalNotRun.map((r: RequiredChecklist): string => r.id));\n return stillOwed.filter((r: RequiredChecklist): boolean => !skipped.has(r.id));\n }\n\n /**\n * Every file changed since the fork point, INCLUDING uncommitted and untracked ones. Two non-default\n * options, both load-bearing:\n *\n * `tsOnly:false` — the default drops every *.sql / Dockerfile / .env* file a checklist most wants\n * to key on, which would silently shrink the set a reviewer is pointed at.\n * `includeDeletions:true` — the default is `--diff-filter=d`, so a DELETED file is invisible. A PR that\n * deletes a migration, an auth check or a terraform rule changed exactly what a\n * checklist exists to catch, and under the default no checklist fires at all.\n */\n private async changedFiles(repoRoot: string, base: string): Promise<string[]> {\n if (base === '') return [];\n const opts = new ChangedFilesOptions();\n opts.tsOnly = false;\n opts.includeDeletions = true;\n // No head argument — see the class comment. This is what includes the working tree.\n return this.diffScope.getChangedFiles(repoRoot, base, undefined, opts);\n }\n}\n"]}
@@ -27,7 +27,7 @@ export declare class ChecklistScopeHasher {
27
27
  * capture the materializer uses), then per-file normalization, then one sha256 per checklist.
28
28
  * Empty when the basis is unresolved: with no fork point there is no diff to hash.
29
29
  */
30
- hashes(repoRoot: string, basis: DiffBasis, checklists: readonly RequiredChecklist[]): Record<string, string>;
30
+ hashes(repoRoot: string, basis: DiffBasis, checklists: readonly RequiredChecklist[]): Promise<Record<string, string>>;
31
31
  /** The hash of one file set against an already-captured diff. Public for the spec's normalization cases. */
32
32
  hashOf(files: readonly string[], byFile: ReadonlyMap<string, string>): string;
33
33
  private normalize;
@@ -33,11 +33,11 @@ let ChecklistScopeHasher = class ChecklistScopeHasher {
33
33
  * capture the materializer uses), then per-file normalization, then one sha256 per checklist.
34
34
  * Empty when the basis is unresolved: with no fork point there is no diff to hash.
35
35
  */
36
- hashes(repoRoot, basis, checklists) {
36
+ async hashes(repoRoot, basis, checklists) {
37
37
  const out = {};
38
38
  if (basis.unresolved || checklists.length === 0)
39
39
  return out;
40
- const byFile = this.materializer.diffByFile(repoRoot, basis);
40
+ const byFile = await this.materializer.diffByFile(repoRoot, basis);
41
41
  for (const req of checklists)
42
42
  out[req.id] = this.hashOf(req.matchedFiles, byFile);
43
43
  return out;
@@ -1 +1 @@
1
- {"version":3,"file":"checklist-scope-hasher.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/checklist-scope-hasher.ts"],"names":[],"mappings":";;;;AAAA,uDAAiC;AAEjC,yCAA2D;AAE3D,2DAAuD;AAEvD;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACA;IAA7B,YAA6B,YAA8B;QAA9B,iBAAY,GAAZ,YAAY,CAAkB;IAAG,CAAC;IAE/D;;;;OAIG;IACH,MAAM,CAAC,QAAgB,EAAE,KAAgB,EAAE,UAAwC;QAC/E,MAAM,GAAG,GAA2B,EAAE,CAAC;QACvC,IAAI,KAAK,CAAC,UAA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B;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEM,oCAAgB;GADlD,oBAAoB,CAiChC","sourcesContent":["import * as crypto from 'crypto';\nimport { RequiredChecklist } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { DiffBasis } from './diff-basis';\nimport { DiffMaterializer } from './diff-materializer';\n\n/**\n * ONE hash per checklist of the diff that checklist is actually judged on: its in-scope files, each with\n * its patch from the fork point. Two verdicts judged the same change exactly when their hashes are equal —\n * which is the whole question verdict CARRY-OVER asks (issue #863).\n *\n * WHY a carried verdict is keyed on this and not on HEAD: on the measured Codex run, round 3 re-ran the\n * security and error-handling checklists although both were green in round 2 and the round-2 fix touched\n * none of their in-scope files. HEAD moved; what those two reviewers judge did not. The hash is what says so.\n *\n * NORMALIZED so that bookkeeping git adds around a patch does not look like a change to it:\n * - `index <a>..<b>` lines are dropped — blob ids, which move whenever the fork point does;\n * - hunk headers keep their text but lose their line numbers — a `wp-start-upsert-pr` merge that adds\n * lines ABOVE an untouched hunk shifts `@@ -40,6 +40,9 @@`, and the change itself is identical.\n * Everything else — every added, removed and context line, and the set of files — is hashed, so a change\n * anywhere in a checklist's scope (including a NEW file coming into it) re-briefs that checklist.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ChecklistScopeHasher {\n constructor(private readonly materializer: DiffMaterializer) {}\n\n /**\n * checklist id → scope hash, for every checklist given. ONE `git diff` for all of them (the same single\n * capture the materializer uses), then per-file normalization, then one sha256 per checklist.\n * Empty when the basis is unresolved: with no fork point there is no diff to hash.\n */\n hashes(repoRoot: string, basis: DiffBasis, checklists: readonly RequiredChecklist[]): Record<string, string> {\n const out: Record<string, string> = {};\n if (basis.unresolved || checklists.length === 0) return out;\n const byFile = this.materializer.diffByFile(repoRoot, basis);\n for (const req of checklists) out[req.id] = this.hashOf(req.matchedFiles, byFile);\n return out;\n }\n\n /** The hash of one file set against an already-captured diff. Public for the spec's normalization cases. */\n hashOf(files: readonly string[], byFile: ReadonlyMap<string, string>): string {\n const hash = crypto.createHash('sha256');\n for (const file of [...files].sort()) {\n hash.update(`FILE ${file}\\n`);\n hash.update(this.normalize(byFile.get(file) ?? '<no diff>\\n'));\n }\n return hash.digest('hex');\n }\n\n private normalize(patch: string): string {\n return patch\n .split('\\n')\n .filter((line: string): boolean => !line.startsWith('index '))\n .map((line: string): string => line.startsWith('@@') ? line.replace(/^@@ [^@]*@@/, '@@') : line)\n .join('\\n');\n }\n}\n"]}
1
+ {"version":3,"file":"checklist-scope-hasher.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/checklist-scope-hasher.ts"],"names":[],"mappings":";;;;AAAA,uDAAiC;AAEjC,yCAA2D;AAE3D,2DAAuD;AAEvD;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IACA;IAA7B,YAA6B,YAA8B;QAA9B,iBAAY,GAAZ,YAAY,CAAkB;IAAG,CAAC;IAE/D;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,QAAgB,EAAE,KAAgB,EAAE,UAAwC;QACrF,MAAM,GAAG,GAA2B,EAAE,CAAC;QACvC,IAAI,KAAK,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,GAAG,CAAC;QAC5D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACnE,KAAK,MAAM,GAAG,IAAI,UAAU;YAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAClF,OAAO,GAAG,CAAC;IACf,CAAC;IAED,4GAA4G;IAC5G,MAAM,CAAC,KAAwB,EAAE,MAAmC;QAChE,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACzC,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC;YAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAEO,SAAS,CAAC,KAAa;QAC3B,OAAO,KAAK;aACP,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,IAAY,EAAW,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;aAC7D,GAAG,CAAC,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;aAC/F,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;CACJ,CAAA;AAjCY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEM,oCAAgB;GADlD,oBAAoB,CAiChC","sourcesContent":["import * as crypto from 'crypto';\nimport { RequiredChecklist } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { DiffBasis } from './diff-basis';\nimport { DiffMaterializer } from './diff-materializer';\n\n/**\n * ONE hash per checklist of the diff that checklist is actually judged on: its in-scope files, each with\n * its patch from the fork point. Two verdicts judged the same change exactly when their hashes are equal —\n * which is the whole question verdict CARRY-OVER asks (issue #863).\n *\n * WHY a carried verdict is keyed on this and not on HEAD: on the measured Codex run, round 3 re-ran the\n * security and error-handling checklists although both were green in round 2 and the round-2 fix touched\n * none of their in-scope files. HEAD moved; what those two reviewers judge did not. The hash is what says so.\n *\n * NORMALIZED so that bookkeeping git adds around a patch does not look like a change to it:\n * - `index <a>..<b>` lines are dropped — blob ids, which move whenever the fork point does;\n * - hunk headers keep their text but lose their line numbers — a `wp-start-upsert-pr` merge that adds\n * lines ABOVE an untouched hunk shifts `@@ -40,6 +40,9 @@`, and the change itself is identical.\n * Everything else — every added, removed and context line, and the set of files — is hashed, so a change\n * anywhere in a checklist's scope (including a NEW file coming into it) re-briefs that checklist.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ChecklistScopeHasher {\n constructor(private readonly materializer: DiffMaterializer) {}\n\n /**\n * checklist id → scope hash, for every checklist given. ONE `git diff` for all of them (the same single\n * capture the materializer uses), then per-file normalization, then one sha256 per checklist.\n * Empty when the basis is unresolved: with no fork point there is no diff to hash.\n */\n async hashes(repoRoot: string, basis: DiffBasis, checklists: readonly RequiredChecklist[]): Promise<Record<string, string>> {\n const out: Record<string, string> = {};\n if (basis.unresolved || checklists.length === 0) return out;\n const byFile = await this.materializer.diffByFile(repoRoot, basis);\n for (const req of checklists) out[req.id] = this.hashOf(req.matchedFiles, byFile);\n return out;\n }\n\n /** The hash of one file set against an already-captured diff. Public for the spec's normalization cases. */\n hashOf(files: readonly string[], byFile: ReadonlyMap<string, string>): string {\n const hash = crypto.createHash('sha256');\n for (const file of [...files].sort()) {\n hash.update(`FILE ${file}\\n`);\n hash.update(this.normalize(byFile.get(file) ?? '<no diff>\\n'));\n }\n return hash.digest('hex');\n }\n\n private normalize(patch: string): string {\n return patch\n .split('\\n')\n .filter((line: string): boolean => !line.startsWith('index '))\n .map((line: string): string => line.startsWith('@@') ? line.replace(/^@@ [^@]*@@/, '@@') : line)\n .join('\\n');\n }\n}\n"]}
@@ -51,7 +51,7 @@ export declare class DevDeployRefs {
51
51
  * composition CI will actually build. A different order can produce a different (still valid) merge
52
52
  * result, which would make the local resolution a guess about CI rather than a rehearsal of it.
53
53
  */
54
- liveCopies(repoRoot: string, cfg: DevDeployConfig): DevCopy[];
54
+ liveCopies(repoRoot: string, cfg: DevDeployConfig): Promise<DevCopy[]>;
55
55
  /**
56
56
  * The sha of a local ref (default HEAD).
57
57
  *
@@ -59,16 +59,16 @@ export declare class DevDeployRefs {
59
59
  * REF instead would be a moving target — it advances the next time anybody publishes — and the whole
60
60
  * value of the "did my code land in dev" check is that it is a claim about one specific commit.
61
61
  */
62
- headSha(repoRoot: string, ref?: string): string;
62
+ headSha(repoRoot: string, ref?: string): Promise<string>;
63
63
  /** The remote sha of one copy, or '' when that copy does not exist yet. */
64
- remoteSha(repoRoot: string, ref: string): string;
64
+ remoteSha(repoRoot: string, ref: string): Promise<string>;
65
65
  /**
66
66
  * Fetch the named copy refs into `refs/remotes/origin/<ref>` so the local merges below run against
67
67
  * fresh state. A no-op for an empty list, and a hard failure otherwise: a resolve queued against
68
68
  * stale refs rehearses a composition CI will not build.
69
69
  */
70
- fetchCopies(repoRoot: string, refs: string[]): void;
70
+ fetchCopies(repoRoot: string, refs: string[]): Promise<void>;
71
71
  /** How many commits `origin/<ref>` has that `HEAD` does not — the clobber signal. 0 = safe to publish. */
72
- commitsOnlyOnRemote(repoRoot: string, ref: string): number;
72
+ commitsOnlyOnRemote(repoRoot: string, ref: string): Promise<number>;
73
73
  private refusal;
74
74
  }
@@ -91,8 +91,8 @@ let DevDeployRefs = class DevDeployRefs {
91
91
  * composition CI will actually build. A different order can produce a different (still valid) merge
92
92
  * result, which would make the local resolution a guess about CI rather than a rehearsal of it.
93
93
  */
94
- liveCopies(repoRoot, cfg) {
95
- const out = this.gitExec.gitQuery(['ls-remote', '--heads', 'origin', cfg.copyRefGlob()], repoRoot, `Failed to list the dev copies (git ls-remote --heads origin '${cfg.copyRefGlob()}').`);
94
+ async liveCopies(repoRoot, cfg) {
95
+ const out = await this.gitExec.gitQuery(['ls-remote', '--heads', 'origin', cfg.copyRefGlob()], repoRoot, `Failed to list the dev copies (git ls-remote --heads origin '${cfg.copyRefGlob()}').`);
96
96
  const copies = [];
97
97
  for (const line of out.split('\n')) {
98
98
  if (line.trim() === '')
@@ -118,8 +118,8 @@ let DevDeployRefs = class DevDeployRefs {
118
118
  return this.gitExec.gitQuery(['-C', repoRoot, 'rev-parse', ref], repoRoot, `Failed to read the sha of ${ref} (git rev-parse).`);
119
119
  }
120
120
  /** The remote sha of one copy, or '' when that copy does not exist yet. */
121
- remoteSha(repoRoot, ref) {
122
- const out = this.gitExec.gitQuery(['ls-remote', '--heads', 'origin', ref], repoRoot, `Failed to look up origin/${ref} (git ls-remote).`);
121
+ async remoteSha(repoRoot, ref) {
122
+ const out = await this.gitExec.gitQuery(['ls-remote', '--heads', 'origin', ref], repoRoot, `Failed to look up origin/${ref} (git ls-remote).`);
123
123
  const line = out.split('\n').find((l) => l.trim() !== '');
124
124
  if (line === undefined)
125
125
  return '';
@@ -130,15 +130,15 @@ let DevDeployRefs = class DevDeployRefs {
130
130
  * fresh state. A no-op for an empty list, and a hard failure otherwise: a resolve queued against
131
131
  * stale refs rehearses a composition CI will not build.
132
132
  */
133
- fetchCopies(repoRoot, refs) {
133
+ async fetchCopies(repoRoot, refs) {
134
134
  if (refs.length === 0)
135
135
  return;
136
136
  const specs = refs.map((r) => `+refs/heads/${r}:refs/remotes/origin/${r}`);
137
- this.gitExec.runGitChecked(['-C', repoRoot, 'fetch', 'origin', ...specs], 'Failed to fetch the dev copy refs from origin');
137
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'fetch', 'origin', ...specs], 'Failed to fetch the dev copy refs from origin');
138
138
  }
139
139
  /** How many commits `origin/<ref>` has that `HEAD` does not — the clobber signal. 0 = safe to publish. */
140
- commitsOnlyOnRemote(repoRoot, ref) {
141
- const out = this.gitExec.gitQuery(['rev-list', '--count', `HEAD..refs/remotes/origin/${ref}`], repoRoot, `Failed to compare HEAD against origin/${ref} (git rev-list --count).`);
140
+ async commitsOnlyOnRemote(repoRoot, ref) {
141
+ const out = await this.gitExec.gitQuery(['rev-list', '--count', `HEAD..refs/remotes/origin/${ref}`], repoRoot, `Failed to compare HEAD against origin/${ref} (git rev-list --count).`);
142
142
  const count = Number(out);
143
143
  return Number.isInteger(count) ? count : 0;
144
144
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dev-deploy-refs.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/dev-deploy-refs.ts"],"names":[],"mappings":";;;;AAAA,0DAAsG;AACtG,yCAA2D;AAC3D,8DAAwD;AAExD,yCAAqC;AAErC,MAAM,GAAG,GAAG,0DAA0D,CAAC;AACvE,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,QAAQ,GAAG,MAAM,CAAC;AAExB;;;;GAIG;AACH,MAAa,OAAO;IAChB,iFAAiF;IACjF,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,uFAAuF;IACvF,YAAY,CAAS;IAErB,YAAY,GAAW,EAAE,GAAW,EAAE,YAAoB;QACtD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;CACJ;AAZD,0BAYC;AAED;;;;;;;;;;GAUG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAa;IACO;IAA7B,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEjD,6FAA6F;IAC7F,MAAM,CAAC,QAAgB;QACnB,OAAO,IAAA,8BAAe,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;IACtD,CAAC;IAED,0GAA0G;IAC1G,aAAa,CAAC,QAAgB;QAC1B,OAAO,4BAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC/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CAAC,UAAU,EAAE,SAAS,EAAE,6BAA6B,GAAG,EAAE,CAAC,EAAE,QAAQ,EACnG,yCAAyC,GAAG,0BAA0B,CAAC,CAAC;QAC5E,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEO,OAAO,CAAC,QAAgB,EAAE,IAAY;QAC1C,OAAO,IAAI,GAAG,GAAG,GAAG,KAAK,QAAQ,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,WAAW,0BAAW,mCAAmC,CAAC;IAC1H,CAAC;CACJ,CAAA;AA1HY,sCAAa;wBAAb,aAAa;IADzB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEC,kBAAO;GADpC,aAAa,CA0HzB","sourcesContent":["import { CliExitError, DevDeployConfig, loadAndValidate, WP_PUSH_DEV } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { gitCheckout } from '@webpieces/tooling-common';\n\nimport { GitExec } from './git-exec';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\nconst MAIN = 'main';\nconst DETACHED = 'HEAD';\n\n/**\n * One live copy in the dev namespace: the remote ref and the sha it points at. Data-only per CLAUDE.md —\n * `--list` prints it and the clobber guard compares against `sha`, and neither should be re-parsing\n * `ls-remote` output.\n */\nexport class DevCopy {\n /** The full ref name WITHOUT `refs/heads/`, e.g. `dev-include/dean/ONE-2275`. */\n ref: string;\n sha: string;\n /** The feature branch this is a copy OF — `ref` with the namespace prefix stripped. */\n sourceBranch: string;\n\n constructor(ref: string, sha: string, sourceBranch: string) {\n this.ref = ref;\n this.sha = sha;\n this.sourceBranch = sourceBranch;\n }\n}\n\n/**\n * Ref derivation and preconditions for the dev-deploy flow — the half of `wp-push-dev` that decides WHICH\n * refs are in play, kept out of the commands so both `wp-push-dev` and `wp-finish-push-dev` answer those\n * questions identically.\n *\n * THE INVARIANT THIS FILE EXISTS TO PROTECT: the feature branch is the PR head, so it must never acquire\n * another developer's commits — landing that PR would ship their unreviewed work to production. Every\n * write this flow performs therefore targets either the `<namespace>/<feature>` copy or a local throwaway\n * branch, and NOTHING here ever moves `<feature>` itself. That is why a conflict resolution needs the copy\n * to live in: it is the only place the resolution can be recorded without contaminating the PR.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class DevDeployRefs {\n constructor(private readonly gitExec: GitExec) {}\n\n /** The `pr-gate.devDeploy` block — `dev-include` / `dev` unless the consumer overrode it. */\n config(repoRoot: string): DevDeployConfig {\n return loadAndValidate(repoRoot).prGate.devDeploy;\n }\n\n /** The checked-out branch name, or `'HEAD'` on a detached HEAD (which {@link assertPushable} refuses). */\n currentBranch(repoRoot: string): string {\n return gitCheckout.requireBranch(repoRoot);\n }\n\n /**\n * Refuse every branch that must never be the SOURCE of a dev copy, before anything is fetched or\n * pushed.\n *\n * `main` and the composed dev branch are refused for the same reason from opposite ends: `main` is the\n * trunk (whatever is on it already deploys, so copying it is meaningless), and the dev branch is a\n * BUILD ARTIFACT that CI recomputes from `origin/main` on every run — copying it would publish a\n * composition of everyone's work under one developer's name, and it would be wiped on the next CI run\n * anyway. A branch already inside the namespace is refused because publishing a copy of a copy nests\n * the prefix (`dev-include/dev-include/…`) and nothing would ever clean it up.\n */\n assertPushable(cfg: DevDeployConfig, branch: string): void {\n if (branch === DETACHED || branch === '') {\n throw new CliExitError(2, this.refusal(\n 'Detached HEAD',\n 'There is no branch name to derive the dev copy from. Check out your feature branch first:\\n'\n + ' git checkout <your-feature-branch>\\n'));\n }\n if (branch === MAIN) {\n throw new CliExitError(2, this.refusal(\n `Refusing to publish a dev copy of \\`${MAIN}\\``,\n `\\`${MAIN}\\` is the trunk — whatever is on it already deploys, so a dev copy of it means nothing.\\n`\n + 'Check out the feature branch you actually want on the dev server and re-run.\\n'));\n }\n if (branch === cfg.devBranch) {\n throw new CliExitError(2, this.refusal(\n `Refusing to publish a dev copy of \\`${cfg.devBranch}\\``,\n `\\`${cfg.devBranch}\\` is a BUILD ARTIFACT, not a source branch: your CI resets it to origin/${MAIN},\\n`\n + `merges every \\`${cfg.copyRefGlob()}\\` ref into it, and force-pushes — every run. Copying it would\\n`\n + \"publish a composition of everybody's work under your branch's name, and the next CI run would\\n\"\n + 'wipe it. Check out your own feature branch and re-run.\\n'));\n }\n if (branch === cfg.branchNamespace || branch.startsWith(`${cfg.branchNamespace}/`)) {\n throw new CliExitError(2, this.refusal(\n `Refusing to publish a dev copy of a dev copy (\\`${branch}\\`)`,\n `\\`${cfg.branchNamespace}/\\` holds the disposable copies this command WRITES; you are standing on one.\\n`\n + `Publishing from here would nest the prefix (\\`${cfg.branchNamespace}/${branch}\\`) and nothing ever\\n`\n + 'cleans that up. Check out the real feature branch and re-run.\\n'));\n }\n }\n\n /**\n * Every live copy in the namespace, sorted by ref name.\n *\n * The sort is not cosmetic: `--resolve` with no argument queues these in exactly this order, and the\n * consumer's CI composes `dev` in the same order, so what a developer resolves locally is the\n * composition CI will actually build. A different order can produce a different (still valid) merge\n * result, which would make the local resolution a guess about CI rather than a rehearsal of it.\n */\n liveCopies(repoRoot: string, cfg: DevDeployConfig): DevCopy[] {\n const out = this.gitExec.gitQuery(['ls-remote', '--heads', 'origin', cfg.copyRefGlob()], repoRoot,\n `Failed to list the dev copies (git ls-remote --heads origin '${cfg.copyRefGlob()}').`);\n const copies: DevCopy[] = [];\n for (const line of out.split('\\n')) {\n if (line.trim() === '') continue;\n const fields = line.split(/\\s+/);\n const sha = fields[0];\n const ref = fields[1];\n if (sha === undefined || ref === undefined || !ref.startsWith('refs/heads/')) continue;\n const shortRef = ref.slice('refs/heads/'.length);\n copies.push(new DevCopy(shortRef, sha, shortRef.slice(cfg.branchNamespace.length + 1)));\n }\n return copies.sort((a: DevCopy, b: DevCopy): number => (a.ref < b.ref ? -1 : a.ref > b.ref ? 1 : 0));\n }\n\n /**\n * The sha of a local ref (default HEAD).\n *\n * Read AFTER a push so the watch hints quote the sha that is provably published. Quoting the copy\n * REF instead would be a moving target — it advances the next time anybody publishes — and the whole\n * value of the \"did my code land in dev\" check is that it is a claim about one specific commit.\n */\n headSha(repoRoot: string, ref = 'HEAD'): string {\n return this.gitExec.gitQuery(['-C', repoRoot, 'rev-parse', ref], repoRoot,\n `Failed to read the sha of ${ref} (git rev-parse).`);\n }\n\n /** The remote sha of one copy, or '' when that copy does not exist yet. */\n remoteSha(repoRoot: string, ref: string): string {\n const out = this.gitExec.gitQuery(['ls-remote', '--heads', 'origin', ref], repoRoot,\n `Failed to look up origin/${ref} (git ls-remote).`);\n const line = out.split('\\n').find((l: string): boolean => l.trim() !== '');\n if (line === undefined) return '';\n return line.split(/\\s+/)[0] ?? '';\n }\n\n /**\n * Fetch the named copy refs into `refs/remotes/origin/<ref>` so the local merges below run against\n * fresh state. A no-op for an empty list, and a hard failure otherwise: a resolve queued against\n * stale refs rehearses a composition CI will not build.\n */\n fetchCopies(repoRoot: string, refs: string[]): void {\n if (refs.length === 0) return;\n const specs = refs.map((r: string): string => `+refs/heads/${r}:refs/remotes/origin/${r}`);\n this.gitExec.runGitChecked(['-C', repoRoot, 'fetch', 'origin', ...specs],\n 'Failed to fetch the dev copy refs from origin');\n }\n\n /** How many commits `origin/<ref>` has that `HEAD` does not — the clobber signal. 0 = safe to publish. */\n commitsOnlyOnRemote(repoRoot: string, ref: string): number {\n const out = this.gitExec.gitQuery(['rev-list', '--count', `HEAD..refs/remotes/origin/${ref}`], repoRoot,\n `Failed to compare HEAD against origin/${ref} (git rev-list --count).`);\n const count = Number(out);\n return Number.isInteger(count) ? count : 0;\n }\n\n private refusal(headline: string, body: string): string {\n return '\\n' + SEP + `⛔ ${headline}\\n` + SEP + '\\n' + body + `\\nRun \\`${WP_PUSH_DEV} --help\\` for the full command.\\n`;\n }\n}\n"]}
1
+ {"version":3,"file":"dev-deploy-refs.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/dev-deploy-refs.ts"],"names":[],"mappings":";;;;AAAA,0DAAsG;AACtG,yCAA2D;AAC3D,8DAAwD;AAExD,yCAAqC;AAErC,MAAM,GAAG,GAAG,0DAA0D,CAAC;AACvE,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,QAAQ,GAAG,MAAM,CAAC;AAExB;;;;GAIG;AACH,MAAa,OAAO;IAChB,iFAAiF;IACjF,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,uFAAuF;IACvF,YAAY,CAAS;IAErB,YAAY,GAAW,EAAE,GAAW,EAAE,YAAoB;QACtD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;CACJ;AAZD,0BAYC;AAED;;;;;;;;;;GAUG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAa;IACO;IAA7B,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEjD,6FAA6F;IAC7F,MAAM,CAAC,QAAgB;QACnB,OAAO,IAAA,8BAAe,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;IACtD,CAAC;IAED,0GAA0G;IAC1G,aAAa,CAAC,QAAgB;QAC1B,OAAO,4BAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;;;;OAUG;IACH,cAAc,CAAC,GAAoB,EAAE,MAAc;QAC/C,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;YACvC,MAAM,IAAI,2BAAY,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAClC,eAAe,EACf,6FAA6F;kBAC3F,wCAAwC,CAAC,CAAC,CAAC;QACrD,C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AS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEO,OAAO,CAAC,QAAgB,EAAE,IAAY;QAC1C,OAAO,IAAI,GAAG,GAAG,GAAG,KAAK,QAAQ,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,WAAW,0BAAW,mCAAmC,CAAC;IAC1H,CAAC;CACJ,CAAA;AA1HY,sCAAa;wBAAb,aAAa;IADzB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEC,kBAAO;GADpC,aAAa,CA0HzB","sourcesContent":["import { CliExitError, DevDeployConfig, loadAndValidate, WP_PUSH_DEV } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { gitCheckout } from '@webpieces/tooling-common';\n\nimport { GitExec } from './git-exec';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\nconst MAIN = 'main';\nconst DETACHED = 'HEAD';\n\n/**\n * One live copy in the dev namespace: the remote ref and the sha it points at. Data-only per CLAUDE.md —\n * `--list` prints it and the clobber guard compares against `sha`, and neither should be re-parsing\n * `ls-remote` output.\n */\nexport class DevCopy {\n /** The full ref name WITHOUT `refs/heads/`, e.g. `dev-include/dean/ONE-2275`. */\n ref: string;\n sha: string;\n /** The feature branch this is a copy OF — `ref` with the namespace prefix stripped. */\n sourceBranch: string;\n\n constructor(ref: string, sha: string, sourceBranch: string) {\n this.ref = ref;\n this.sha = sha;\n this.sourceBranch = sourceBranch;\n }\n}\n\n/**\n * Ref derivation and preconditions for the dev-deploy flow — the half of `wp-push-dev` that decides WHICH\n * refs are in play, kept out of the commands so both `wp-push-dev` and `wp-finish-push-dev` answer those\n * questions identically.\n *\n * THE INVARIANT THIS FILE EXISTS TO PROTECT: the feature branch is the PR head, so it must never acquire\n * another developer's commits — landing that PR would ship their unreviewed work to production. Every\n * write this flow performs therefore targets either the `<namespace>/<feature>` copy or a local throwaway\n * branch, and NOTHING here ever moves `<feature>` itself. That is why a conflict resolution needs the copy\n * to live in: it is the only place the resolution can be recorded without contaminating the PR.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class DevDeployRefs {\n constructor(private readonly gitExec: GitExec) {}\n\n /** The `pr-gate.devDeploy` block — `dev-include` / `dev` unless the consumer overrode it. */\n config(repoRoot: string): DevDeployConfig {\n return loadAndValidate(repoRoot).prGate.devDeploy;\n }\n\n /** The checked-out branch name, or `'HEAD'` on a detached HEAD (which {@link assertPushable} refuses). */\n currentBranch(repoRoot: string): string {\n return gitCheckout.requireBranch(repoRoot);\n }\n\n /**\n * Refuse every branch that must never be the SOURCE of a dev copy, before anything is fetched or\n * pushed.\n *\n * `main` and the composed dev branch are refused for the same reason from opposite ends: `main` is the\n * trunk (whatever is on it already deploys, so copying it is meaningless), and the dev branch is a\n * BUILD ARTIFACT that CI recomputes from `origin/main` on every run — copying it would publish a\n * composition of everyone's work under one developer's name, and it would be wiped on the next CI run\n * anyway. A branch already inside the namespace is refused because publishing a copy of a copy nests\n * the prefix (`dev-include/dev-include/…`) and nothing would ever clean it up.\n */\n assertPushable(cfg: DevDeployConfig, branch: string): void {\n if (branch === DETACHED || branch === '') {\n throw new CliExitError(2, this.refusal(\n 'Detached HEAD',\n 'There is no branch name to derive the dev copy from. Check out your feature branch first:\\n'\n + ' git checkout <your-feature-branch>\\n'));\n }\n if (branch === MAIN) {\n throw new CliExitError(2, this.refusal(\n `Refusing to publish a dev copy of \\`${MAIN}\\``,\n `\\`${MAIN}\\` is the trunk — whatever is on it already deploys, so a dev copy of it means nothing.\\n`\n + 'Check out the feature branch you actually want on the dev server and re-run.\\n'));\n }\n if (branch === cfg.devBranch) {\n throw new CliExitError(2, this.refusal(\n `Refusing to publish a dev copy of \\`${cfg.devBranch}\\``,\n `\\`${cfg.devBranch}\\` is a BUILD ARTIFACT, not a source branch: your CI resets it to origin/${MAIN},\\n`\n + `merges every \\`${cfg.copyRefGlob()}\\` ref into it, and force-pushes — every run. Copying it would\\n`\n + \"publish a composition of everybody's work under your branch's name, and the next CI run would\\n\"\n + 'wipe it. Check out your own feature branch and re-run.\\n'));\n }\n if (branch === cfg.branchNamespace || branch.startsWith(`${cfg.branchNamespace}/`)) {\n throw new CliExitError(2, this.refusal(\n `Refusing to publish a dev copy of a dev copy (\\`${branch}\\`)`,\n `\\`${cfg.branchNamespace}/\\` holds the disposable copies this command WRITES; you are standing on one.\\n`\n + `Publishing from here would nest the prefix (\\`${cfg.branchNamespace}/${branch}\\`) and nothing ever\\n`\n + 'cleans that up. Check out the real feature branch and re-run.\\n'));\n }\n }\n\n /**\n * Every live copy in the namespace, sorted by ref name.\n *\n * The sort is not cosmetic: `--resolve` with no argument queues these in exactly this order, and the\n * consumer's CI composes `dev` in the same order, so what a developer resolves locally is the\n * composition CI will actually build. A different order can produce a different (still valid) merge\n * result, which would make the local resolution a guess about CI rather than a rehearsal of it.\n */\n async liveCopies(repoRoot: string, cfg: DevDeployConfig): Promise<DevCopy[]> {\n const out = await this.gitExec.gitQuery(['ls-remote', '--heads', 'origin', cfg.copyRefGlob()], repoRoot,\n `Failed to list the dev copies (git ls-remote --heads origin '${cfg.copyRefGlob()}').`);\n const copies: DevCopy[] = [];\n for (const line of out.split('\\n')) {\n if (line.trim() === '') continue;\n const fields = line.split(/\\s+/);\n const sha = fields[0];\n const ref = fields[1];\n if (sha === undefined || ref === undefined || !ref.startsWith('refs/heads/')) continue;\n const shortRef = ref.slice('refs/heads/'.length);\n copies.push(new DevCopy(shortRef, sha, shortRef.slice(cfg.branchNamespace.length + 1)));\n }\n return copies.sort((a: DevCopy, b: DevCopy): number => (a.ref < b.ref ? -1 : a.ref > b.ref ? 1 : 0));\n }\n\n /**\n * The sha of a local ref (default HEAD).\n *\n * Read AFTER a push so the watch hints quote the sha that is provably published. Quoting the copy\n * REF instead would be a moving target — it advances the next time anybody publishes — and the whole\n * value of the \"did my code land in dev\" check is that it is a claim about one specific commit.\n */\n headSha(repoRoot: string, ref = 'HEAD'): Promise<string> {\n return this.gitExec.gitQuery(['-C', repoRoot, 'rev-parse', ref], repoRoot,\n `Failed to read the sha of ${ref} (git rev-parse).`);\n }\n\n /** The remote sha of one copy, or '' when that copy does not exist yet. */\n async remoteSha(repoRoot: string, ref: string): Promise<string> {\n const out = await this.gitExec.gitQuery(['ls-remote', '--heads', 'origin', ref], repoRoot,\n `Failed to look up origin/${ref} (git ls-remote).`);\n const line = out.split('\\n').find((l: string): boolean => l.trim() !== '');\n if (line === undefined) return '';\n return line.split(/\\s+/)[0] ?? '';\n }\n\n /**\n * Fetch the named copy refs into `refs/remotes/origin/<ref>` so the local merges below run against\n * fresh state. A no-op for an empty list, and a hard failure otherwise: a resolve queued against\n * stale refs rehearses a composition CI will not build.\n */\n async fetchCopies(repoRoot: string, refs: string[]): Promise<void> {\n if (refs.length === 0) return;\n const specs = refs.map((r: string): string => `+refs/heads/${r}:refs/remotes/origin/${r}`);\n await this.gitExec.runGitChecked(['-C', repoRoot, 'fetch', 'origin', ...specs],\n 'Failed to fetch the dev copy refs from origin');\n }\n\n /** How many commits `origin/<ref>` has that `HEAD` does not — the clobber signal. 0 = safe to publish. */\n async commitsOnlyOnRemote(repoRoot: string, ref: string): Promise<number> {\n const out = await this.gitExec.gitQuery(['rev-list', '--count', `HEAD..refs/remotes/origin/${ref}`], repoRoot,\n `Failed to compare HEAD against origin/${ref} (git rev-list --count).`);\n const count = Number(out);\n return Number.isInteger(count) ? count : 0;\n }\n\n private refusal(headline: string, body: string): string {\n return '\\n' + SEP + `⛔ ${headline}\\n` + SEP + '\\n' + body + `\\nRun \\`${WP_PUSH_DEV} --help\\` for the full command.\\n`;\n }\n}\n"]}
@@ -34,7 +34,7 @@ export declare class DevResolveRunner {
34
34
  * `fetchRefs` is passed separately from the queue because `--rebase-resolution` merges a ref that is
35
35
  * also its push destination, so "everything to fetch" and "everything to merge" are not the same list.
36
36
  */
37
- start(repoRoot: string, state: PushDevState, base: string, fetchRefs: string[]): void;
37
+ start(repoRoot: string, state: PushDevState, base: string, fetchRefs: string[]): Promise<void>;
38
38
  /**
39
39
  * Resume after the human/AI has resolved the halted merge: commit it, then keep draining.
40
40
  *
@@ -42,12 +42,12 @@ export declare class DevResolveRunner {
42
42
  * fetched an hour ago rehearses a composition CI will not build — the one freshness gap the sibling
43
43
  * update flow is still known to have (only its stage ① ever fetches).
44
44
  */
45
- resume(repoRoot: string, state: PushDevState): void;
45
+ resume(repoRoot: string, state: PushDevState): Promise<void>;
46
46
  /**
47
47
  * Throw the whole resolve away: undo any halted merge, go back to the original branch, delete the
48
48
  * throwaway branch and the state file. Nothing published, nothing on the feature branch.
49
49
  */
50
- abort(repoRoot: string, state: PushDevState): void;
50
+ abort(repoRoot: string, state: PushDevState): Promise<void>;
51
51
  /**
52
52
  * Merge queued refs until one conflicts (HALT, hand the tree over) or the queue empties (PUBLISH).
53
53
  *
@@ -45,11 +45,11 @@ let DevResolveRunner = class DevResolveRunner {
45
45
  * `fetchRefs` is passed separately from the queue because `--rebase-resolution` merges a ref that is
46
46
  * also its push destination, so "everything to fetch" and "everything to merge" are not the same list.
47
47
  */
48
- start(repoRoot, state, base, fetchRefs) {
49
- this.refs.fetchCopies(repoRoot, fetchRefs);
48
+ async start(repoRoot, state, base, fetchRefs) {
49
+ await this.refs.fetchCopies(repoRoot, fetchRefs);
50
50
  this.store.write(repoRoot, state);
51
- this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', '-B', state.tmpBranch, base], `Failed to create the throwaway resolve branch ${state.tmpBranch}`);
52
- this.drain(repoRoot, state);
51
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', '-B', state.tmpBranch, base], `Failed to create the throwaway resolve branch ${state.tmpBranch}`);
52
+ await this.drain(repoRoot, state);
53
53
  }
54
54
  /**
55
55
  * Resume after the human/AI has resolved the halted merge: commit it, then keep draining.
@@ -58,26 +58,26 @@ let DevResolveRunner = class DevResolveRunner {
58
58
  * fetched an hour ago rehearses a composition CI will not build — the one freshness gap the sibling
59
59
  * update flow is still known to have (only its stage ① ever fetches).
60
60
  */
61
- resume(repoRoot, state) {
62
- this.assertNoUnmergedPaths(repoRoot, state);
63
- this.gitExec.assertNoUntracked(repoRoot);
64
- this.gitExec.runGitChecked(['-C', repoRoot, 'add', '-u'], 'Failed to stage the resolved files (git add -u)');
65
- this.gitExec.runGitChecked(['-C', repoRoot, 'commit', '--no-edit'], `Failed to commit the resolution of ${state.current}`);
61
+ async resume(repoRoot, state) {
62
+ await this.assertNoUnmergedPaths(repoRoot, state);
63
+ await this.gitExec.assertNoUntracked(repoRoot);
64
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'add', '-u'], 'Failed to stage the resolved files (git add -u)');
65
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'commit', '--no-edit'], `Failed to commit the resolution of ${state.current}`);
66
66
  process.stdout.write(`✅ Committed the resolution of ${state.current}.\n`);
67
67
  state.current = '';
68
- this.refs.fetchCopies(repoRoot, state.queue);
69
- this.drain(repoRoot, state);
68
+ await this.refs.fetchCopies(repoRoot, state.queue);
69
+ await this.drain(repoRoot, state);
70
70
  }
71
71
  /**
72
72
  * Throw the whole resolve away: undo any halted merge, go back to the original branch, delete the
73
73
  * throwaway branch and the state file. Nothing published, nothing on the feature branch.
74
74
  */
75
- abort(repoRoot, state) {
75
+ async abort(repoRoot, state) {
76
76
  // Allowed to fail: there is no merge to abort when the resolve halted between merges, and that is
77
77
  // not an error condition — the rest of the teardown must still run.
78
- this.gitExec.tryGit(['-C', repoRoot, 'merge', '--abort'], repoRoot);
79
- this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', state.originalBranch], `Failed to return to ${state.originalBranch}`);
80
- this.gitExec.tryGit(['-C', repoRoot, 'branch', '-D', state.tmpBranch], repoRoot);
78
+ await this.gitExec.tryGit(['-C', repoRoot, 'merge', '--abort'], repoRoot);
79
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', state.originalBranch], `Failed to return to ${state.originalBranch}`);
80
+ await this.gitExec.tryGit(['-C', repoRoot, 'branch', '-D', state.tmpBranch], repoRoot);
81
81
  this.store.clear(repoRoot);
82
82
  process.stdout.write('\n' + SEP + '🛑 Dev-deploy resolve aborted\n' + SEP + '\n'
83
83
  + `You are back on \`${state.originalBranch}\`; \`${state.tmpBranch}\` and the state file are gone.\n`
@@ -89,11 +89,11 @@ let DevResolveRunner = class DevResolveRunner {
89
89
  * A LATER ref can conflict too, which is why this is a loop resumed from a state file rather than a
90
90
  * single pass: `wp-finish-push-dev` can legitimately stop again on the next ref in the queue.
91
91
  */
92
- drain(repoRoot, state) {
92
+ async drain(repoRoot, state) {
93
93
  while (state.queue.length > 0) {
94
94
  const ref = state.queue[0];
95
95
  state.queue = state.queue.slice(1);
96
- const outcome = this.gitExec.tryGit(['-C', repoRoot, 'merge', '--no-ff', '--no-edit', '-m',
96
+ const outcome = await this.gitExec.tryGit(['-C', repoRoot, 'merge', '--no-ff', '--no-edit', '-m',
97
97
  `Dev-deploy: merge ${ref} into ${state.targetRef}`, `refs/remotes/origin/${ref}`], repoRoot);
98
98
  if (outcome.ok) {
99
99
  process.stdout.write(` ✓ merged ${ref}\n`);
@@ -101,14 +101,14 @@ let DevResolveRunner = class DevResolveRunner {
101
101
  }
102
102
  state.current = ref;
103
103
  this.store.write(repoRoot, state);
104
- this.halt(repoRoot, state);
104
+ await this.halt(repoRoot, state);
105
105
  return;
106
106
  }
107
- this.publish(repoRoot, state);
107
+ await this.publish(repoRoot, state);
108
108
  }
109
109
  /** Stop with the conflicted files listed and the ONE command that continues. Exit 2 = "your turn". */
110
- halt(repoRoot, state) {
111
- const conflicted = this.unmergedPaths(repoRoot);
110
+ async halt(repoRoot, state) {
111
+ const conflicted = await this.unmergedPaths(repoRoot);
112
112
  const remaining = state.queue.length > 0
113
113
  ? `\nStill queued after this one: ${state.queue.join(', ')}\n`
114
114
  + `\`${rules_config_1.WP_FINISH_PUSH_DEV}\` resumes the queue, so it may stop again on a later ref.\n`
@@ -126,13 +126,13 @@ let DevResolveRunner = class DevResolveRunner {
126
126
  + 'the finish command above does all three for you.\n');
127
127
  }
128
128
  /** Queue empty: force-push the composed result over the copy, then restore the original checkout. */
129
- publish(repoRoot, state) {
130
- this.gitExec.runGitChecked(['-C', repoRoot, 'push', '--force', 'origin', `${state.tmpBranch}:refs/heads/${state.targetRef}`], `Failed to publish the dev copy ${state.targetRef}`);
129
+ async publish(repoRoot, state) {
130
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'push', '--force', 'origin', `${state.tmpBranch}:refs/heads/${state.targetRef}`], `Failed to publish the dev copy ${state.targetRef}`);
131
131
  // Captured BEFORE the tmp branch is deleted — it is the composed sha the watch hints are about,
132
132
  // and after the checkout below HEAD is the feature branch, which is a different commit entirely.
133
- const published = this.refs.headSha(repoRoot, state.tmpBranch);
134
- this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', state.originalBranch], `Failed to return to ${state.originalBranch}`);
135
- this.gitExec.tryGit(['-C', repoRoot, 'branch', '-D', state.tmpBranch], repoRoot);
133
+ const published = await this.refs.headSha(repoRoot, state.tmpBranch);
134
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', state.originalBranch], `Failed to return to ${state.originalBranch}`);
135
+ await this.gitExec.tryGit(['-C', repoRoot, 'branch', '-D', state.tmpBranch], repoRoot);
136
136
  this.store.clear(repoRoot);
137
137
  process.stdout.write('\n' + SEP + `✅ Published ${state.targetRef} with the resolutions\n` + SEP + '\n'
138
138
  + `You are back on \`${state.originalBranch}\`, which was never modified — verify with:\n`
@@ -141,13 +141,13 @@ let DevResolveRunner = class DevResolveRunner {
141
141
  + this.watchHints.render(this.refs.config(repoRoot), state.targetRef, published));
142
142
  }
143
143
  /** Conflicted (unmerged-in-index) paths. Empty once every one has been resolved and `git add`ed. */
144
- unmergedPaths(repoRoot) {
145
- const out = this.gitExec.gitQuery(['-C', repoRoot, 'diff', '--name-only', '--diff-filter=U'], repoRoot, 'Failed to list the conflicted files (git diff --name-only --diff-filter=U).');
144
+ async unmergedPaths(repoRoot) {
145
+ const out = await this.gitExec.gitQuery(['-C', repoRoot, 'diff', '--name-only', '--diff-filter=U'], repoRoot, 'Failed to list the conflicted files (git diff --name-only --diff-filter=U).');
146
146
  return out.split('\n').filter((l) => l.trim() !== '');
147
147
  }
148
148
  // The gate on `wp-finish-push-dev`: refuse (and re-print the list) while anything is still unmerged.
149
- assertNoUnmergedPaths(repoRoot, state) {
150
- const conflicted = this.unmergedPaths(repoRoot);
149
+ async assertNoUnmergedPaths(repoRoot, state) {
150
+ const conflicted = await this.unmergedPaths(repoRoot);
151
151
  if (conflicted.length === 0)
152
152
  return;
153
153
  throw new rules_config_1.CliExitError(2, '\n' + SEP + '⛔ Conflicts are NOT resolved yet\n' + SEP + '\n'