@webpieces/pr-gate 0.4.940 → 0.4.942
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 +6 -6
- package/src/dashboard/dashboard.d.ts +2 -1
- package/src/dashboard/dashboard.js +15 -3
- package/src/dashboard/dashboard.js.map +1 -1
- package/src/dashboard/issue-references.d.ts +39 -0
- package/src/dashboard/issue-references.js +94 -0
- package/src/dashboard/issue-references.js.map +1 -0
- package/src/scripts/commands/finish-upsert-pr-command.js +8 -0
- package/src/scripts/commands/finish-upsert-pr-command.js.map +1 -1
- package/src/scripts/commands/human-post-pr-command.js +16 -3
- package/src/scripts/commands/human-post-pr-command.js.map +1 -1
- package/src/scripts/commands/upsert-hotfix-pr-command.js +5 -0
- package/src/scripts/commands/upsert-hotfix-pr-command.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert-hotfix-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/upsert-hotfix-pr-command.ts"],"names":[],"mappings":";;;;AAAA,iDAA0C;AAC1C,+CAAyB;AACzB,mDAA6B;AAC7B,sEAA+D;AAC/D,0DAAqK;AACrK,yCAA2D;AAC3D,2EAAgE;AAChE,mDAA+C;AAC/C,+DAA6E;AAC7E,yEAAoE;AACpE,+DAA0D;AAC1D,yDAAqD;AACrD,qEAAuF;AAEvF,yEAAoE;AACpE,iEAAuE;AACvE,yEAAsF;AACtF,mFAA8E;AAC9E,yDAA6F;AAC7F,2FAAgH;AAChH,iFAA4E;AAC5E,qEAAyE;AAEzE,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,kGAAkG;AAClG,MAAa,WAAW;IACpB,MAAM,CAAS;IACf,GAAG,CAAS;IAEZ,YAAY,MAAc,EAAE,GAAW;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;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QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACtI,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpD,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAES,UAAU,CAAC,QAAgB,EAAE,QAAgB;QACnD,OAAO,IAAA,yBAAS,EAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IACjH,CAAC;CACJ,CAAA;AAvNY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAIA,6BAAc;QACd,mCAAc;QAChB,mCAAY;QACjB,kBAAO;QACG,gCAAiB;QACrB,8BAAa;QACT,uCAAiB;QACxB,wBAAU;QACJ,oCAAgB;QACvB,uCAAiB;QACjB,qBAAS;QACJ,wCAAsB;QACpB,qDAAwB;QACzB,uCAAiB;QAClB,iDAAsB;QACpB,+BAAgB;GAlB9C,qBAAqB,CAuNjC","sourcesContent":["import { spawnSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { BranchIdentity } from '@webpieces/repo-workflow-core';\nimport { CliExitError, GateTokenService, PrGateConfig, PrSummary, RepoRootFinder, ReviewJsonService, loadAndValidate, writeTemplate } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { GitExec } from '../workflow/git-exec';\nimport { BuildAffected, BuildGateOptions } from '../workflow/build-affected';\nimport { BuildArtifactGate } from '../workflow/build-artifact-gate';\nimport { FINISH_STAGE } from '../workflow/build-gate-log';\nimport { MergeState } from '../workflow/merge-state';\nimport { ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\nimport { TriggeredChecklist } from '../workflow/checklist-detector';\nimport { HotfixPrPublisher } from '../workflow/hotfix-pr-publisher';\nimport { UPSERT_HOTFIX_PR_COMMAND } from '../workflow/hotfix-redirect';\nimport { PrCommentRequest, PrCommentUpserter } from '../workflow/pr-comment-upserter';\nimport { SquashSettingsEnforcer } from '../workflow/squash-settings-enforcer';\nimport { Dashboard, DashboardInput, DETAIL_COMMENT_MARKER } from '../../dashboard/dashboard';\nimport { ChecklistCommentRenderer, CHECKLIST_COMMENT_MARKER } from '../../dashboard/checklist-comment-renderer';\nimport { ChecklistCommentRow } from '../../dashboard/checklist-comment-row';\nimport { AuthorIdentityResolver } from '../../dashboard/author-identity';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/** The PR this run landed on. Both '' when it could not be resolved. Data-only, per CLAUDE.md. */\nexport class HotfixPrRef {\n number: string;\n url: string;\n\n constructor(number: string, url: string) {\n this.number = number;\n this.url = url;\n }\n}\n\n/**\n * `wp-upsert-hotfix-pr` — the ONE command that publishes a `/hotfix/` branch (issue #1057).\n *\n * A hotfix branch is cut from the exact sha running in production, so that what ships is production plus\n * the fix and nothing else. The three-stage PR flow cannot publish it: stage ① merges main into the branch,\n * which turns \"prod + fix\" into \"main + fix\" and ships every commit that has landed but has not been\n * promoted. And a hotfix runs no reviewers, so the stages have nothing to do between them. This is the\n * whole flow, in one command, in this order:\n *\n * 1. refuse unless the branch carries the exact, case-sensitive `/hotfix/` segment;\n * 2. require a clean tree and summary.json — a missing one prints its path and schema and exits;\n * 3. run ONLY the `hotfix-ci` gate (build + test). Red means nothing is pushed;\n * 4. NEVER merge main into the branch, never squash it, never rewrite it — HEAD is checked unchanged;\n * 5. push ONCE, fast-forward only, as a child process (pr-creation-or-push-guard stays intact);\n * 6. create or update the audit-bannered PR to main, and NEVER enable auto-merge — the consumer merges\n * after it has deployed and verified the hotfix. Re-running after another commit pushes again and\n * updates the same PR.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class UpsertHotfixPrCommand {\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly branchIdentity: BranchIdentity,\n private readonly aiBranchName: AiBranchName,\n private readonly gitExec: GitExec,\n private readonly reviewJsonService: ReviewJsonService,\n private readonly buildAffected: BuildAffected,\n private readonly buildArtifactGate: BuildArtifactGate,\n private readonly mergeState: MergeState,\n private readonly checklistScanner: ChecklistScanner,\n private readonly publisher: HotfixPrPublisher,\n private readonly dashboard: Dashboard,\n private readonly authorIdentity: AuthorIdentityResolver,\n private readonly checklistComment: ChecklistCommentRenderer,\n private readonly commentUpserter: PrCommentUpserter,\n private readonly squashSettings: SquashSettingsEnforcer,\n private readonly gateTokenService: GateTokenService,\n ) {}\n\n async run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n const branch = this.branchIdentity.current();\n // FIRST, before any write: a non-hotfix branch gets nothing from this command, not even a template.\n this.assertHotfixBranch(branch);\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n this.gitExec.assertCleanTree(repoRoot);\n this.assertNoUnvalidatedMerge(repoRoot);\n\n const featureName = this.aiBranchName.getFeatureName();\n const summaryPath = this.reviewJsonService.summaryJsonPath(repoRoot, featureName);\n // Throws InformAiError carrying the path and the schema when summary.json is missing or invalid.\n const summary = this.reviewJsonService.loadSummaryJson(summaryPath, [], '', {}, UPSERT_HOTFIX_PR_COMMAND);\n\n // origin/main is READ (the build's merge-base and the dashboard's fork point) — never merged.\n this.fetchMain(repoRoot);\n const headBefore = this.headSha(repoRoot);\n await this.buildAffected.runBuildGate(\n repoRoot,\n new BuildGateOptions('🛠️ Hotfix build gate (hotfix-ci: build + test only)', UPSERT_HOTFIX_PR_COMMAND, 'Hotfix build failed — nothing was pushed and no PR was created or updated.', FINISH_STAGE),\n );\n this.buildArtifactGate.assertBuildLeftNothingUncommitted(repoRoot);\n this.gitExec.assertCleanTree(repoRoot);\n if (this.headSha(repoRoot) !== headBefore) {\n throw new CliExitError(1, `❌ HEAD moved while the hotfix build ran, so the build does not cover the commit that would be pushed. Nothing was pushed. Re-run ${UPSERT_HOTFIX_PR_COMMAND}.`);\n }\n\n const ref = this.publish(repoRoot, branch, summary, headBefore);\n this.postComments(repoRoot, featureName, ref, summary);\n this.squashSettings.ensure();\n const archived = this.reviewJsonService.archiveSummaryJson(summaryPath);\n if (archived !== '') process.stdout.write(` archived this run's summary.json → ${archived} (audit only) ✓\\n`);\n process.stdout.write(this.closingBlock(ref, summary.title, branch));\n }\n\n private assertHotfixBranch(branch: string): void {\n if (this.branchIdentity.isHotfix(branch)) return;\n throw new CliExitError(\n 1,\n `wp-upsert-hotfix-pr only runs on a branch containing the exact, case-sensitive /hotfix/ segment; '${branch}' does not.\\n` +\n 'Nothing was changed. A normal branch is published with the three-stage flow:\\n' +\n ' pnpm wp-start-upsert-pr\\n pnpm wp-review-upsert-pr\\n pnpm wp-finish-upsert-pr',\n );\n }\n\n // A hotfix flow never STARTS a merge, but a branch somebody ran wp-start-update on can carry one.\n private assertNoUnvalidatedMerge(repoRoot: string): void {\n const home = this.mergeState.mergeDirFor(repoRoot, this.aiBranchName.getFeatureName());\n const active = this.mergeState.findActiveMergeRunDir(home);\n const marker = active === null ? null : this.mergeState.readMergeMarker(active);\n if (marker === null || marker.validated) return;\n throw new CliExitError(\n 1,\n 'wp-upsert-hotfix-pr refuses a branch with an active, unvalidated 3-point merge. A hotfix branch must\\n' +\n 'not take main at all: abort that merge and return the branch to the production sha plus your fix\\n' +\n `commits, then re-run ${UPSERT_HOTFIX_PR_COMMAND}. Nothing was pushed.`,\n );\n }\n\n /** Body before push (GatedPrPublisher's ordering), fast-forward push, then create or edit — never merge. */\n private publish(repoRoot: string, branch: string, summary: PrSummary, headSha: string): HotfixPrRef {\n const config = this.prGateConfig(repoRoot);\n const input = this.dashboardInput(repoRoot, summary, config);\n const tokenSuffix = this.tokenSuffix(config.gateSalt, headSha);\n const initial = this.prRef(branch);\n const body = this.dashboard.renderPrBody(input, initial.url) + tokenSuffix;\n const bodyFile = path.join(this.reviewJsonService.prDirFor(repoRoot, this.aiBranchName.getFeatureName()), 'pr-body.md');\n fs.mkdirSync(path.dirname(bodyFile), { recursive: true });\n fs.writeFileSync(bodyFile, body + '\\n');\n\n process.stdout.write('\\n' + SEP + '📋 Hotfix PR (bannered audit, never auto-merged)\\n' + SEP + '\\n');\n const published = this.publisher.publish(branch, this.titleFrom(summary, branch), bodyFile, UPSERT_HOTFIX_PR_COMMAND);\n if (published.createFailed) {\n throw new CliExitError(1, `❌ gh pr create failed after the push. The rendered body is in ${bodyFile}; summary.json was kept. Re-run ${UPSERT_HOTFIX_PR_COMMAND}.`);\n }\n const ref = this.prRef(branch);\n const resolved = new HotfixPrRef(ref.number !== '' ? ref.number : published.number, ref.url);\n // A brand-new PR had no URL to self-link until `gh pr create` returned one.\n const finalBody = this.dashboard.renderPrBody(input, resolved.url) + tokenSuffix;\n if (finalBody !== body && resolved.number !== '') {\n fs.writeFileSync(bodyFile, finalBody + '\\n');\n if (!this.editPrBody(resolved.number, bodyFile)) {\n process.stderr.write(`⚠️ Could not add the PR's own link to its description (non-fatal — the PR and the gate token are up).\\n`);\n }\n }\n return resolved;\n }\n\n private dashboardInput(repoRoot: string, summary: PrSummary, config: PrGateConfig): DashboardInput {\n const forkPoint = this.git(repoRoot, ['merge-base', 'origin/main', 'HEAD']);\n const featureHead = this.git(repoRoot, ['rev-parse', 'HEAD']);\n const mainHead = this.git(repoRoot, ['rev-parse', 'origin/main']);\n const range = `${forkPoint}..${featureHead}`;\n const changedFiles = this.git(repoRoot, ['diff', range, '--name-only'])\n .split('\\n')\n .filter((f: string): boolean => f.trim() !== '');\n const gateResults = this.dashboard.computeGateResults(config.gates, changedFiles);\n const disables = this.dashboard.countAddedDisables(this.git(repoRoot, ['diff', range]));\n const buildCommand = this.buildAffected.resolveBuildCommand(repoRoot);\n const title = this.titleFrom(summary, this.branchIdentity.current());\n return new DashboardInput(title, gateResults, disables, true, forkPoint, featureHead, mainHead, summary, [], buildCommand, 0, this.authorIdentity.resolve(summary.model), true);\n }\n\n /** The 1st comment (full dashboard) and, when the repo defines checklists, the bypassed-roster 2nd. */\n private postComments(repoRoot: string, featureName: string, ref: HotfixPrRef, summary: PrSummary): void {\n if (ref.number === '') {\n process.stderr.write(`⚠️ Could not resolve the PR number after the push, so the audit comments were not posted. The PR body\\n still carries the hotfix banner. Re-run ${UPSERT_HOTFIX_PR_COMMAND} to post them.\\n`);\n return;\n }\n const config = this.prGateConfig(repoRoot);\n const prDir = this.reviewJsonService.prDirFor(repoRoot, featureName);\n const detail = new PrCommentRequest();\n detail.prNumber = ref.number;\n detail.marker = DETAIL_COMMENT_MARKER;\n // The audit banner must be the FIRST thing on the comment, so the marker goes last.\n detail.body = this.dashboard.renderDetailComment(this.dashboardInput(repoRoot, summary, config)) + '\\n\\n' + DETAIL_COMMENT_MARKER;\n detail.payloadDir = prDir;\n detail.payloadName = 'detail-comment.json';\n detail.label = 'full dashboard comment';\n this.commentUpserter.upsert(detail);\n\n if (config.checklists.length === 0 || !config.checklistComments) return;\n const scan = this.checklistScanner.scan(repoRoot, config.checklists, new ChecklistScanOptions(config.maxReviewerRounds, false, ''));\n const rows = scan.roster.entries.map(\n (entry: TriggeredChecklist): ChecklistCommentRow =>\n new ChecklistCommentRow('none', 'none', entry.def.id, '', '', entry.matchedFiles.length > 0, entry.def.patterns, entry.matchedPatterns, entry.matchedFiles, scan.roster.changedFileCount),\n );\n const roster = new PrCommentRequest();\n roster.prNumber = ref.number;\n roster.marker = CHECKLIST_COMMENT_MARKER;\n roster.body = this.checklistComment.render(rows, false, scan.roster.baseResolved, 0, true);\n roster.payloadDir = prDir;\n roster.payloadName = 'checklist-comment.json';\n roster.label = 'checklist review comment';\n this.commentUpserter.upsert(roster);\n }\n\n private closingBlock(ref: HotfixPrRef, title: string, branch: string): string {\n const link = ref.url === '' ? '(PR URL unresolved — see the gh output above)' : ref.url;\n return (\n '\\n' +\n SEP +\n `✅ Hotfix PR ${ref.number === '' ? '' : `#${ref.number} `}is up — NOT merged, and auto-merge was NOT enabled\\n` +\n SEP +\n '\\n' +\n ' 1. ran hotfix-ci (build + test only); lint, validators and reviewers are bypassed and bannered\\n' +\n ` 2. pushed ${branch} fast-forward only — main was never merged in and the branch was not rewritten\\n` +\n ` 3. wrote the audit-bannered body to the PR titled: \"${title}\"\\n\\n` +\n ' A hotfix PR is never auto-merged. Deploy and verify the hotfix first; the merge to main is then a\\n' +\n ' deliberate step (pnpm wp-land-pr). Another commit on this branch? Commit it and re-run\\n' +\n ` ${UPSERT_HOTFIX_PR_COMMAND} — it pushes again and updates this same PR.\\n\\n` +\n `🔗 ${link}\\n`\n );\n }\n\n private tokenSuffix(gateSalt: string, headSha: string): string {\n const marker = this.gateTokenService.gateTokenMarker(gateSalt, headSha);\n return marker === '' ? '' : `\\n\\n${marker}\\n`;\n }\n\n private titleFrom(summary: PrSummary, branch: string): string {\n return summary.title !== '' ? summary.title : branch.replace(/[-/]+/g, ' ').trim();\n }\n\n private headSha(repoRoot: string): string {\n return this.git(repoRoot, ['rev-parse', 'HEAD']);\n }\n\n private git(repoRoot: string, args: string[]): string {\n return this.gitExec.gitQuery(args, repoRoot, `git ${args.join(' ')} failed in ${repoRoot}`);\n }\n\n // ── seams, protected so the spec drives them with no network, no gh and no webpieces.config.json ──\n\n protected prGateConfig(repoRoot: string): PrGateConfig {\n return loadAndValidate(repoRoot).prGate;\n }\n\n protected fetchMain(repoRoot: string): void {\n const out = this.gitExec.tryGit(['fetch', 'origin', 'main'], repoRoot);\n if (out.ok) return;\n throw new CliExitError(1, `❌ Could not fetch origin/main (needed to READ the fork point — it is never merged). Nothing was pushed.\\n git said: ${out.stderr}`);\n }\n\n protected prRef(branch: string): HotfixPrRef {\n const out = spawnSync('gh', ['pr', 'view', branch, '--json', 'number,url', '--jq', '\"\\\\(.number)\\\\t\\\\(.url)\"'], { encoding: 'utf8' });\n if (out.status !== 0) return new HotfixPrRef('', '');\n const parts = (out.stdout ?? '').trim().split('\\t');\n return new HotfixPrRef(parts[0] ?? '', parts[1] ?? '');\n }\n\n protected editPrBody(prNumber: string, bodyFile: string): boolean {\n return spawnSync('gh', ['pr', 'edit', prNumber, '--body-file', bodyFile], { stdio: 'inherit' }).status === 0;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"upsert-hotfix-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/upsert-hotfix-pr-command.ts"],"names":[],"mappings":";;;;AAAA,iDAA0C;AAC1C,+CAAyB;AACzB,mDAA6B;AAC7B,sEAA+D;AAC/D,0DAAqK;AACrK,yCAA2D;AAC3D,2EAAgE;AAChE,mDAA+C;AAC/C,+DAA6E;AAC7E,yEAAoE;AACpE,+DAA0D;AAC1D,yDAAqD;AACrD,qEAAuF;AAEvF,yEAAoE;AACpE,iEAAuE;AACvE,yEAAsF;AACtF,mFAA8E;AAC9E,yDAA6F;AAC7F,2FAAgH;AAChH,iFAA4E;AAC5E,qEAAyE;AACzE,uEAAmE;AAEnE,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,kGAAkG;AAClG,MAAa,WAAW;IACpB,MAAM,CAAS;IACf,GAAG,CAAS;IAEZ,YAAY,MAAc,EAAE,GAAW;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AARD,kCAQC;AAED;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;I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{ BranchIdentity } from '@webpieces/repo-workflow-core';\nimport { CliExitError, GateTokenService, PrGateConfig, PrSummary, RepoRootFinder, ReviewJsonService, loadAndValidate, writeTemplate } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { GitExec } from '../workflow/git-exec';\nimport { BuildAffected, BuildGateOptions } from '../workflow/build-affected';\nimport { BuildArtifactGate } from '../workflow/build-artifact-gate';\nimport { FINISH_STAGE } from '../workflow/build-gate-log';\nimport { MergeState } from '../workflow/merge-state';\nimport { ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\nimport { TriggeredChecklist } from '../workflow/checklist-detector';\nimport { HotfixPrPublisher } from '../workflow/hotfix-pr-publisher';\nimport { UPSERT_HOTFIX_PR_COMMAND } from '../workflow/hotfix-redirect';\nimport { PrCommentRequest, PrCommentUpserter } from '../workflow/pr-comment-upserter';\nimport { SquashSettingsEnforcer } from '../workflow/squash-settings-enforcer';\nimport { Dashboard, DashboardInput, DETAIL_COMMENT_MARKER } from '../../dashboard/dashboard';\nimport { ChecklistCommentRenderer, CHECKLIST_COMMENT_MARKER } from '../../dashboard/checklist-comment-renderer';\nimport { ChecklistCommentRow } from '../../dashboard/checklist-comment-row';\nimport { AuthorIdentityResolver } from '../../dashboard/author-identity';\nimport { IssueReferences } from '../../dashboard/issue-references';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/** The PR this run landed on. Both '' when it could not be resolved. Data-only, per CLAUDE.md. */\nexport class HotfixPrRef {\n number: string;\n url: string;\n\n constructor(number: string, url: string) {\n this.number = number;\n this.url = url;\n }\n}\n\n/**\n * `wp-upsert-hotfix-pr` — the ONE command that publishes a `/hotfix/` branch (issue #1057).\n *\n * A hotfix branch is cut from the exact sha running in production, so that what ships is production plus\n * the fix and nothing else. The three-stage PR flow cannot publish it: stage ① merges main into the branch,\n * which turns \"prod + fix\" into \"main + fix\" and ships every commit that has landed but has not been\n * promoted. And a hotfix runs no reviewers, so the stages have nothing to do between them. This is the\n * whole flow, in one command, in this order:\n *\n * 1. refuse unless the branch carries the exact, case-sensitive `/hotfix/` segment;\n * 2. require a clean tree and summary.json — a missing one prints its path and schema and exits;\n * 3. run ONLY the `hotfix-ci` gate (build + test). Red means nothing is pushed;\n * 4. NEVER merge main into the branch, never squash it, never rewrite it — HEAD is checked unchanged;\n * 5. push ONCE, fast-forward only, as a child process (pr-creation-or-push-guard stays intact);\n * 6. create or update the audit-bannered PR to main, and NEVER enable auto-merge — the consumer merges\n * after it has deployed and verified the hotfix. Re-running after another commit pushes again and\n * updates the same PR.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class UpsertHotfixPrCommand {\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly branchIdentity: BranchIdentity,\n private readonly aiBranchName: AiBranchName,\n private readonly gitExec: GitExec,\n private readonly reviewJsonService: ReviewJsonService,\n private readonly buildAffected: BuildAffected,\n private readonly buildArtifactGate: BuildArtifactGate,\n private readonly mergeState: MergeState,\n private readonly checklistScanner: ChecklistScanner,\n private readonly publisher: HotfixPrPublisher,\n private readonly dashboard: Dashboard,\n private readonly authorIdentity: AuthorIdentityResolver,\n private readonly checklistComment: ChecklistCommentRenderer,\n private readonly commentUpserter: PrCommentUpserter,\n private readonly squashSettings: SquashSettingsEnforcer,\n private readonly gateTokenService: GateTokenService,\n ) {}\n\n async run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n const branch = this.branchIdentity.current();\n // FIRST, before any write: a non-hotfix branch gets nothing from this command, not even a template.\n this.assertHotfixBranch(branch);\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n this.gitExec.assertCleanTree(repoRoot);\n this.assertNoUnvalidatedMerge(repoRoot);\n\n const featureName = this.aiBranchName.getFeatureName();\n const summaryPath = this.reviewJsonService.summaryJsonPath(repoRoot, featureName);\n // Throws InformAiError carrying the path and the schema when summary.json is missing or invalid.\n const summary = this.reviewJsonService.loadSummaryJson(summaryPath, [], '', {}, UPSERT_HOTFIX_PR_COMMAND);\n // FAIL FAST on a hand-written closing reference (issue #1310); renderPrBody re-judges the final body.\n new IssueReferences().assertNoStrayClosingReferences(summary.summary, summary.addressesIssues, UPSERT_HOTFIX_PR_COMMAND);\n\n // origin/main is READ (the build's merge-base and the dashboard's fork point) — never merged.\n this.fetchMain(repoRoot);\n const headBefore = this.headSha(repoRoot);\n await this.buildAffected.runBuildGate(\n repoRoot,\n new BuildGateOptions('🛠️ Hotfix build gate (hotfix-ci: build + test only)', UPSERT_HOTFIX_PR_COMMAND, 'Hotfix build failed — nothing was pushed and no PR was created or updated.', FINISH_STAGE),\n );\n this.buildArtifactGate.assertBuildLeftNothingUncommitted(repoRoot);\n this.gitExec.assertCleanTree(repoRoot);\n if (this.headSha(repoRoot) !== headBefore) {\n throw new CliExitError(1, `❌ HEAD moved while the hotfix build ran, so the build does not cover the commit that would be pushed. Nothing was pushed. Re-run ${UPSERT_HOTFIX_PR_COMMAND}.`);\n }\n\n const ref = this.publish(repoRoot, branch, summary, headBefore);\n this.postComments(repoRoot, featureName, ref, summary);\n this.squashSettings.ensure();\n const archived = this.reviewJsonService.archiveSummaryJson(summaryPath);\n if (archived !== '') process.stdout.write(` archived this run's summary.json → ${archived} (audit only) ✓\\n`);\n process.stdout.write(this.closingBlock(ref, summary.title, branch));\n }\n\n private assertHotfixBranch(branch: string): void {\n if (this.branchIdentity.isHotfix(branch)) return;\n throw new CliExitError(\n 1,\n `wp-upsert-hotfix-pr only runs on a branch containing the exact, case-sensitive /hotfix/ segment; '${branch}' does not.\\n` +\n 'Nothing was changed. A normal branch is published with the three-stage flow:\\n' +\n ' pnpm wp-start-upsert-pr\\n pnpm wp-review-upsert-pr\\n pnpm wp-finish-upsert-pr',\n );\n }\n\n // A hotfix flow never STARTS a merge, but a branch somebody ran wp-start-update on can carry one.\n private assertNoUnvalidatedMerge(repoRoot: string): void {\n const home = this.mergeState.mergeDirFor(repoRoot, this.aiBranchName.getFeatureName());\n const active = this.mergeState.findActiveMergeRunDir(home);\n const marker = active === null ? null : this.mergeState.readMergeMarker(active);\n if (marker === null || marker.validated) return;\n throw new CliExitError(\n 1,\n 'wp-upsert-hotfix-pr refuses a branch with an active, unvalidated 3-point merge. A hotfix branch must\\n' +\n 'not take main at all: abort that merge and return the branch to the production sha plus your fix\\n' +\n `commits, then re-run ${UPSERT_HOTFIX_PR_COMMAND}. Nothing was pushed.`,\n );\n }\n\n /** Body before push (GatedPrPublisher's ordering), fast-forward push, then create or edit — never merge. */\n private publish(repoRoot: string, branch: string, summary: PrSummary, headSha: string): HotfixPrRef {\n const config = this.prGateConfig(repoRoot);\n const input = this.dashboardInput(repoRoot, summary, config);\n const tokenSuffix = this.tokenSuffix(config.gateSalt, headSha);\n const initial = this.prRef(branch);\n const body = this.dashboard.renderPrBody(input, initial.url) + tokenSuffix;\n for (const warning of new IssueReferences().closeWarnings(summary.addressesIssues)) process.stdout.write(`${warning}\\n`);\n const bodyFile = path.join(this.reviewJsonService.prDirFor(repoRoot, this.aiBranchName.getFeatureName()), 'pr-body.md');\n fs.mkdirSync(path.dirname(bodyFile), { recursive: true });\n fs.writeFileSync(bodyFile, body + '\\n');\n\n process.stdout.write('\\n' + SEP + '📋 Hotfix PR (bannered audit, never auto-merged)\\n' + SEP + '\\n');\n const published = this.publisher.publish(branch, this.titleFrom(summary, branch), bodyFile, UPSERT_HOTFIX_PR_COMMAND);\n if (published.createFailed) {\n throw new CliExitError(1, `❌ gh pr create failed after the push. The rendered body is in ${bodyFile}; summary.json was kept. Re-run ${UPSERT_HOTFIX_PR_COMMAND}.`);\n }\n const ref = this.prRef(branch);\n const resolved = new HotfixPrRef(ref.number !== '' ? ref.number : published.number, ref.url);\n // A brand-new PR had no URL to self-link until `gh pr create` returned one.\n const finalBody = this.dashboard.renderPrBody(input, resolved.url) + tokenSuffix;\n if (finalBody !== body && resolved.number !== '') {\n fs.writeFileSync(bodyFile, finalBody + '\\n');\n if (!this.editPrBody(resolved.number, bodyFile)) {\n process.stderr.write(`⚠️ Could not add the PR's own link to its description (non-fatal — the PR and the gate token are up).\\n`);\n }\n }\n return resolved;\n }\n\n private dashboardInput(repoRoot: string, summary: PrSummary, config: PrGateConfig): DashboardInput {\n const forkPoint = this.git(repoRoot, ['merge-base', 'origin/main', 'HEAD']);\n const featureHead = this.git(repoRoot, ['rev-parse', 'HEAD']);\n const mainHead = this.git(repoRoot, ['rev-parse', 'origin/main']);\n const range = `${forkPoint}..${featureHead}`;\n const changedFiles = this.git(repoRoot, ['diff', range, '--name-only'])\n .split('\\n')\n .filter((f: string): boolean => f.trim() !== '');\n const gateResults = this.dashboard.computeGateResults(config.gates, changedFiles);\n const disables = this.dashboard.countAddedDisables(this.git(repoRoot, ['diff', range]));\n const buildCommand = this.buildAffected.resolveBuildCommand(repoRoot);\n const title = this.titleFrom(summary, this.branchIdentity.current());\n return new DashboardInput(title, gateResults, disables, true, forkPoint, featureHead, mainHead, summary, [], buildCommand, 0, this.authorIdentity.resolve(summary.model), true);\n }\n\n /** The 1st comment (full dashboard) and, when the repo defines checklists, the bypassed-roster 2nd. */\n private postComments(repoRoot: string, featureName: string, ref: HotfixPrRef, summary: PrSummary): void {\n if (ref.number === '') {\n process.stderr.write(`⚠️ Could not resolve the PR number after the push, so the audit comments were not posted. The PR body\\n still carries the hotfix banner. Re-run ${UPSERT_HOTFIX_PR_COMMAND} to post them.\\n`);\n return;\n }\n const config = this.prGateConfig(repoRoot);\n const prDir = this.reviewJsonService.prDirFor(repoRoot, featureName);\n const detail = new PrCommentRequest();\n detail.prNumber = ref.number;\n detail.marker = DETAIL_COMMENT_MARKER;\n // The audit banner must be the FIRST thing on the comment, so the marker goes last.\n detail.body = this.dashboard.renderDetailComment(this.dashboardInput(repoRoot, summary, config)) + '\\n\\n' + DETAIL_COMMENT_MARKER;\n detail.payloadDir = prDir;\n detail.payloadName = 'detail-comment.json';\n detail.label = 'full dashboard comment';\n this.commentUpserter.upsert(detail);\n\n if (config.checklists.length === 0 || !config.checklistComments) return;\n const scan = this.checklistScanner.scan(repoRoot, config.checklists, new ChecklistScanOptions(config.maxReviewerRounds, false, ''));\n const rows = scan.roster.entries.map(\n (entry: TriggeredChecklist): ChecklistCommentRow =>\n new ChecklistCommentRow('none', 'none', entry.def.id, '', '', entry.matchedFiles.length > 0, entry.def.patterns, entry.matchedPatterns, entry.matchedFiles, scan.roster.changedFileCount),\n );\n const roster = new PrCommentRequest();\n roster.prNumber = ref.number;\n roster.marker = CHECKLIST_COMMENT_MARKER;\n roster.body = this.checklistComment.render(rows, false, scan.roster.baseResolved, 0, true);\n roster.payloadDir = prDir;\n roster.payloadName = 'checklist-comment.json';\n roster.label = 'checklist review comment';\n this.commentUpserter.upsert(roster);\n }\n\n private closingBlock(ref: HotfixPrRef, title: string, branch: string): string {\n const link = ref.url === '' ? '(PR URL unresolved — see the gh output above)' : ref.url;\n return (\n '\\n' +\n SEP +\n `✅ Hotfix PR ${ref.number === '' ? '' : `#${ref.number} `}is up — NOT merged, and auto-merge was NOT enabled\\n` +\n SEP +\n '\\n' +\n ' 1. ran hotfix-ci (build + test only); lint, validators and reviewers are bypassed and bannered\\n' +\n ` 2. pushed ${branch} fast-forward only — main was never merged in and the branch was not rewritten\\n` +\n ` 3. wrote the audit-bannered body to the PR titled: \"${title}\"\\n\\n` +\n ' A hotfix PR is never auto-merged. Deploy and verify the hotfix first; the merge to main is then a\\n' +\n ' deliberate step (pnpm wp-land-pr). Another commit on this branch? Commit it and re-run\\n' +\n ` ${UPSERT_HOTFIX_PR_COMMAND} — it pushes again and updates this same PR.\\n\\n` +\n `🔗 ${link}\\n`\n );\n }\n\n private tokenSuffix(gateSalt: string, headSha: string): string {\n const marker = this.gateTokenService.gateTokenMarker(gateSalt, headSha);\n return marker === '' ? '' : `\\n\\n${marker}\\n`;\n }\n\n private titleFrom(summary: PrSummary, branch: string): string {\n return summary.title !== '' ? summary.title : branch.replace(/[-/]+/g, ' ').trim();\n }\n\n private headSha(repoRoot: string): string {\n return this.git(repoRoot, ['rev-parse', 'HEAD']);\n }\n\n private git(repoRoot: string, args: string[]): string {\n return this.gitExec.gitQuery(args, repoRoot, `git ${args.join(' ')} failed in ${repoRoot}`);\n }\n\n // ── seams, protected so the spec drives them with no network, no gh and no webpieces.config.json ──\n\n protected prGateConfig(repoRoot: string): PrGateConfig {\n return loadAndValidate(repoRoot).prGate;\n }\n\n protected fetchMain(repoRoot: string): void {\n const out = this.gitExec.tryGit(['fetch', 'origin', 'main'], repoRoot);\n if (out.ok) return;\n throw new CliExitError(1, `❌ Could not fetch origin/main (needed to READ the fork point — it is never merged). Nothing was pushed.\\n git said: ${out.stderr}`);\n }\n\n protected prRef(branch: string): HotfixPrRef {\n const out = spawnSync('gh', ['pr', 'view', branch, '--json', 'number,url', '--jq', '\"\\\\(.number)\\\\t\\\\(.url)\"'], { encoding: 'utf8' });\n if (out.status !== 0) return new HotfixPrRef('', '');\n const parts = (out.stdout ?? '').trim().split('\\t');\n return new HotfixPrRef(parts[0] ?? '', parts[1] ?? '');\n }\n\n protected editPrBody(prNumber: string, bodyFile: string): boolean {\n return spawnSync('gh', ['pr', 'edit', prNumber, '--body-file', bodyFile], { stdio: 'inherit' }).status === 0;\n }\n}\n"]}
|