@webpieces/pr-gate 0.4.831 → 0.4.833
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/dashboard/checklist-comment-renderer.js +2 -2
- package/src/dashboard/checklist-comment-renderer.js.map +1 -1
- package/src/scripts/commands/review-upsert-pr-command.d.ts +1 -12
- package/src/scripts/commands/review-upsert-pr-command.js +9 -21
- package/src/scripts/commands/review-upsert-pr-command.js.map +1 -1
- package/src/scripts/pr-gate-app.d.ts +2 -2
- package/src/scripts/pr-gate-app.js +2 -2
- package/src/scripts/pr-gate-app.js.map +1 -1
- package/src/scripts/workflow/review-report.d.ts +0 -17
- package/src/scripts/workflow/review-report.js +9 -50
- package/src/scripts/workflow/review-report.js.map +1 -1
- package/src/scripts/workflow/review-round-state.d.ts +5 -1
- package/src/scripts/workflow/review-round-state.js +15 -5
- package/src/scripts/workflow/review-round-state.js.map +1 -1
- package/src/scripts/workflow/review-stage-receipt.d.ts +7 -0
- package/src/scripts/workflow/review-stage-receipt.js +10 -0
- package/src/scripts/workflow/review-stage-receipt.js.map +1 -1
- package/src/scripts/wp-review-upsert-pr.js +2 -9
- package/src/scripts/wp-review-upsert-pr.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-round-state.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/review-round-state.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAC7B,iDAA0C;AAC1C,0DAEiC;AACjC,yCAA2D;AAE3D,6DAAgE;AAChE,6CAAyC;AAM5B,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAC/B,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAC/B,QAAA,gBAAgB,GAAG,KAAK,CAAC;AACzB,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAC/B,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAE5C,gHAAg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AAC,CAAC;QAC1F,MAAM,IAAI,4BAAa,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAEO,GAAG,CAAC,QAAgB,EAAE,IAAc;QACxC,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAC3E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7D,MAAM,OAAO,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,QAAQ,MAAM,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QAC7G,MAAM,OAAO,GAAG,oCAAoC,OAAO,KAAK,MAAM,EAAE,CAAC;QACzE,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS;YAAE,MAAM,IAAI,4BAAa,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1F,MAAM,IAAI,4BAAa,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACJ,CAAA;AAnWY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGJ,gCAAiB;QACjB,6CAAwB;QACxB,yBAAU;GAJlC,uBAAuB,CAmWnC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { spawnSync } from 'child_process';\nimport {\n AtomicFile, ChecklistResult, InformAiError, ReviewJsonService, VERDICT_ORANGE, VERDICT_RED, toError,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ReviewStageReceipt } from './review-stage-receipt';\nimport { VerdictProvenanceService } from './verdict-provenance';\nimport { DiffBasis } from './diff-basis';\n\ntype JsonPrimitive = string | number | boolean | null;\ntype JsonValue = JsonPrimitive | JsonValue[] | JsonObject;\ninterface JsonObject { [key: string]: JsonValue }\n\nexport const ROUND_ACTION_REVIEW = 'review';\nexport const ROUND_ACTION_RESUME = 'resume';\nexport const ROUND_ACTION_FIX = 'fix';\nexport const ROUND_ACTION_RECORD = 'record';\nexport const ROUND_ACTION_FINISH = 'finish';\n\n/** Every round-numbered file of a branch's review lives beside summary.json under this prefix (issue #1053). */\nconst ROUND_FILE = /^review-round(\\d+)-(.+)\\.json$/;\nconst FIXES_ID = 'fixes';\nconst PROVENANCE_SUFFIX = '.provenance';\n\nexport class ReviewRoundPlan {\n action: string;\n round: number;\n maxRounds: number;\n basis: DiffBasis;\n changedFiles: string[];\n redChecklistIds: string[];\n /** The final round's ORANGE checklists — must-fix, never re-reviewed (issue #1053). */\n orangeChecklistIds: string[];\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n action: string, round: number, maxRounds: number, basis: DiffBasis, changedFiles: string[] = [],\n redChecklistIds: string[] = [], orangeChecklistIds: string[] = [],\n ) {\n this.action = action;\n this.round = round;\n this.maxRounds = maxRounds;\n this.basis = basis;\n this.changedFiles = changedFiles;\n this.redChecklistIds = redChecklistIds;\n this.orangeChecklistIds = orangeChecklistIds;\n }\n}\n\n/**\n * Where a branch's review stands, DERIVED from the round-numbered files on disk plus the stage-② receipt\n * (issue #1053). There is no separate round counter: `round` is the highest round any file or briefing\n * names. Data-only.\n */\nexport class RoundSnapshot {\n round: number; // 0 = no round has started\n roster: string[]; // the checklists briefed in `round`\n headSha: string; // the commit `round` was briefed on\n complete: boolean; // every checklist on the roster has a verdict in `round`\n\n constructor(round: number, roster: string[], headSha: string, complete: boolean) {\n this.round = round;\n this.roster = roster;\n this.headSha = headSha;\n this.complete = complete;\n }\n}\n\nexport class RemediationResponse {\n checklistId: string;\n resolution: string;\n files: string[];\n\n constructor(checklistId: string, resolution: string, files: string[]) {\n this.checklistId = checklistId;\n this.resolution = resolution;\n this.files = files;\n }\n}\n\n/** The author's recorded fixes for one completed round: `review-round<N>-fixes.json`. Data-only. */\nexport class ReviewRemediation {\n agent: string;\n model: string;\n fromHead: string;\n toHead: string;\n responses: RemediationResponse[];\n writtenAt: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(agent: string, model: string, fromHead: string, toHead: string, responses: RemediationResponse[]) {\n this.agent = agent;\n this.model = model;\n this.fromHead = fromHead;\n this.toHead = toHead;\n this.responses = responses;\n this.writtenAt = new Date().toISOString();\n }\n}\n\n/**\n * The reviewer rounds of one branch, read from their round-numbered files (issue #1053).\n *\n * `commands.pr-gate.maxReviewerRounds` is a HARD CEILING, not a quota: 1 round means 1 round. Three rules\n * follow from it, and everything here exists to hold them:\n *\n * 1. Every verdict is `review-round<N>-<id>.json` (+ `.provenance.json`), every author fix record is\n * `review-round<N>-fixes.json`, and nothing is ever overwritten. The live verdict of a checklist is its\n * highest round; the round the branch is on is the highest round any file names.\n * 2. A new round starts ONLY when the previous round has a RED and rounds remain, and it re-briefs only\n * those reds. A green or yellow stands whatever changes afterwards — staleness never re-reviews.\n * 3. The final round has no red. Its blocking color is ORANGE: the author fixes it best effort, records the\n * fix, and ships with the finding and its claimed fix stamped on the dashboard.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewRoundStateService {\n constructor(\n private readonly reviewJson: ReviewJsonService,\n private readonly provenance: VerdictProvenanceService,\n private readonly atomicFile: AtomicFile,\n ) {}\n\n /** The author's recorded fixes for one round: `review-round<N>-fixes.json`, beside summary.json. */\n fixesPath(summaryPath: string, round: number): string {\n return path.join(path.dirname(summaryPath), `review-round${round}-${FIXES_ID}.json`);\n }\n\n /** The highest round any round-numbered file names, or 0. */\n highestRound(summaryPath: string): number {\n let highest = 0;\n for (const name of this.roundFiles(summaryPath)) {\n const match = ROUND_FILE.exec(name);\n if (match !== null) highest = Math.max(highest, Number(match[1]));\n }\n return highest;\n }\n\n /** Every checklist that has a verdict in ANY round on this branch. */\n verdictChecklistIds(summaryPath: string): string[] {\n const ids = new Set<string>();\n for (const name of this.roundFiles(summaryPath)) {\n const id = this.verdictIdOf(name);\n if (id !== '') ids.add(id);\n }\n return [...ids].sort();\n }\n\n /** Where the branch's review stands — see {@link RoundSnapshot}. */\n snapshot(summaryPath: string, receipt: ReviewStageReceipt | null): RoundSnapshot {\n const briefed = receipt !== null && receipt.reviewersBriefed.length > 0 ? receipt.round : 0;\n const round = Math.max(this.highestRound(summaryPath), briefed);\n if (round < 1) return new RoundSnapshot(0, [], '', false);\n if (receipt !== null && receipt.round === round) {\n return new RoundSnapshot(round, receipt.reviewersBriefed.slice(), receipt.headSha,\n this.everyVerdictIn(summaryPath, receipt.reviewersBriefed, round));\n }\n // The receipt names an older round (or is gone): the files are the record, so the roster is exactly\n // the checklists that have a verdict in this round, and the reviewed HEAD is what their provenance says.\n const roster = this.roundFiles(summaryPath)\n .filter((name: string): boolean => name.startsWith(`review-round${round}-`))\n .map((name: string): string => this.verdictIdOf(name))\n .filter((id: string): boolean => id !== '')\n .sort();\n const headSha = roster.length === 0 ? '' : this.provenance.read(summaryPath, roster[0], round)?.headSha ?? '';\n return new RoundSnapshot(round, roster, headSha, roster.length > 0);\n }\n\n /**\n * TRUE once a review round has started on this branch. From then on the checklist set is FROZEN (issue\n * #1053): finish judges only the checklists that were briefed, never ones a later commit newly triggers.\n */\n roundStarted(summaryPath: string, receipt: ReviewStageReceipt | null): boolean {\n return this.snapshot(summaryPath, receipt).round >= 1;\n }\n\n /** The frozen checklist set: every checklist briefed in any round — see {@link roundStarted}. */\n briefedChecklistIds(summaryPath: string, receipt: ReviewStageReceipt | null): string[] {\n const ids = new Set<string>(this.verdictChecklistIds(summaryPath));\n if (receipt !== null && receipt.round >= 1) for (const id of receipt.reviewersBriefed) ids.add(id);\n return [...ids].sort();\n }\n\n /** Does `checklistId` already have a verdict in `round`? A round's verdict is never overwritten. */\n hasVerdict(summaryPath: string, checklistId: string, round: number): boolean {\n return fs.existsSync(this.reviewJson.checklistResultPath(summaryPath, checklistId, round));\n }\n\n /** The roster checklists whose verdict in the snapshot's round is `status`. */\n checklistIdsWithStatus(summaryPath: string, snap: RoundSnapshot, status: string): string[] {\n if (!snap.complete) return [];\n return snap.roster.filter((id: string): boolean => {\n const raw = this.readObject(this.reviewJson.checklistResultPath(summaryPath, id, snap.round));\n return raw !== null && raw['status'] === status;\n });\n }\n\n /** What stage ② does next. See the class comment for the three rules it holds. */\n plan(repoRoot: string, summaryPath: string, receipt: ReviewStageReceipt | null, maxRounds: number, fullBasis: DiffBasis): ReviewRoundPlan {\n const snap = this.snapshot(summaryPath, receipt);\n if (snap.round < 1) return new ReviewRoundPlan(ROUND_ACTION_REVIEW, 1, maxRounds, fullBasis);\n if (!snap.complete) {\n if (snap.headSha !== fullBasis.headSha) {\n throw new InformAiError(`Reviewer round ${snap.round} of ${maxRounds} is still active at `\n + `${snap.headSha.slice(0, 8)}. Finish that fixed roster before changing the reviewed HEAD.`);\n }\n return new ReviewRoundPlan(ROUND_ACTION_RESUME, snap.round, maxRounds, fullBasis);\n }\n const reds = this.checklistIdsWithStatus(summaryPath, snap, VERDICT_RED);\n const oranges = this.checklistIdsWithStatus(summaryPath, snap, VERDICT_ORANGE);\n // No red, or no round left: nothing is ever re-reviewed. Oranges are the author's to fix and record.\n if (reds.length === 0 || snap.round >= maxRounds) {\n return new ReviewRoundPlan(ROUND_ACTION_FINISH, snap.round, maxRounds, fullBasis, [], reds, oranges);\n }\n if (snap.headSha === fullBasis.headSha) {\n return new ReviewRoundPlan(ROUND_ACTION_FIX, snap.round, maxRounds, fullBasis, [], reds, oranges);\n }\n if (this.validFixes(repoRoot, summaryPath, snap) === null) {\n return new ReviewRoundPlan(ROUND_ACTION_RECORD, snap.round, maxRounds, fullBasis, [], reds, oranges);\n }\n const basis = new DiffBasis(\n snap.headSha, fullBasis.headSha, false, [],\n `git diff ${snap.headSha} ${fullBasis.headSha}`,\n `git diff ${snap.headSha} ${fullBasis.headSha} -- <file>`, fullBasis.hashMainHead);\n const changed = this.git(repoRoot, ['diff', '--name-only', snap.headSha, fullBasis.headSha])\n .split('\\n').filter((f: string): boolean => f.trim() !== '');\n return new ReviewRoundPlan(ROUND_ACTION_REVIEW, snap.round + 1, maxRounds, basis, changed, reds, oranges);\n }\n\n /**\n * Record the author's fixes for the latest completed round — one response per RED (a round that is not\n * the last) or ORANGE (the final round) — as `review-round<N>-fixes.json`.\n *\n * A record that still HOLDS is never overwritten. One that no longer holds — its `toHead` left HEAD's\n * history, which every `wp-start-upsert-pr` squash-update does — is kept beside it as\n * `review-round<N>-fixes.json.superseded-<k>` and a fresh record is written, so re-recording is always\n * the way past a stale record and nothing is ever lost.\n */\n writeRemediation(repoRoot: string, summaryPath: string, receipt: ReviewStageReceipt, json: string): string {\n const snap = this.snapshot(summaryPath, receipt);\n if (!snap.complete) {\n throw new InformAiError('wp-write-review-fixes: the active reviewer round is not complete yet.');\n }\n const blocking = this.blockingIds(summaryPath, snap);\n if (blocking.length === 0) {\n throw new InformAiError(`wp-write-review-fixes: round ${snap.round} has no red or orange verdict to fix.`);\n }\n const out = this.fixesPath(summaryPath, snap.round);\n const holding = this.validFixes(repoRoot, summaryPath, snap);\n if (holding !== null) {\n throw new InformAiError(`wp-write-review-fixes: the fixes for round ${snap.round} are already recorded in ${out}, and `\n + `that record still holds (its fixed commit ${holding.toHead.slice(0, 8)} is in HEAD's history), so it is not `\n + 'overwritten. Nothing more to record: re-run pnpm wp-review-upsert-pr, or pnpm wp-finish-upsert-pr after the last round.');\n }\n this.assertClean(repoRoot);\n const currentHead = this.git(repoRoot, ['rev-parse', 'HEAD']);\n if (currentHead === snap.headSha || this.git(repoRoot, ['diff', '--name-only', snap.headSha, currentHead]) === '') {\n throw new InformAiError('wp-write-review-fixes: remediation must contain a committed, non-empty delta after the reviewed HEAD.');\n }\n const raw = this.parseObject(json, 'wp-write-review-fixes: input must be one JSON object.');\n const agent = this.requiredText(raw, 'agent');\n const model = this.requiredText(raw, 'model');\n const responses = this.responses(raw['responses']);\n const ids = responses.map((r: RemediationResponse): string => r.checklistId);\n const unknown = ids.filter((id: string): boolean => !blocking.includes(id));\n const missing = blocking.filter((id: string): boolean => !ids.includes(id));\n if (unknown.length > 0 || missing.length > 0) {\n throw new InformAiError(`wp-write-review-fixes: responses must cover exactly the red/orange checklist(s) of round ${snap.round}. `\n + `Unknown: ${unknown.join(', ') || '(none)'}. Missing: ${missing.join(', ') || '(none)'}.`);\n }\n this.supersede(out);\n this.atomicFile.writeJsonAtomic(out, new ReviewRemediation(agent, model, snap.headSha, currentHead, responses));\n return out;\n }\n\n /**\n * Keep a record that no longer holds beside the new one, as `<file>.superseded-<k>` — a name no round\n * scan reads, so it is history and never a live record.\n */\n private supersede(file: string): void {\n if (!fs.existsSync(file)) return;\n let k = 1;\n while (fs.existsSync(`${file}.superseded-${k}`)) k++;\n fs.renameSync(file, `${file}.superseded-${k}`);\n }\n\n /**\n * The round's recorded fixes, or null when there are none that still hold: written from the reviewed\n * HEAD, to a later commit that is still in HEAD's history, covering exactly the round's red/orange set.\n */\n validFixes(repoRoot: string, summaryPath: string, snap: RoundSnapshot): ReviewRemediation | null {\n const record = this.readFixes(repoRoot, summaryPath, snap.round);\n if (record === null || record.fromHead !== snap.headSha) return null;\n const blocking = this.blockingIds(summaryPath, snap);\n const ids = record.responses.map((r: RemediationResponse): string => r.checklistId);\n if (blocking.some((id: string): boolean => !ids.includes(id)) || ids.some((id: string): boolean => !blocking.includes(id))) return null;\n return record;\n }\n\n /**\n * checklist id → the dashboard stamp for every ORANGE whose fix the author recorded (issue #1053):\n * \"orange at <fromHead>, author-fixed in <toHead>, not re-reviewed: <resolution>\". An orange with no\n * valid record is absent, and so still blocks.\n */\n orangeFixes(repoRoot: string, summaryPath: string, results: readonly ChecklistResult[]): Record<string, string> {\n const out: Record<string, string> = {};\n for (const result of results) {\n if (result.status !== VERDICT_ORANGE || result.problem !== '') continue;\n const record = this.readFixes(repoRoot, summaryPath, result.round);\n const response = record?.responses.find((r: RemediationResponse): boolean => r.checklistId === result.id);\n if (record === null || response === undefined) continue;\n out[result.id] = `orange at ${record.fromHead.slice(0, 8)}, author-fixed in ${record.toHead.slice(0, 8)}, `\n + `not re-reviewed: ${response.resolution}`;\n }\n return out;\n }\n\n auditTrail(summaryPath: string, checklistId: string, maxRounds: number): string {\n const lines: string[] = [];\n const highest = this.highestRound(summaryPath);\n for (let round = 1; round <= highest; round++) {\n const verdict = this.readObject(this.reviewJson.checklistResultPath(summaryPath, checklistId, round));\n if (verdict !== null) {\n lines.push(`#### Reviewer round ${round} of ${maxRounds}`);\n lines.push(`Reviewed SHA: ${this.provenance.read(summaryPath, checklistId, round)?.headSha || '(unknown)'}`);\n lines.push(`Status: ${this.text(verdict['status']).toUpperCase()}`);\n lines.push('', this.text(verdict['output']), '');\n }\n const remediation = this.readObject(this.fixesPath(summaryPath, round));\n if (remediation !== null && Array.isArray(remediation['responses'])) {\n const response = (remediation['responses'] as JsonValue[]).find((entry: JsonValue): boolean =>\n typeof entry === 'object' && entry !== null && !Array.isArray(entry)\n && (entry as JsonObject)['checklistId'] === checklistId);\n if (typeof response === 'object' && response !== null && !Array.isArray(response)) {\n const raw = response as JsonObject;\n lines.push(`#### Author fix after round ${round}`);\n lines.push(`Range: ${this.text(remediation['fromHead'])}..${this.text(remediation['toHead'])}`);\n lines.push('', this.text(raw['resolution']), '');\n }\n }\n }\n return lines.join('\\n').trim();\n }\n\n private blockingIds(summaryPath: string, snap: RoundSnapshot): string[] {\n return [\n ...this.checklistIdsWithStatus(summaryPath, snap, VERDICT_RED),\n ...this.checklistIdsWithStatus(summaryPath, snap, VERDICT_ORANGE),\n ];\n }\n\n /** A round's fix record, provided its `toHead` is still in HEAD's history; else null. */\n private readFixes(repoRoot: string, summaryPath: string, round: number): ReviewRemediation | null {\n const raw = this.readObject(this.fixesPath(summaryPath, round));\n if (raw === null) return null;\n const responses = this.responsesOrEmpty(raw['responses']);\n const fromHead = this.text(raw['fromHead']);\n const toHead = this.text(raw['toHead']);\n if (this.text(raw['agent']) === '' || this.text(raw['model']) === '' || responses.length === 0\n || fromHead === '' || toHead === '' || fromHead === toHead || !this.isAncestorOfHead(repoRoot, toHead)) return null;\n return new ReviewRemediation(this.text(raw['agent']), this.text(raw['model']), fromHead, toHead, responses);\n }\n\n private everyVerdictIn(summaryPath: string, roster: readonly string[], round: number): boolean {\n return roster.length > 0 && roster.every((id: string): boolean => this.hasVerdict(summaryPath, id, round));\n }\n\n /** `review-round<N>-<id>.json` → `<id>`; '' for the fixes record, a provenance file, or anything else. */\n private verdictIdOf(name: string): string {\n const match = ROUND_FILE.exec(name);\n if (match === null) return '';\n const id = match[2];\n return id === FIXES_ID || id.endsWith(PROVENANCE_SUFFIX) ? '' : id;\n }\n\n private roundFiles(summaryPath: string): string[] {\n const dir = path.dirname(summaryPath);\n if (!fs.existsSync(dir)) return [];\n return fs.readdirSync(dir).filter((name: string): boolean => ROUND_FILE.test(name));\n }\n\n private responses(value: JsonValue | undefined): RemediationResponse[] {\n const responses = this.responsesOrEmpty(value);\n if (responses.length === 0) throw new InformAiError('wp-write-review-fixes: \"responses\" must be a non-empty array.');\n return responses;\n }\n\n private responsesOrEmpty(value: JsonValue | undefined): RemediationResponse[] {\n if (!Array.isArray(value)) return [];\n const out: RemediationResponse[] = [];\n for (const entry of value) {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) return [];\n const raw = entry as JsonObject;\n const id = this.text(raw['checklistId']);\n const resolution = this.text(raw['resolution']);\n const files = Array.isArray(raw['files']) ? raw['files'].filter((f: JsonValue): f is string => typeof f === 'string' && f.trim() !== '') : [];\n if (id === '' || resolution === '' || files.length === 0) return [];\n out.push(new RemediationResponse(id, resolution, files));\n }\n return out;\n }\n\n private requiredText(raw: JsonObject, key: string): string {\n const value = this.text(raw[key]);\n if (value === '') throw new InformAiError(`wp-write-review-fixes: \"${key}\" must be a non-empty string.`);\n return value;\n }\n\n private text(value: JsonValue | undefined): string {\n return typeof value === 'string' ? value.trim() : '';\n }\n\n private parseObject(json: string, message: string): JsonObject {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: malformed author JSON becomes an actionable refusal\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const value = JSON.parse(json) as JsonValue;\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) return value;\n // webpieces-disable no-any-unknown -- the language types caught JavaScript values as unknown\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n }\n throw new InformAiError(message);\n }\n\n private readObject(file: string): JsonObject | null {\n if (!fs.existsSync(file)) return null;\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: unreadable durable state becomes an actionable refusal\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const value = JSON.parse(fs.readFileSync(file, 'utf8')) as JsonValue;\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) return value;\n throw new InformAiError(`Review state file must contain one JSON object: ${file}`);\n // webpieces-disable no-any-unknown -- the language types caught JavaScript values as unknown\n } catch (err: unknown) {\n const error = toError(err);\n if (error instanceof InformAiError) throw error;\n throw new InformAiError(`Could not read review state file ${file}: ${error.message}`, { cause: error });\n }\n }\n\n private assertClean(repoRoot: string): void {\n const status = this.git(repoRoot, ['status', '--porcelain', '--untracked-files=all']);\n if (status !== '') throw new InformAiError('wp-write-review-fixes: commit every remediation and leave no staged, unstaged, or untracked files first.');\n }\n\n /**\n * `git merge-base --is-ancestor`: exit 0 = yes, 1 = no. A `sha` git does not know (exit 128 with\n * \"Not a valid commit name\") is also no — the commit is gone from this clone, so it is not in HEAD's\n * history. Anything else is a real failure and refuses.\n */\n private isAncestorOfHead(repoRoot: string, sha: string): boolean {\n const result = spawnSync('git', ['merge-base', '--is-ancestor', sha, 'HEAD'], { cwd: repoRoot, encoding: 'utf8' });\n if (result.status === 0) return true;\n if (result.status === 1 || /not a valid (commit|object) name/i.test(result.stderr ?? '')) return false;\n const detail = (result.stderr ?? '').trim() || result.error?.message || `exit ${result.status ?? 'unknown'}`;\n const message = `Review-round Git command failed: git merge-base --is-ancestor ${sha} HEAD\\n${detail}`;\n if (result.error !== undefined) throw new InformAiError(message, { cause: result.error });\n throw new InformAiError(message);\n }\n\n private git(repoRoot: string, args: string[]): string {\n const result = spawnSync('git', args, { cwd: repoRoot, encoding: 'utf8' });\n if (result.status === 0) return (result.stdout ?? '').trim();\n const command = `git ${args.join(' ')}`;\n const detail = (result.stderr ?? '').trim() || result.error?.message || `exit ${result.status ?? 'unknown'}`;\n const message = `Review-round Git command failed: ${command}\\n${detail}`;\n if (result.error !== undefined) throw new InformAiError(message, { cause: result.error });\n throw new InformAiError(message);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"review-round-state.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/review-round-state.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAC7B,iDAA0C;AAC1C,0DAEiC;AACjC,yCAA2D;AAE3D,6DAAgE;AAChE,6CAAyC;AAM5B,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAC/B,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAC/B,QAAA,gBAAgB,GAAG,KAAK,CAAC;AACzB,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAC/B,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAE5C,gHAAgH;AAChH,MAAM,UAAU,GAAG,gCAAgC,CAAC;AACpD,MAAM,QAAQ,GAAG,OAAO,CAAC;AACzB,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAExC,MAAa,eAAe;IACxB,MAAM,CAAS;IACf,KAAK,CAAS;IACd,SAAS,CAAS;IAClB,KAAK,CAAY;IACjB,YAAY,CAAW;IACvB,eAAe,CAAW;IAC1B,uFAAuF;IACvF,kBAAkB,CAAW;IAE7B,yDAAyD;IACzD,YACI,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Result, InformAiError, ReviewJsonService, VERDICT_ORANGE, VERDICT_RED, toError,\n} from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ReviewStageReceipt } from './review-stage-receipt';\nimport { VerdictProvenanceService } from './verdict-provenance';\nimport { DiffBasis } from './diff-basis';\n\ntype JsonPrimitive = string | number | boolean | null;\ntype JsonValue = JsonPrimitive | JsonValue[] | JsonObject;\ninterface JsonObject { [key: string]: JsonValue }\n\nexport const ROUND_ACTION_REVIEW = 'review';\nexport const ROUND_ACTION_RESUME = 'resume';\nexport const ROUND_ACTION_FIX = 'fix';\nexport const ROUND_ACTION_RECORD = 'record';\nexport const ROUND_ACTION_FINISH = 'finish';\n\n/** Every round-numbered file of a branch's review lives beside summary.json under this prefix (issue #1053). */\nconst ROUND_FILE = /^review-round(\\d+)-(.+)\\.json$/;\nconst FIXES_ID = 'fixes';\nconst PROVENANCE_SUFFIX = '.provenance';\n\nexport class ReviewRoundPlan {\n action: string;\n round: number;\n maxRounds: number;\n basis: DiffBasis;\n changedFiles: string[];\n redChecklistIds: string[];\n /** The final round's ORANGE checklists — must-fix, never re-reviewed (issue #1053). */\n orangeChecklistIds: string[];\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n action: string, round: number, maxRounds: number, basis: DiffBasis, changedFiles: string[] = [],\n redChecklistIds: string[] = [], orangeChecklistIds: string[] = [],\n ) {\n this.action = action;\n this.round = round;\n this.maxRounds = maxRounds;\n this.basis = basis;\n this.changedFiles = changedFiles;\n this.redChecklistIds = redChecklistIds;\n this.orangeChecklistIds = orangeChecklistIds;\n }\n}\n\n/**\n * Where a branch's review stands, DERIVED from the round-numbered files on disk plus the stage-② receipt\n * (issue #1053). There is no separate round counter: `round` is the highest round any file or briefing\n * names. Data-only.\n */\nexport class RoundSnapshot {\n round: number; // 0 = no round has started\n roster: string[]; // the REQUIRED checklists briefed in `round`, plus the optional ones that submitted in it\n headSha: string; // the commit `round` was briefed on\n complete: boolean; // every REQUIRED checklist briefed in `round` has a verdict in it (issue #1062)\n\n constructor(round: number, roster: string[], headSha: string, complete: boolean) {\n this.round = round;\n this.roster = roster;\n this.headSha = headSha;\n this.complete = complete;\n }\n}\n\nexport class RemediationResponse {\n checklistId: string;\n resolution: string;\n files: string[];\n\n constructor(checklistId: string, resolution: string, files: string[]) {\n this.checklistId = checklistId;\n this.resolution = resolution;\n this.files = files;\n }\n}\n\n/** The author's recorded fixes for one completed round: `review-round<N>-fixes.json`. Data-only. */\nexport class ReviewRemediation {\n agent: string;\n model: string;\n fromHead: string;\n toHead: string;\n responses: RemediationResponse[];\n writtenAt: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(agent: string, model: string, fromHead: string, toHead: string, responses: RemediationResponse[]) {\n this.agent = agent;\n this.model = model;\n this.fromHead = fromHead;\n this.toHead = toHead;\n this.responses = responses;\n this.writtenAt = new Date().toISOString();\n }\n}\n\n/**\n * The reviewer rounds of one branch, read from their round-numbered files (issue #1053).\n *\n * `commands.pr-gate.maxReviewerRounds` is a HARD CEILING, not a quota: 1 round means 1 round. Three rules\n * follow from it, and everything here exists to hold them:\n *\n * 1. Every verdict is `review-round<N>-<id>.json` (+ `.provenance.json`), every author fix record is\n * `review-round<N>-fixes.json`, and nothing is ever overwritten. The live verdict of a checklist is its\n * highest round; the round the branch is on is the highest round any file names.\n * 2. A new round starts ONLY when the previous round has a RED and rounds remain, and it re-briefs only\n * those reds. A green or yellow stands whatever changes afterwards — staleness never re-reviews.\n * 3. The final round has no red. Its blocking color is ORANGE: the author fixes it best effort, records the\n * fix, and ships with the finding and its claimed fix stamped on the dashboard.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewRoundStateService {\n constructor(\n private readonly reviewJson: ReviewJsonService,\n private readonly provenance: VerdictProvenanceService,\n private readonly atomicFile: AtomicFile,\n ) {}\n\n /** The author's recorded fixes for one round: `review-round<N>-fixes.json`, beside summary.json. */\n fixesPath(summaryPath: string, round: number): string {\n return path.join(path.dirname(summaryPath), `review-round${round}-${FIXES_ID}.json`);\n }\n\n /** The highest round any round-numbered file names, or 0. */\n highestRound(summaryPath: string): number {\n let highest = 0;\n for (const name of this.roundFiles(summaryPath)) {\n const match = ROUND_FILE.exec(name);\n if (match !== null) highest = Math.max(highest, Number(match[1]));\n }\n return highest;\n }\n\n /** Every checklist that has a verdict in ANY round on this branch. */\n verdictChecklistIds(summaryPath: string): string[] {\n const ids = new Set<string>();\n for (const name of this.roundFiles(summaryPath)) {\n const id = this.verdictIdOf(name);\n if (id !== '') ids.add(id);\n }\n return [...ids].sort();\n }\n\n /** Where the branch's review stands — see {@link RoundSnapshot}. */\n snapshot(summaryPath: string, receipt: ReviewStageReceipt | null): RoundSnapshot {\n const briefed = receipt !== null && receipt.reviewersBriefed.length > 0 ? receipt.round : 0;\n const round = Math.max(this.highestRound(summaryPath), briefed);\n if (round < 1) return new RoundSnapshot(0, [], '', false);\n if (receipt !== null && receipt.round === round) {\n // Only a REQUIRED checklist holds the round open (issue #1062). An optional one counts only if it\n // actually ran — a red from it still opens the next round — and one nobody chose to run is not\n // waited on, so an all-optional briefing nobody ran is complete with an empty roster.\n const optional = new Set<string>(receipt.optionalBriefed);\n const required = receipt.reviewersBriefed.filter((id: string): boolean => !optional.has(id));\n const roster = receipt.reviewersBriefed.filter((id: string): boolean =>\n !optional.has(id) || this.hasVerdict(summaryPath, id, round));\n return new RoundSnapshot(round, roster, receipt.headSha, this.everyVerdictIn(summaryPath, required, round));\n }\n // The receipt names an older round (or is gone): the files are the record, so the roster is exactly\n // the checklists that have a verdict in this round, and the reviewed HEAD is what their provenance says.\n const roster = this.roundFiles(summaryPath)\n .filter((name: string): boolean => name.startsWith(`review-round${round}-`))\n .map((name: string): string => this.verdictIdOf(name))\n .filter((id: string): boolean => id !== '')\n .sort();\n const headSha = roster.length === 0 ? '' : this.provenance.read(summaryPath, roster[0], round)?.headSha ?? '';\n return new RoundSnapshot(round, roster, headSha, roster.length > 0);\n }\n\n /**\n * TRUE once a review round has started on this branch. From then on the checklist set is FROZEN (issue\n * #1053): finish judges only the checklists that were briefed, never ones a later commit newly triggers.\n */\n roundStarted(summaryPath: string, receipt: ReviewStageReceipt | null): boolean {\n return this.snapshot(summaryPath, receipt).round >= 1;\n }\n\n /**\n * The frozen checklist set: every checklist briefed in any round — see {@link roundStarted}. It keeps an\n * optional checklist that was offered but never run, so its dashboard row reads \"optional, not run\"\n * rather than \"not briefed\"; it never holds a round open (see {@link snapshot}).\n */\n briefedChecklistIds(summaryPath: string, receipt: ReviewStageReceipt | null): string[] {\n const ids = new Set<string>(this.verdictChecklistIds(summaryPath));\n if (receipt !== null && receipt.round >= 1) for (const id of receipt.reviewersBriefed) ids.add(id);\n return [...ids].sort();\n }\n\n /** Does `checklistId` already have a verdict in `round`? A round's verdict is never overwritten. */\n hasVerdict(summaryPath: string, checklistId: string, round: number): boolean {\n return fs.existsSync(this.reviewJson.checklistResultPath(summaryPath, checklistId, round));\n }\n\n /** The roster checklists whose verdict in the snapshot's round is `status`. */\n checklistIdsWithStatus(summaryPath: string, snap: RoundSnapshot, status: string): string[] {\n if (!snap.complete) return [];\n return snap.roster.filter((id: string): boolean => {\n const raw = this.readObject(this.reviewJson.checklistResultPath(summaryPath, id, snap.round));\n return raw !== null && raw['status'] === status;\n });\n }\n\n /** What stage ② does next. See the class comment for the three rules it holds. */\n plan(repoRoot: string, summaryPath: string, receipt: ReviewStageReceipt | null, maxRounds: number, fullBasis: DiffBasis): ReviewRoundPlan {\n const snap = this.snapshot(summaryPath, receipt);\n if (snap.round < 1) return new ReviewRoundPlan(ROUND_ACTION_REVIEW, 1, maxRounds, fullBasis);\n if (!snap.complete) {\n if (snap.headSha !== fullBasis.headSha) {\n throw new InformAiError(`Reviewer round ${snap.round} of ${maxRounds} is still active at `\n + `${snap.headSha.slice(0, 8)}. Finish that fixed roster before changing the reviewed HEAD.`);\n }\n return new ReviewRoundPlan(ROUND_ACTION_RESUME, snap.round, maxRounds, fullBasis);\n }\n const reds = this.checklistIdsWithStatus(summaryPath, snap, VERDICT_RED);\n const oranges = this.checklistIdsWithStatus(summaryPath, snap, VERDICT_ORANGE);\n // No red, or no round left: nothing is ever re-reviewed. Oranges are the author's to fix and record.\n if (reds.length === 0 || snap.round >= maxRounds) {\n return new ReviewRoundPlan(ROUND_ACTION_FINISH, snap.round, maxRounds, fullBasis, [], reds, oranges);\n }\n if (snap.headSha === fullBasis.headSha) {\n return new ReviewRoundPlan(ROUND_ACTION_FIX, snap.round, maxRounds, fullBasis, [], reds, oranges);\n }\n if (this.validFixes(repoRoot, summaryPath, snap) === null) {\n return new ReviewRoundPlan(ROUND_ACTION_RECORD, snap.round, maxRounds, fullBasis, [], reds, oranges);\n }\n const basis = new DiffBasis(\n snap.headSha, fullBasis.headSha, false, [],\n `git diff ${snap.headSha} ${fullBasis.headSha}`,\n `git diff ${snap.headSha} ${fullBasis.headSha} -- <file>`, fullBasis.hashMainHead);\n const changed = this.git(repoRoot, ['diff', '--name-only', snap.headSha, fullBasis.headSha])\n .split('\\n').filter((f: string): boolean => f.trim() !== '');\n return new ReviewRoundPlan(ROUND_ACTION_REVIEW, snap.round + 1, maxRounds, basis, changed, reds, oranges);\n }\n\n /**\n * Record the author's fixes for the latest completed round — one response per RED (a round that is not\n * the last) or ORANGE (the final round) — as `review-round<N>-fixes.json`.\n *\n * A record that still HOLDS is never overwritten. One that no longer holds — its `toHead` left HEAD's\n * history, which every `wp-start-upsert-pr` squash-update does — is kept beside it as\n * `review-round<N>-fixes.json.superseded-<k>` and a fresh record is written, so re-recording is always\n * the way past a stale record and nothing is ever lost.\n */\n writeRemediation(repoRoot: string, summaryPath: string, receipt: ReviewStageReceipt, json: string): string {\n const snap = this.snapshot(summaryPath, receipt);\n if (!snap.complete) {\n throw new InformAiError('wp-write-review-fixes: the active reviewer round is not complete yet.');\n }\n const blocking = this.blockingIds(summaryPath, snap);\n if (blocking.length === 0) {\n throw new InformAiError(`wp-write-review-fixes: round ${snap.round} has no red or orange verdict to fix.`);\n }\n const out = this.fixesPath(summaryPath, snap.round);\n const holding = this.validFixes(repoRoot, summaryPath, snap);\n if (holding !== null) {\n throw new InformAiError(`wp-write-review-fixes: the fixes for round ${snap.round} are already recorded in ${out}, and `\n + `that record still holds (its fixed commit ${holding.toHead.slice(0, 8)} is in HEAD's history), so it is not `\n + 'overwritten. Nothing more to record: re-run pnpm wp-review-upsert-pr, or pnpm wp-finish-upsert-pr after the last round.');\n }\n this.assertClean(repoRoot);\n const currentHead = this.git(repoRoot, ['rev-parse', 'HEAD']);\n if (currentHead === snap.headSha || this.git(repoRoot, ['diff', '--name-only', snap.headSha, currentHead]) === '') {\n throw new InformAiError('wp-write-review-fixes: remediation must contain a committed, non-empty delta after the reviewed HEAD.');\n }\n const raw = this.parseObject(json, 'wp-write-review-fixes: input must be one JSON object.');\n const agent = this.requiredText(raw, 'agent');\n const model = this.requiredText(raw, 'model');\n const responses = this.responses(raw['responses']);\n const ids = responses.map((r: RemediationResponse): string => r.checklistId);\n const unknown = ids.filter((id: string): boolean => !blocking.includes(id));\n const missing = blocking.filter((id: string): boolean => !ids.includes(id));\n if (unknown.length > 0 || missing.length > 0) {\n throw new InformAiError(`wp-write-review-fixes: responses must cover exactly the red/orange checklist(s) of round ${snap.round}. `\n + `Unknown: ${unknown.join(', ') || '(none)'}. Missing: ${missing.join(', ') || '(none)'}.`);\n }\n this.supersede(out);\n this.atomicFile.writeJsonAtomic(out, new ReviewRemediation(agent, model, snap.headSha, currentHead, responses));\n return out;\n }\n\n /**\n * Keep a record that no longer holds beside the new one, as `<file>.superseded-<k>` — a name no round\n * scan reads, so it is history and never a live record.\n */\n private supersede(file: string): void {\n if (!fs.existsSync(file)) return;\n let k = 1;\n while (fs.existsSync(`${file}.superseded-${k}`)) k++;\n fs.renameSync(file, `${file}.superseded-${k}`);\n }\n\n /**\n * The round's recorded fixes, or null when there are none that still hold: written from the reviewed\n * HEAD, to a later commit that is still in HEAD's history, covering exactly the round's red/orange set.\n */\n validFixes(repoRoot: string, summaryPath: string, snap: RoundSnapshot): ReviewRemediation | null {\n const record = this.readFixes(repoRoot, summaryPath, snap.round);\n if (record === null || record.fromHead !== snap.headSha) return null;\n const blocking = this.blockingIds(summaryPath, snap);\n const ids = record.responses.map((r: RemediationResponse): string => r.checklistId);\n if (blocking.some((id: string): boolean => !ids.includes(id)) || ids.some((id: string): boolean => !blocking.includes(id))) return null;\n return record;\n }\n\n /**\n * checklist id → the dashboard stamp for every ORANGE whose fix the author recorded (issue #1053):\n * \"orange at <fromHead>, author-fixed in <toHead>, not re-reviewed: <resolution>\". An orange with no\n * valid record is absent, and so still blocks.\n */\n orangeFixes(repoRoot: string, summaryPath: string, results: readonly ChecklistResult[]): Record<string, string> {\n const out: Record<string, string> = {};\n for (const result of results) {\n if (result.status !== VERDICT_ORANGE || result.problem !== '') continue;\n const record = this.readFixes(repoRoot, summaryPath, result.round);\n const response = record?.responses.find((r: RemediationResponse): boolean => r.checklistId === result.id);\n if (record === null || response === undefined) continue;\n out[result.id] = `orange at ${record.fromHead.slice(0, 8)}, author-fixed in ${record.toHead.slice(0, 8)}, `\n + `not re-reviewed: ${response.resolution}`;\n }\n return out;\n }\n\n auditTrail(summaryPath: string, checklistId: string, maxRounds: number): string {\n const lines: string[] = [];\n const highest = this.highestRound(summaryPath);\n for (let round = 1; round <= highest; round++) {\n const verdict = this.readObject(this.reviewJson.checklistResultPath(summaryPath, checklistId, round));\n if (verdict !== null) {\n lines.push(`#### Reviewer round ${round} of ${maxRounds}`);\n lines.push(`Reviewed SHA: ${this.provenance.read(summaryPath, checklistId, round)?.headSha || '(unknown)'}`);\n lines.push(`Status: ${this.text(verdict['status']).toUpperCase()}`);\n lines.push('', this.text(verdict['output']), '');\n }\n const remediation = this.readObject(this.fixesPath(summaryPath, round));\n if (remediation !== null && Array.isArray(remediation['responses'])) {\n const response = (remediation['responses'] as JsonValue[]).find((entry: JsonValue): boolean =>\n typeof entry === 'object' && entry !== null && !Array.isArray(entry)\n && (entry as JsonObject)['checklistId'] === checklistId);\n if (typeof response === 'object' && response !== null && !Array.isArray(response)) {\n const raw = response as JsonObject;\n lines.push(`#### Author fix after round ${round}`);\n lines.push(`Range: ${this.text(remediation['fromHead'])}..${this.text(remediation['toHead'])}`);\n lines.push('', this.text(raw['resolution']), '');\n }\n }\n }\n return lines.join('\\n').trim();\n }\n\n private blockingIds(summaryPath: string, snap: RoundSnapshot): string[] {\n return [\n ...this.checklistIdsWithStatus(summaryPath, snap, VERDICT_RED),\n ...this.checklistIdsWithStatus(summaryPath, snap, VERDICT_ORANGE),\n ];\n }\n\n /** A round's fix record, provided its `toHead` is still in HEAD's history; else null. */\n private readFixes(repoRoot: string, summaryPath: string, round: number): ReviewRemediation | null {\n const raw = this.readObject(this.fixesPath(summaryPath, round));\n if (raw === null) return null;\n const responses = this.responsesOrEmpty(raw['responses']);\n const fromHead = this.text(raw['fromHead']);\n const toHead = this.text(raw['toHead']);\n if (this.text(raw['agent']) === '' || this.text(raw['model']) === '' || responses.length === 0\n || fromHead === '' || toHead === '' || fromHead === toHead || !this.isAncestorOfHead(repoRoot, toHead)) return null;\n return new ReviewRemediation(this.text(raw['agent']), this.text(raw['model']), fromHead, toHead, responses);\n }\n\n private everyVerdictIn(summaryPath: string, roster: readonly string[], round: number): boolean {\n return roster.every((id: string): boolean => this.hasVerdict(summaryPath, id, round));\n }\n\n /** `review-round<N>-<id>.json` → `<id>`; '' for the fixes record, a provenance file, or anything else. */\n private verdictIdOf(name: string): string {\n const match = ROUND_FILE.exec(name);\n if (match === null) return '';\n const id = match[2];\n return id === FIXES_ID || id.endsWith(PROVENANCE_SUFFIX) ? '' : id;\n }\n\n private roundFiles(summaryPath: string): string[] {\n const dir = path.dirname(summaryPath);\n if (!fs.existsSync(dir)) return [];\n return fs.readdirSync(dir).filter((name: string): boolean => ROUND_FILE.test(name));\n }\n\n private responses(value: JsonValue | undefined): RemediationResponse[] {\n const responses = this.responsesOrEmpty(value);\n if (responses.length === 0) throw new InformAiError('wp-write-review-fixes: \"responses\" must be a non-empty array.');\n return responses;\n }\n\n private responsesOrEmpty(value: JsonValue | undefined): RemediationResponse[] {\n if (!Array.isArray(value)) return [];\n const out: RemediationResponse[] = [];\n for (const entry of value) {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) return [];\n const raw = entry as JsonObject;\n const id = this.text(raw['checklistId']);\n const resolution = this.text(raw['resolution']);\n const files = Array.isArray(raw['files']) ? raw['files'].filter((f: JsonValue): f is string => typeof f === 'string' && f.trim() !== '') : [];\n if (id === '' || resolution === '' || files.length === 0) return [];\n out.push(new RemediationResponse(id, resolution, files));\n }\n return out;\n }\n\n private requiredText(raw: JsonObject, key: string): string {\n const value = this.text(raw[key]);\n if (value === '') throw new InformAiError(`wp-write-review-fixes: \"${key}\" must be a non-empty string.`);\n return value;\n }\n\n private text(value: JsonValue | undefined): string {\n return typeof value === 'string' ? value.trim() : '';\n }\n\n private parseObject(json: string, message: string): JsonObject {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: malformed author JSON becomes an actionable refusal\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const value = JSON.parse(json) as JsonValue;\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) return value;\n // webpieces-disable no-any-unknown -- the language types caught JavaScript values as unknown\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n }\n throw new InformAiError(message);\n }\n\n private readObject(file: string): JsonObject | null {\n if (!fs.existsSync(file)) return null;\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: unreadable durable state becomes an actionable refusal\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const value = JSON.parse(fs.readFileSync(file, 'utf8')) as JsonValue;\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) return value;\n throw new InformAiError(`Review state file must contain one JSON object: ${file}`);\n // webpieces-disable no-any-unknown -- the language types caught JavaScript values as unknown\n } catch (err: unknown) {\n const error = toError(err);\n if (error instanceof InformAiError) throw error;\n throw new InformAiError(`Could not read review state file ${file}: ${error.message}`, { cause: error });\n }\n }\n\n private assertClean(repoRoot: string): void {\n const status = this.git(repoRoot, ['status', '--porcelain', '--untracked-files=all']);\n if (status !== '') throw new InformAiError('wp-write-review-fixes: commit every remediation and leave no staged, unstaged, or untracked files first.');\n }\n\n /**\n * `git merge-base --is-ancestor`: exit 0 = yes, 1 = no. A `sha` git does not know (exit 128 with\n * \"Not a valid commit name\") is also no — the commit is gone from this clone, so it is not in HEAD's\n * history. Anything else is a real failure and refuses.\n */\n private isAncestorOfHead(repoRoot: string, sha: string): boolean {\n const result = spawnSync('git', ['merge-base', '--is-ancestor', sha, 'HEAD'], { cwd: repoRoot, encoding: 'utf8' });\n if (result.status === 0) return true;\n if (result.status === 1 || /not a valid (commit|object) name/i.test(result.stderr ?? '')) return false;\n const detail = (result.stderr ?? '').trim() || result.error?.message || `exit ${result.status ?? 'unknown'}`;\n const message = `Review-round Git command failed: git merge-base --is-ancestor ${sha} HEAD\\n${detail}`;\n if (result.error !== undefined) throw new InformAiError(message, { cause: result.error });\n throw new InformAiError(message);\n }\n\n private git(repoRoot: string, args: string[]): string {\n const result = spawnSync('git', args, { cwd: repoRoot, encoding: 'utf8' });\n if (result.status === 0) return (result.stdout ?? '').trim();\n const command = `git ${args.join(' ')}`;\n const detail = (result.stderr ?? '').trim() || result.error?.message || `exit ${result.status ?? 'unknown'}`;\n const message = `Review-round Git command failed: ${command}\\n${detail}`;\n if (result.error !== undefined) throw new InformAiError(message, { cause: result.error });\n throw new InformAiError(message);\n }\n}\n"]}
|
|
@@ -9,6 +9,13 @@ export declare class ReviewStageReceipt {
|
|
|
9
9
|
buildCommand: string;
|
|
10
10
|
buildPassedAt: string;
|
|
11
11
|
reviewersBriefed: string[];
|
|
12
|
+
/**
|
|
13
|
+
* The OPTIONAL subset of `reviewersBriefed` (issue #1062). Every briefed checklist may submit a verdict,
|
|
14
|
+
* but only the REQUIRED ones hold a round open: an optional checklist joins the round's roster only when
|
|
15
|
+
* it actually submitted in that round, so one the human chose not to run never deadlocks the round.
|
|
16
|
+
* Assigned after construction; a receipt written without the field reads as [].
|
|
17
|
+
*/
|
|
18
|
+
optionalBriefed: string[];
|
|
12
19
|
/**
|
|
13
20
|
* checklist id → the hash of its in-scope diff at `headSha` (ChecklistScopeHasher). `wp-write-review`
|
|
14
21
|
* stamps a verdict's provenance with the hash its reviewer was BRIEFED on, and the next stage ② carries
|
|
@@ -16,6 +16,13 @@ class ReviewStageReceipt {
|
|
|
16
16
|
buildCommand;
|
|
17
17
|
buildPassedAt; // ISO; '' when the gate was skipped (mode OFF / no command)
|
|
18
18
|
reviewersBriefed;
|
|
19
|
+
/**
|
|
20
|
+
* The OPTIONAL subset of `reviewersBriefed` (issue #1062). Every briefed checklist may submit a verdict,
|
|
21
|
+
* but only the REQUIRED ones hold a round open: an optional checklist joins the round's roster only when
|
|
22
|
+
* it actually submitted in that round, so one the human chose not to run never deadlocks the round.
|
|
23
|
+
* Assigned after construction; a receipt written without the field reads as [].
|
|
24
|
+
*/
|
|
25
|
+
optionalBriefed;
|
|
19
26
|
/**
|
|
20
27
|
* checklist id → the hash of its in-scope diff at `headSha` (ChecklistScopeHasher). `wp-write-review`
|
|
21
28
|
* stamps a verdict's provenance with the hash its reviewer was BRIEFED on, and the next stage ② carries
|
|
@@ -38,6 +45,7 @@ class ReviewStageReceipt {
|
|
|
38
45
|
this.buildCommand = buildCommand;
|
|
39
46
|
this.buildPassedAt = buildPassedAt;
|
|
40
47
|
this.reviewersBriefed = reviewersBriefed;
|
|
48
|
+
this.optionalBriefed = [];
|
|
41
49
|
this.scopeHashes = {};
|
|
42
50
|
this.round = 0;
|
|
43
51
|
this.maxReviewerRounds = 0;
|
|
@@ -84,6 +92,8 @@ let ReviewStageReceiptService = class ReviewStageReceiptService {
|
|
|
84
92
|
// webpieces-disable no-any-unknown -- opaque parsed JSON, narrowed field-by-field below
|
|
85
93
|
const raw = JSON.parse(fs.readFileSync(p, 'utf8'));
|
|
86
94
|
const receipt = new ReviewStageReceipt(typeof raw['headSha'] === 'string' ? raw['headSha'] : '', raw['mergeValidated'] === true, typeof raw['buildCommand'] === 'string' ? raw['buildCommand'] : '', typeof raw['buildPassedAt'] === 'string' ? raw['buildPassedAt'] : '', Array.isArray(raw['reviewersBriefed']) ? raw['reviewersBriefed'] : []);
|
|
95
|
+
receipt.optionalBriefed = Array.isArray(raw['optionalBriefed'])
|
|
96
|
+
? raw['optionalBriefed'].filter((id) => typeof id === 'string') : [];
|
|
87
97
|
receipt.scopeHashes = this.stringMap(raw['scopeHashes']);
|
|
88
98
|
receipt.round = typeof raw['round'] === 'number' && Number.isInteger(raw['round']) ? raw['round'] : 0;
|
|
89
99
|
receipt.maxReviewerRounds = typeof raw['maxReviewerRounds'] === 'number' && Number.isInteger(raw['maxReviewerRounds'])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-stage-receipt.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/review-stage-receipt.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAC7B,0DAAqE;AACrE,yCAA2D;AAE9C,QAAA,YAAY,GAAG,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAa,kBAAkB;IAC3B,OAAO,CAAS,CAAU,gEAAgE;IAC1F,cAAc,CAAU,CAAE,oEAAoE;IAC9F,YAAY,CAAS;IACrB,aAAa,CAAS,CAAI,4DAA4D;IACtF,gBAAgB,CAAW;IAC3B;;;;OAIG;IACH,WAAW,CAAyB;IACpC;;;;;OAKG;IACH,KAAK,CAAS;IACd,8FAA8F;IAC9F,iBAAiB,CAAS;IAE1B,yDAAyD;IACzD,YAAY,OAAO,GAAG,EAAE,EAAE,cAAc,GAAG,KAAK,EAAE,YAAY,GAAG,EAAE,EAAE,aAAa,GAAG,EAAE,EAAE,mBAA6B,EAAE;QACpH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;Q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AAC,CAAC,CAAC,CAAC,CAAC;YAC7C,OAAO,OAAO,CAAC;QACnB,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,sBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,KAAK,KAAK,CAAC,CAAC,6EAA6E;YACzF,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IAED,uFAAuF;IAC/E,SAAS,CAAC,KAAc;QAC5B,MAAM,GAAG,GAA2B,EAAE,CAAC;QACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,GAAG,CAAC;QACpF,4FAA4F;QAC5F,MAAM,GAAG,GAAG,KAAgC,CAAC;QAC7C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACnB,IAAI,OAAO,CAAC,KAAK,QAAQ;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ,CAAA;AAtDY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEW,gCAAiB;GADxD,yBAAyB,CAsDrC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { ReviewJsonService, toError } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nexport const RECEIPT_FILE = 'review-stage.json';\n\n/**\n * Proof that stage ② (`wp-review-upsert-pr`) actually ran, and on WHICH commit. Data-only (per CLAUDE.md).\n */\nexport class ReviewStageReceipt {\n headSha: string; // the sha the merge was validated and the build was run against\n mergeValidated: boolean; // a 3-point merge was finalized here, or there was none to finalize\n buildCommand: string;\n buildPassedAt: string; // ISO; '' when the gate was skipped (mode OFF / no command)\n reviewersBriefed: string[];\n /**\n * checklist id → the hash of its in-scope diff at `headSha` (ChecklistScopeHasher). `wp-write-review`\n * stamps a verdict's provenance with the hash its reviewer was BRIEFED on, and the next stage ② carries\n * a green/yellow forward only while that hash is unchanged (issue #863). Assigned after construction.\n */\n scopeHashes: Record<string, string>;\n /**\n * The round stage ② BRIEFED `reviewersBriefed` for, and so the N every verdict submitted against this\n * receipt is written as (`review-round<N>-<id>.json`). Zero means no reviewer round has started. The\n * round the branch is on is DERIVED from the round-numbered files (issue #1053); this only says which\n * round the latest briefing opened.\n */\n round: number;\n /** Repository-owned cap copied from config, so `wp-write-review` refuses a round above it. */\n maxReviewerRounds: number;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(headSha = '', mergeValidated = false, buildCommand = '', buildPassedAt = '', reviewersBriefed: string[] = []) {\n this.headSha = headSha;\n this.mergeValidated = mergeValidated;\n this.buildCommand = buildCommand;\n this.buildPassedAt = buildPassedAt;\n this.reviewersBriefed = reviewersBriefed;\n this.scopeHashes = {};\n this.round = 0;\n this.maxReviewerRounds = 0;\n }\n}\n\n/**\n * Reads/writes the stage-② receipt.\n *\n * WHY a receipt rather than relying on the artifacts that already exist: `wp-finish-upsert-pr` already\n * refuses when a reviewer has no verdict and when summary.json is absent, so a repo WITH checklists is\n * mostly interlocked already. A repo with NO checklists is not — summary.json is the only thing standing\n * between it and a PR, and the AI writes summary.json itself. Nothing stopped it from writing that file and\n * going straight to finish, skipping the merge validation and the build entirely.\n *\n * The receipt also pays for itself in the other direction: because it records the sha the build passed on,\n * finish can SKIP its own build when HEAD has not moved, so adding a gate in the middle did not cost a\n * second full `nx affected` run.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewStageReceiptService {\n constructor(private readonly reviewJsonService: ReviewJsonService) {}\n\n receiptPath(repoRoot: string, featureName: string): string {\n return path.join(this.reviewJsonService.prDirFor(repoRoot, featureName), RECEIPT_FILE);\n }\n\n write(repoRoot: string, featureName: string, receipt: ReviewStageReceipt): string {\n const p = this.receiptPath(repoRoot, featureName);\n fs.mkdirSync(path.dirname(p), { recursive: true });\n fs.writeFileSync(p, JSON.stringify(receipt, null, 2) + '\\n');\n return p;\n }\n\n /** The receipt, or null when stage ② never ran (or left something unreadable behind). */\n read(repoRoot: string, featureName: string): ReviewStageReceipt | null {\n const p = this.receiptPath(repoRoot, featureName);\n if (!fs.existsSync(p)) return null;\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: an unreadable receipt is treated as absent, which re-runs stage ②\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- opaque parsed JSON, narrowed field-by-field below\n const raw = JSON.parse(fs.readFileSync(p, 'utf8')) as Record<string, unknown>;\n const receipt = new ReviewStageReceipt(\n typeof raw['headSha'] === 'string' ? (raw['headSha'] as string) : '',\n raw['mergeValidated'] === true,\n typeof raw['buildCommand'] === 'string' ? (raw['buildCommand'] as string) : '',\n typeof raw['buildPassedAt'] === 'string' ? (raw['buildPassedAt'] as string) : '',\n Array.isArray(raw['reviewersBriefed']) ? (raw['reviewersBriefed'] as string[]) : [],\n );\n receipt.scopeHashes = this.stringMap(raw['scopeHashes']);\n receipt.round = typeof raw['round'] === 'number' && Number.isInteger(raw['round']) ? raw['round'] as number : 0;\n receipt.maxReviewerRounds = typeof raw['maxReviewerRounds'] === 'number' && Number.isInteger(raw['maxReviewerRounds'])\n ? raw['maxReviewerRounds'] as number : 0;\n return receipt;\n } catch (err: unknown) {\n const error = toError(err);\n void error; // unreadable ⇒ treated as absent, which re-runs stage ② (the safe direction)\n return null;\n }\n }\n\n // webpieces-disable no-any-unknown -- one opaque JSON value, narrowed to string→string\n private stringMap(value: unknown): Record<string, string> {\n const out: Record<string, string> = {};\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return out;\n // webpieces-disable no-any-unknown -- entries of an opaque JSON object, each narrowed below\n const obj = value as Record<string, unknown>;\n for (const key of Object.keys(obj)) {\n const v = obj[key];\n if (typeof v === 'string') out[key] = v;\n }\n return out;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"review-stage-receipt.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/review-stage-receipt.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAC7B,0DAAqE;AACrE,yCAA2D;AAE9C,QAAA,YAAY,GAAG,mBAAmB,CAAC;AAEhD;;GAEG;AACH,MAAa,kBAAkB;IAC3B,OAAO,CAAS,CAAU,gEAAgE;IAC1F,cAAc,CAAU,CAAE,oEAAoE;IAC9F,YAAY,CAAS;IACrB,aAAa,CAAS,CAAI,4DAA4D;IACtF,gBAAgB,CAAW;IAC3B;;;;;OAKG;IACH,eAAe,CAAW;IAC1B;;;;OAIG;IACH,WAAW,CAAyB;IACpC;;;;;OAKG;IACH,KAAK,CAAS;IACd,8FAA8F;IAC9F,iBAAiB,CAAS;IAE1B,yDAAyD;IACzD,YAAY,OAAO,GAAG,EAAE,EAAE,cAAc,GAAG,KAAK,EAAE,YAAY,GAAG,EAAE,EAAE,aAAa,GAAG,EAAE,EAAE,mBAA6B,EAAE;QACpH,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;IAC/B,CAAC;CACJ;AAzCD,gDAyCC;AAED;;;;;;;;;;;;;;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C,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,sBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,KAAK,KAAK,CAAC,CAAC,6EAA6E;YACzF,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IAED,uFAAuF;IAC/E,SAAS,CAAC,KAAc;QAC5B,MAAM,GAAG,GAA2B,EAAE,CAAC;QACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,GAAG,CAAC;QACpF,4FAA4F;QAC5F,MAAM,GAAG,GAAG,KAAgC,CAAC;QAC7C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACjC,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACnB,IAAI,OAAO,CAAC,KAAK,QAAQ;gBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;CACJ,CAAA;AAxDY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEW,gCAAiB;GADxD,yBAAyB,CAwDrC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { ReviewJsonService, toError } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nexport const RECEIPT_FILE = 'review-stage.json';\n\n/**\n * Proof that stage ② (`wp-review-upsert-pr`) actually ran, and on WHICH commit. Data-only (per CLAUDE.md).\n */\nexport class ReviewStageReceipt {\n headSha: string; // the sha the merge was validated and the build was run against\n mergeValidated: boolean; // a 3-point merge was finalized here, or there was none to finalize\n buildCommand: string;\n buildPassedAt: string; // ISO; '' when the gate was skipped (mode OFF / no command)\n reviewersBriefed: string[];\n /**\n * The OPTIONAL subset of `reviewersBriefed` (issue #1062). Every briefed checklist may submit a verdict,\n * but only the REQUIRED ones hold a round open: an optional checklist joins the round's roster only when\n * it actually submitted in that round, so one the human chose not to run never deadlocks the round.\n * Assigned after construction; a receipt written without the field reads as [].\n */\n optionalBriefed: string[];\n /**\n * checklist id → the hash of its in-scope diff at `headSha` (ChecklistScopeHasher). `wp-write-review`\n * stamps a verdict's provenance with the hash its reviewer was BRIEFED on, and the next stage ② carries\n * a green/yellow forward only while that hash is unchanged (issue #863). Assigned after construction.\n */\n scopeHashes: Record<string, string>;\n /**\n * The round stage ② BRIEFED `reviewersBriefed` for, and so the N every verdict submitted against this\n * receipt is written as (`review-round<N>-<id>.json`). Zero means no reviewer round has started. The\n * round the branch is on is DERIVED from the round-numbered files (issue #1053); this only says which\n * round the latest briefing opened.\n */\n round: number;\n /** Repository-owned cap copied from config, so `wp-write-review` refuses a round above it. */\n maxReviewerRounds: number;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(headSha = '', mergeValidated = false, buildCommand = '', buildPassedAt = '', reviewersBriefed: string[] = []) {\n this.headSha = headSha;\n this.mergeValidated = mergeValidated;\n this.buildCommand = buildCommand;\n this.buildPassedAt = buildPassedAt;\n this.reviewersBriefed = reviewersBriefed;\n this.optionalBriefed = [];\n this.scopeHashes = {};\n this.round = 0;\n this.maxReviewerRounds = 0;\n }\n}\n\n/**\n * Reads/writes the stage-② receipt.\n *\n * WHY a receipt rather than relying on the artifacts that already exist: `wp-finish-upsert-pr` already\n * refuses when a reviewer has no verdict and when summary.json is absent, so a repo WITH checklists is\n * mostly interlocked already. A repo with NO checklists is not — summary.json is the only thing standing\n * between it and a PR, and the AI writes summary.json itself. Nothing stopped it from writing that file and\n * going straight to finish, skipping the merge validation and the build entirely.\n *\n * The receipt also pays for itself in the other direction: because it records the sha the build passed on,\n * finish can SKIP its own build when HEAD has not moved, so adding a gate in the middle did not cost a\n * second full `nx affected` run.\n *\n * `@injectable(bindingScopeValues.Singleton)` so it is injected by type and drawn in the DI design.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewStageReceiptService {\n constructor(private readonly reviewJsonService: ReviewJsonService) {}\n\n receiptPath(repoRoot: string, featureName: string): string {\n return path.join(this.reviewJsonService.prDirFor(repoRoot, featureName), RECEIPT_FILE);\n }\n\n write(repoRoot: string, featureName: string, receipt: ReviewStageReceipt): string {\n const p = this.receiptPath(repoRoot, featureName);\n fs.mkdirSync(path.dirname(p), { recursive: true });\n fs.writeFileSync(p, JSON.stringify(receipt, null, 2) + '\\n');\n return p;\n }\n\n /** The receipt, or null when stage ② never ran (or left something unreadable behind). */\n read(repoRoot: string, featureName: string): ReviewStageReceipt | null {\n const p = this.receiptPath(repoRoot, featureName);\n if (!fs.existsSync(p)) return null;\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: an unreadable receipt is treated as absent, which re-runs stage ②\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- opaque parsed JSON, narrowed field-by-field below\n const raw = JSON.parse(fs.readFileSync(p, 'utf8')) as Record<string, unknown>;\n const receipt = new ReviewStageReceipt(\n typeof raw['headSha'] === 'string' ? (raw['headSha'] as string) : '',\n raw['mergeValidated'] === true,\n typeof raw['buildCommand'] === 'string' ? (raw['buildCommand'] as string) : '',\n typeof raw['buildPassedAt'] === 'string' ? (raw['buildPassedAt'] as string) : '',\n Array.isArray(raw['reviewersBriefed']) ? (raw['reviewersBriefed'] as string[]) : [],\n );\n receipt.optionalBriefed = Array.isArray(raw['optionalBriefed'])\n ? (raw['optionalBriefed'] as string[]).filter((id: string): boolean => typeof id === 'string') : [];\n receipt.scopeHashes = this.stringMap(raw['scopeHashes']);\n receipt.round = typeof raw['round'] === 'number' && Number.isInteger(raw['round']) ? raw['round'] as number : 0;\n receipt.maxReviewerRounds = typeof raw['maxReviewerRounds'] === 'number' && Number.isInteger(raw['maxReviewerRounds'])\n ? raw['maxReviewerRounds'] as number : 0;\n return receipt;\n } catch (err: unknown) {\n const error = toError(err);\n void error; // unreadable ⇒ treated as absent, which re-runs stage ② (the safe direction)\n return null;\n }\n }\n\n // webpieces-disable no-any-unknown -- one opaque JSON value, narrowed to string→string\n private stringMap(value: unknown): Record<string, string> {\n const out: Record<string, string> = {};\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return out;\n // webpieces-disable no-any-unknown -- entries of an opaque JSON object, each narrowed below\n const obj = value as Record<string, unknown>;\n for (const key of Object.keys(obj)) {\n const v = obj[key];\n if (typeof v === 'string') out[key] = v;\n }\n return out;\n }\n}\n"]}
|
|
@@ -5,19 +5,12 @@ require("reflect-metadata");
|
|
|
5
5
|
const inversify_1 = require("inversify");
|
|
6
6
|
const rules_config_1 = require("@webpieces/rules-config");
|
|
7
7
|
const pr_gate_app_1 = require("./pr-gate-app");
|
|
8
|
-
const review_upsert_pr_command_1 = require("./commands/review-upsert-pr-command");
|
|
9
|
-
const NO_OPTIONAL = '--no-optional';
|
|
10
8
|
// Composition root: build the container and resolve the app so inversify constructs the whole DAG.
|
|
11
9
|
(0, rules_config_1.runMain)(async () => {
|
|
12
10
|
// autobind self-binds every @injectable(Singleton) tooling class (replaces the buildProviderModule registry scan)
|
|
13
11
|
const container = new inversify_1.Container({ autobind: true });
|
|
14
12
|
// Reject `--help`/bogus flags BEFORE the app touches git — an ignored flag must never start the flow.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const args = container.get(rules_config_1.CliArgs).parse(new rules_config_1.CliUsage('wp-review-upsert-pr', 'Validate the 3-point merge, build it, extract this branch\'s diff, and brief the reviewer subagents.', [new rules_config_1.CliFlag(NO_OPTIONAL, 'The human has ALREADY said to submit without the optional reviews — do not offer them.\n' +
|
|
18
|
-
' Pass this ONLY on their instruction, never on your own judgement. Required\n' +
|
|
19
|
-
' checklists are unaffected, and an optional checklist that already has a red\n' +
|
|
20
|
-
' verdict on this branch still blocks the PR.')]));
|
|
21
|
-
await container.get(pr_gate_app_1.PrGateApp).reviewUpsertPr(new review_upsert_pr_command_1.ReviewUpsertPrOptions(args.has(NO_OPTIONAL)));
|
|
13
|
+
container.get(rules_config_1.CliArgs).assertNoArgs(new rules_config_1.CliUsage('wp-review-upsert-pr', 'Validate the 3-point merge, build it, extract this branch\'s diff, and brief the reviewer subagents.'));
|
|
14
|
+
await container.get(pr_gate_app_1.PrGateApp).reviewUpsertPr();
|
|
22
15
|
});
|
|
23
16
|
//# sourceMappingURL=wp-review-upsert-pr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wp-review-upsert-pr.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-review-upsert-pr.ts"],"names":[],"mappings":";;;AACA,4BAA0B;AAC1B,yCAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"wp-review-upsert-pr.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-review-upsert-pr.ts"],"names":[],"mappings":";;;AACA,4BAA0B;AAC1B,yCAAsC;AACtC,0DAAqE;AACrE,+CAA0C;AAE1C,mGAAmG;AACnG,IAAA,sBAAO,EAAC,KAAK,IAAmB,EAAE;IAC9B,kHAAkH;IAClH,MAAM,SAAS,GAAG,IAAI,qBAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,sGAAsG;IACtG,SAAS,CAAC,GAAG,CAAC,sBAAO,CAAC,CAAC,YAAY,CAAC,IAAI,uBAAQ,CAC5C,qBAAqB,EACrB,sGAAsG,CACzG,CAAC,CAAC;IACH,MAAM,SAAS,CAAC,GAAG,CAAC,uBAAS,CAAC,CAAC,cAAc,EAAE,CAAC;AACpD,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport 'reflect-metadata';\nimport { Container } from 'inversify';\nimport { runMain, CliArgs, CliUsage } from '@webpieces/rules-config';\nimport { PrGateApp } from './pr-gate-app';\n\n// Composition root: build the container and resolve the app so inversify constructs the whole DAG.\nrunMain(async (): Promise<void> => {\n // autobind self-binds every @injectable(Singleton) tooling class (replaces the buildProviderModule registry scan)\n const container = new Container({ autobind: true });\n // Reject `--help`/bogus flags BEFORE the app touches git — an ignored flag must never start the flow.\n container.get(CliArgs).assertNoArgs(new CliUsage(\n 'wp-review-upsert-pr',\n 'Validate the 3-point merge, build it, extract this branch\\'s diff, and brief the reviewer subagents.',\n ));\n await container.get(PrGateApp).reviewUpsertPr();\n});\n"]}
|