@webpieces/pr-gate 0.4.984 → 0.4.986
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 +8 -8
- package/src/scripts/commands/build-push-dev-command.d.ts +79 -0
- package/src/scripts/commands/build-push-dev-command.js +184 -0
- package/src/scripts/commands/build-push-dev-command.js.map +1 -0
- package/src/scripts/commands/finish-push-dev-command.d.ts +73 -17
- package/src/scripts/commands/finish-push-dev-command.js +187 -31
- package/src/scripts/commands/finish-push-dev-command.js.map +1 -1
- package/src/scripts/commands/start-push-dev-command.d.ts +43 -0
- package/src/scripts/commands/start-push-dev-command.js +111 -0
- package/src/scripts/commands/start-push-dev-command.js.map +1 -0
- package/src/scripts/pr-gate-app.d.ts +18 -18
- package/src/scripts/pr-gate-app.js +27 -26
- package/src/scripts/pr-gate-app.js.map +1 -1
- package/src/scripts/pr-gate-cli-app.d.ts +2 -2
- package/src/scripts/pr-gate-cli-app.js +20 -29
- package/src/scripts/pr-gate-cli-app.js.map +1 -1
- package/src/scripts/workflow/build-gate-log.d.ts +1 -0
- package/src/scripts/workflow/build-gate-log.js +7 -3
- package/src/scripts/workflow/build-gate-log.js.map +1 -1
- package/src/scripts/workflow/dev-build.d.ts +8 -5
- package/src/scripts/workflow/dev-build.js +13 -9
- package/src/scripts/workflow/dev-build.js.map +1 -1
- package/src/scripts/workflow/dev-copy-on-main.d.ts +6 -4
- package/src/scripts/workflow/dev-copy-on-main.js +8 -6
- package/src/scripts/workflow/dev-copy-on-main.js.map +1 -1
- package/src/scripts/workflow/dev-deploy-refs.d.ts +4 -17
- package/src/scripts/workflow/dev-deploy-refs.js +5 -21
- package/src/scripts/workflow/dev-deploy-refs.js.map +1 -1
- package/src/scripts/workflow/dev-resolve-runner.d.ts +56 -71
- package/src/scripts/workflow/dev-resolve-runner.js +156 -182
- package/src/scripts/workflow/dev-resolve-runner.js.map +1 -1
- package/src/scripts/workflow/landed-copy-resolver.d.ts +56 -0
- package/src/scripts/workflow/landed-copy-resolver.js +141 -0
- package/src/scripts/workflow/landed-copy-resolver.js.map +1 -0
- package/src/scripts/workflow/main-freshness.d.ts +16 -0
- package/src/scripts/workflow/main-freshness.js +33 -0
- package/src/scripts/workflow/main-freshness.js.map +1 -0
- package/src/scripts/workflow/push-dev-state.d.ts +12 -35
- package/src/scripts/workflow/push-dev-state.js +31 -62
- package/src/scripts/workflow/push-dev-state.js.map +1 -1
- package/src/scripts/workflow/verified-dev-copy.d.ts +46 -0
- package/src/scripts/workflow/verified-dev-copy.js +89 -0
- package/src/scripts/workflow/verified-dev-copy.js.map +1 -0
- package/src/scripts/{wp-build-dev.js → wp-build-push-dev.js} +2 -2
- package/src/scripts/wp-build-push-dev.js.map +1 -0
- package/src/scripts/{wp-push-dev.js → wp-start-push-dev.js} +2 -2
- package/src/scripts/wp-start-push-dev.js.map +1 -0
- package/src/scripts/commands/build-dev-command.d.ts +0 -27
- package/src/scripts/commands/build-dev-command.js +0 -99
- package/src/scripts/commands/build-dev-command.js.map +0 -1
- package/src/scripts/commands/push-dev-command.d.ts +0 -140
- package/src/scripts/commands/push-dev-command.js +0 -356
- package/src/scripts/commands/push-dev-command.js.map +0 -1
- package/src/scripts/wp-build-dev.js.map +0 -1
- package/src/scripts/wp-push-dev.js.map +0 -1
- /package/src/scripts/{wp-build-dev.d.ts → wp-build-push-dev.d.ts} +0 -0
- /package/src/scripts/{wp-push-dev.d.ts → wp-start-push-dev.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-resolve-runner.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/dev-resolve-runner.ts"],"names":[],"mappings":";;;;AAAA,0DAAyG;AACzG,iEAA6D;AAC7D,yCAA2D;AAE3D,yCAAqC;AACrC,uDAAkD;AAClD,qDAAmF;AACnF,qEAA+D;AAC/D,2CAAuC;AAEvC,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE;;;;G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,GAAG,CAAC,CAAC,CAAS,EAAU,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM;cACpE,yBAAyB,KAAK,CAAC,cAAc,qCAAqC;cAClF,yGAAyG;cACzG,oGAAoG;cACpG,GAAG,iCAAkB,uCAAuC,CAAC;IACvE,CAAC;IAED,kFAAkF;IAClF,gBAAgB,CAAC,GAAoB,EAAE,KAAmB;QACtD,OAAO,IAAI,GAAG,GAAG,GAAG,eAAe,KAAK,CAAC,SAAS,mBAAmB,GAAG,CAAC,SAAS,sBAAsB,GAAG,GAAG,GAAG,IAAI;cAC/G,kBAAkB,GAAG,CAAC,SAAS,gCAAgC,KAAK,CAAC,SAAS,oBAAoB;cAClG,qGAAqG;cACrG,sGAAsG;cACtG,WAAW,0BAAW,6EAA6E;cACnG,yBAAyB,KAAK,CAAC,cAAc,uCAAuC,CAAC;IAC/F,CAAC;CACJ,CAAA;AAtSY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGP,kBAAO;QACV,+BAAa;QACZ,kCAAiB;QACZ,4CAAmB;QACrB,oBAAQ;GAN9B,gBAAgB,CAsS5B","sourcesContent":["import { CliExitError, DevDeployConfig, WP_FINISH_PUSH_DEV, WP_PUSH_DEV } from '@webpieces/rules-config';\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { GitExec } from './git-exec';\nimport { DevDeployRefs } from './dev-deploy-refs';\nimport { DevResolveMode, PushDevState, PushDevStateStore } from './push-dev-state';\nimport { DevDeployWatchHints } from './dev-deploy-watch-hints';\nimport { DevBuild } from './dev-build';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * The subject prefix of the ONE commit this flow writes onto a copy: the recorded conflict resolution.\n * The clobber guard reads it — a remote-only commit with this subject is re-derived by the next publish's\n * check against dev, so replacing it destroys nothing; any other remote-only commit is somebody's work.\n */\nexport const RESOLUTION_SUBJECT = 'Dev-deploy: conflict resolution for';\n\n/**\n * The queue-draining engine behind `wp-push-dev` (its pre-publish check against dev, #1397),\n * `wp-push-dev --resolve`, `--rebase-resolution`, and `wp-finish-push-dev`.\n *\n * ONE class owns every git WRITE in the resolve flow, and that is a hard requirement rather than tidiness:\n * `redirect-how-to-merge-main` blocks `git merge` in every form INCLUDING `--continue`, and\n * `pr-creation-or-push-guard` blocks every `git push`. So an AI cannot be told \"now run `git commit`\" or\n * \"`git merge --continue`\" — those instructions are unrunnable by the only party reading them. The command\n * owns the merges, the commit and the push (as child processes the hooks never see); the AI's entire job is\n * editing the conflicted files and `git add`-ing them, neither of which is blocked.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class DevResolveRunner {\n constructor(\n private readonly gitExec: GitExec,\n private readonly refs: DevDeployRefs,\n private readonly store: PushDevStateStore,\n private readonly watchHints: DevDeployWatchHints,\n private readonly devBuild: DevBuild,\n ) {}\n\n /**\n * Start a resolve: park on a throwaway branch at the current copy, then drain the queue.\n *\n * The checkout is `-B <tmp> <base>` and NEVER the feature branch, which is the cardinal constraint made\n * mechanical — every merge below lands on a branch that is deleted at the end, so no other developer's\n * commits can reach the PR head even if the resolve is abandoned halfway.\n *\n * `base` differs between the callers and the difference IS the semantics. A plain publish starts at the\n * LOCAL HEAD and merges `origin/<devBranch>` in (does this copy merge and build against what is already\n * on dev?). `--resolve` starts at the published copy and merges the other copies in (compose what CI\n * will build). `--rebase-resolution` starts at the LOCAL HEAD and merges the published copy in (replay\n * an existing resolution on top of the new commits, instead of force-pushing over it). What is finally\n * PUBLISHED is the state's DevResolveMode's decision — see finalize.\n *\n * `fetchRefs` is passed separately from the queue because `--rebase-resolution` merges a ref that is\n * also its push destination, so \"everything to fetch\" and \"everything to merge\" are not the same list.\n */\n async start(repoRoot: string, state: PushDevState, base: string, fetchRefs: string[]): Promise<void> {\n await this.refs.fetchCopies(repoRoot, fetchRefs);\n // Pinned to a SHA after the fetch: the resolution is recorded on top of exactly what was merged,\n // even if the copy (or the feature branch) moves while a conflict is being resolved.\n state.baseSha = await this.refs.headSha(repoRoot, base);\n this.store.write(repoRoot, state);\n await this.gitExec.runGitChecked(\n ['-C', repoRoot, 'checkout', '-B', state.tmpBranch, base],\n `Failed to create the throwaway resolve branch ${state.tmpBranch}`);\n await this.drain(repoRoot, state);\n }\n\n /**\n * Resume after the human/AI has resolved the halted merge: commit it, then keep draining.\n *\n * REFETCHES the remaining queue first. A resolution session can run long, and queuing against refs\n * fetched an hour ago rehearses a composition CI will not build — the one freshness gap the sibling\n * update flow is still known to have (only its stage ① ever fetches).\n */\n async resume(repoRoot: string, state: PushDevState): Promise<void> {\n await this.assertNoUnmergedPaths(repoRoot, state);\n await this.gitExec.assertNoUntracked(repoRoot);\n await this.gitExec.runGitChecked(['-C', repoRoot, 'add', '-u'], 'Failed to stage the resolved files (git add -u)');\n await this.gitExec.runGitChecked(['-C', repoRoot, 'commit', '--no-edit'],\n `Failed to commit the resolution of ${state.current}`);\n process.stdout.write(`✅ Committed the resolution of ${state.current}.\\n`);\n state.current = '';\n await this.refs.fetchCopies(repoRoot, state.queue);\n await this.drain(repoRoot, state);\n }\n\n /**\n * Throw the whole resolve away: undo any halted merge, go back to the original branch, delete the\n * throwaway branch and the state file. Nothing published, nothing on the feature branch.\n */\n async abort(repoRoot: string, state: PushDevState): Promise<void> {\n // Allowed to fail: there is no merge to abort when the resolve halted between merges, and that is\n // not an error condition — the rest of the teardown must still run.\n await this.gitExec.tryGit(['-C', repoRoot, 'merge', '--abort'], repoRoot);\n await this.restore(repoRoot, state);\n process.stdout.write(\n '\\n' + SEP + '🛑 Dev-deploy resolve aborted\\n' + SEP + '\\n'\n + `You are back on \\`${state.originalBranch}\\`; \\`${state.tmpBranch}\\` and the state file are gone.\\n`\n + `The remote copy \\`${state.targetRef}\\` is untouched, and so is your feature branch.\\n`);\n }\n\n /**\n * Merge queued refs until one conflicts (HALT, hand the tree over) or the queue empties (PUBLISH).\n *\n * A LATER ref can conflict too, which is why this is a loop resumed from a state file rather than a\n * single pass: `wp-finish-push-dev` can legitimately stop again on the next ref in the queue.\n */\n private async drain(repoRoot: string, state: PushDevState): Promise<void> {\n while (state.queue.length > 0) {\n const ref = state.queue[0];\n state.queue = state.queue.slice(1);\n const outcome = await this.gitExec.tryGit(\n ['-C', repoRoot, 'merge', '--no-ff', '--no-edit', '-m',\n `Dev-deploy: merge ${ref} into ${state.targetRef}`, `refs/remotes/origin/${ref}`],\n repoRoot);\n if (outcome.ok) {\n process.stdout.write(` ✓ merged ${ref}\\n`);\n continue;\n }\n state.current = ref;\n await this.halt(repoRoot, state);\n return;\n }\n await this.finalize(repoRoot, state);\n }\n\n /** Stop with the conflicted files listed and the ONE command that continues. Exit 2 = \"your turn\". */\n private async halt(repoRoot: string, state: PushDevState): Promise<never> {\n const conflicted = await this.unmergedPaths(repoRoot);\n // Remembered so the finish records EXACTLY these files as the resolution — and nothing else the\n // merge brought in, which is other developers' work.\n for (const file of conflicted) if (!state.resolvedPaths.includes(file)) state.resolvedPaths.push(file);\n this.store.write(repoRoot, state);\n const remaining = state.queue.length > 0\n ? `\\nStill queued after this one: ${state.queue.join(', ')}\\n`\n + `\\`${WP_FINISH_PUSH_DEV}\\` resumes the queue, so it may stop again on a later ref.\\n`\n : '';\n throw new CliExitError(2,\n '\\n' + SEP + `⚠️ CONFLICT merging ${state.current}\\n` + SEP + '\\n'\n + `You are on the throwaway branch \\`${state.tmpBranch}\\` — NOT \\`${state.originalBranch}\\`. Nothing here\\n`\n + 'can reach your feature branch or your PR, which is exactly why the resolution happens over here.\\n\\n'\n + 'Resolve these files (edit until no conflict markers remain, then `git add` each one):\\n'\n + conflicted.map((f: string): string => ` ${f}`).join('\\n') + '\\n'\n + remaining\n + '\\nThen run ONE of:\\n'\n + ` ${WP_FINISH_PUSH_DEV} ← commit, resume the queue, ${this.buildStep(state)}publish the copy\\n`\n + ` ${WP_FINISH_PUSH_DEV} --abort ← throw it away and go back to \\`${state.originalBranch}\\`\\n\\n`\n + 'Do NOT run `git merge --continue`, `git commit` or `git push` yourself — they are blocked, and\\n'\n + 'the finish command above does all three for you.\\n');\n }\n\n /**\n * Queue empty. What happens next is the mode's (see DevResolveMode):\n *\n * - PREBUILD runs the dev build on the MERGED tree first, so a red build stops before anything is\n * published.\n * - PREBUILD and COMPOSE then publish the BASE plus the recorded resolution — never the merge. REPLAY\n * publishes the merge, as it always has.\n */\n private async finalize(repoRoot: string, state: PushDevState): Promise<void> {\n if (state.mode === DevResolveMode.PREBUILD) await this.buildOrRestore(repoRoot, state);\n if (state.mode !== DevResolveMode.REPLAY) await this.recordResolution(repoRoot, state);\n // Captured BEFORE the tmp branch is deleted — it is the sha the watch hints are about, and after\n // the restore HEAD is the feature branch, which may be a different commit.\n const published = await this.refs.headSha(repoRoot, state.tmpBranch);\n if (state.mode === DevResolveMode.COMPOSE && published === state.baseSha) {\n await this.restore(repoRoot, state);\n process.stdout.write(\n '\\n' + SEP + `✅ ${state.targetRef} composes cleanly — nothing to publish\\n` + SEP + '\\n'\n + 'Every other copy merged onto it without a conflict, so your CI composes it as it is. The copy\\n'\n + `is unchanged, and you are back on \\`${state.originalBranch}\\`.\\n`);\n return;\n }\n await this.gitExec.runGitChecked(\n ['-C', repoRoot, 'push', ...this.pushSafety(state), 'origin', `${state.tmpBranch}:refs/heads/${state.targetRef}`],\n `Failed to publish the dev copy ${state.targetRef}`);\n await this.restore(repoRoot, state);\n process.stdout.write(this.publishedBanner(state)\n + this.watchHints.render(this.refs.config(repoRoot), state.targetRef, published));\n }\n\n /**\n * Run the dev build on the merged throwaway. On a red build, put the checkout back first — the fix\n * belongs on the feature branch, and a developer left parked on a throwaway would make the next\n * `wp-*` command act on the wrong branch — then let the build's own failure (with its `FullLog :`\n * pointer) reach the top-level handler unchanged.\n */\n private async buildOrRestore(repoRoot: string, state: PushDevState): Promise<void> {\n process.stdout.write(`\\nBuilding the merged throwaway \\`${state.tmpBranch}\\` before publishing.\\n`);\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: the checkout must be restored whether or not the build passed; the build's own CliExitError is re-thrown unchanged\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n await this.devBuild.run(repoRoot, WP_PUSH_DEV);\n } catch (err: unknown) {\n const error = toError(err);\n await this.restore(repoRoot, state);\n throw error;\n }\n }\n\n /**\n * Turn the throwaway into what gets PUBLISHED: the base sha plus, when anything conflicted, ONE commit\n * that sets each resolved file to its resolved content.\n *\n * This is issue #1397's option (a): the merge is used for the conflict check and the build only, and\n * is never published. Publishing it would make every other copy an ancestor of this one, so a later\n * `--remove` of that copy would leave its commits on dev through ours. The resolution commit has\n * exactly one parent, the base, so the only thing it can carry of anybody else's work is the text of\n * the hunks that were resolved — content, never history.\n */\n private async recordResolution(repoRoot: string, state: PushDevState): Promise<void> {\n const merged = await this.refs.headSha(repoRoot, state.tmpBranch);\n await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', '-B', state.tmpBranch, state.baseSha],\n `Failed to move ${state.tmpBranch} back to ${state.baseSha.slice(0, 8)} to record the resolution`);\n if (state.resolvedPaths.length === 0) return;\n for (const file of state.resolvedPaths) {\n const inMerge = await this.gitExec.tryGit(['-C', repoRoot, 'cat-file', '-e', `${merged}:${file}`], repoRoot);\n await this.gitExec.runGitChecked(\n inMerge.ok\n ? ['-C', repoRoot, 'checkout', merged, '--', file]\n : ['-C', repoRoot, 'rm', '-q', '--ignore-unmatch', '--', file],\n `Failed to record the resolution of ${file}`);\n }\n // Resolved to exactly what the base already had (\"keep mine\") is a resolution with nothing to record.\n const unchanged = await this.gitExec.tryGit(['-C', repoRoot, 'diff', '--cached', '--quiet'], repoRoot);\n if (unchanged.ok) return;\n await this.gitExec.runGitChecked(['-C', repoRoot, 'commit', '-m',\n `${RESOLUTION_SUBJECT} ${state.targetRef}\\n\\n`\n + 'This commit carries only the files that conflicted and were resolved:\\n'\n + state.resolvedPaths.map((f: string): string => ` ${f}`).join('\\n') + '\\n'],\n `Failed to commit the recorded resolution for ${state.targetRef}`);\n }\n\n /** Back to the original branch; the throwaway and the state file are gone. */\n private async restore(repoRoot: string, state: PushDevState): Promise<void> {\n await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', state.originalBranch],\n `Failed to return to ${state.originalBranch}`);\n await this.gitExec.tryGit(['-C', repoRoot, 'branch', '-D', state.tmpBranch], repoRoot);\n this.store.clear(repoRoot);\n }\n\n /**\n * PREBUILD leases against the sha the clobber guard inspected (plain `--force` only when asked); the\n * other two modes overwrite the copy they themselves started from, as they always have.\n */\n private pushSafety(state: PushDevState): string[] {\n if (state.mode !== DevResolveMode.PREBUILD || state.force) return ['--force'];\n if (state.leaseSha === '') return [];\n return [`--force-with-lease=refs/heads/${state.targetRef}:${state.leaseSha}`];\n }\n\n // The halt message names the build only where the finish will actually run one.\n private buildStep(state: PushDevState): string {\n return state.mode === DevResolveMode.PREBUILD ? 'run the dev build, ' : '';\n }\n\n private publishedBanner(state: PushDevState): string {\n const what = state.mode === DevResolveMode.REPLAY\n ? 'your new commits merged with the copy\\'s earlier resolution'\n : state.resolvedPaths.length === 0\n ? 'your branch exactly as it is'\n : `your branch plus ONE commit recording the resolution of ${String(state.resolvedPaths.length)} file(s) — no merge, so no other copy became part of its history`;\n return '\\n' + SEP + `✅ Published ${state.targetRef}\\n` + SEP + '\\n'\n + `The copy is ${what}.\\n`\n + `You are back on \\`${state.originalBranch}\\`, which was never modified — verify with:\\n`\n + ` git log --oneline ${state.originalBranch}\\n`\n + 'Your CI will pick the copy up on its next composition run.\\n'\n + ` ${WP_PUSH_DEV} --list ← what else is in the pool\\n`\n + ` ${WP_PUSH_DEV} --remove ← take this branch back out\\n`;\n }\n\n /** Conflicted (unmerged-in-index) paths. Empty once every one has been resolved and `git add`ed. */\n private async unmergedPaths(repoRoot: string): Promise<string[]> {\n const out = await this.gitExec.gitQuery(['-C', repoRoot, 'diff', '--name-only', '--diff-filter=U'], repoRoot,\n 'Failed to list the conflicted files (git diff --name-only --diff-filter=U).');\n return out.split('\\n').filter((l: string): boolean => l.trim() !== '');\n }\n\n // The gate on `wp-finish-push-dev`: refuse (and re-print the list) while anything is still unmerged.\n private async assertNoUnmergedPaths(repoRoot: string, state: PushDevState): Promise<void> {\n const conflicted = await this.unmergedPaths(repoRoot);\n if (conflicted.length === 0) return;\n throw new CliExitError(2,\n '\\n' + SEP + '⛔ Conflicts are NOT resolved yet\\n' + SEP + '\\n'\n + `${WP_FINISH_PUSH_DEV} commits the resolution — it cannot write one for you. These files are still\\n`\n + 'unmerged (edit until no conflict markers remain, then `git add` each one):\\n'\n + conflicted.map((f: string): string => ` ${f}`).join('\\n') + '\\n\\n'\n + `Merging: ${state.current === '' ? '(none)' : state.current}\\n`\n + `Give up instead with: ${WP_FINISH_PUSH_DEV} --abort\\n`);\n }\n\n /**\n * The name of the throwaway branch for a resolve of `branch`.\n *\n * Suffixed rather than prefixed, matching the existing `<feature>Squash` / `<feature>PreMerge<n>`\n * convention — and deliberately NOT inside the dev namespace, which holds REMOTE copies only.\n */\n tmpBranchFor(branch: string): string {\n return `${branch}DevResolve`;\n }\n\n /** The banner `--resolve` prints before the first merge, so the queue is visible before it halts. */\n announce(cfg: DevDeployConfig, state: PushDevState): string {\n return '\\n' + SEP + `🔀 Resolving the dev composition for ${state.targetRef}\\n` + SEP + '\\n'\n + `Merging ${String(state.queue.length)} other cop${state.queue.length === 1 ? 'y' : 'ies'} from `\n + `\\`${cfg.copyRefGlob()}\\`, in the order your CI composes\\n\\`${cfg.devBranch}\\`, onto the throwaway branch `\n + `\\`${state.tmpBranch}\\`:\\n`\n + state.queue.map((r: string): string => ` ${r}`).join('\\n') + '\\n\\n'\n + `Your feature branch \\`${state.originalBranch}\\` is not touched by any of this.\\n`\n + 'A clean run publishes nothing (CI already composes it). A resolved conflict is published as your copy\\n'\n + 'plus ONE commit holding the resolved files — never a merge, so no other copy enters its history.\\n'\n + `${WP_FINISH_PUSH_DEV} is only needed if a merge stops.\\n\\n`;\n }\n\n /** The banner plain `wp-push-dev` prints before its check against dev (#1397). */\n announcePrebuild(cfg: DevDeployConfig, state: PushDevState): string {\n return '\\n' + SEP + `🔎 Checking ${state.targetRef} against origin/${cfg.devBranch} before publishing\\n` + SEP + '\\n'\n + `Merging origin/${cfg.devBranch} into the throwaway branch \\`${state.tmpBranch}\\`, then running\\n`\n + '`commands.push-dev.buildCommand` on the merged tree. Only if both pass is the copy published — as\\n'\n + 'your branch, plus ONE commit holding any resolved files. The merge itself is never published, so a\\n'\n + `later \\`${WP_PUSH_DEV} --remove\\` of somebody else's copy cannot leave it on dev through yours.\\n`\n + `Your feature branch \\`${state.originalBranch}\\` is not touched by any of this.\\n\\n`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dev-resolve-runner.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/dev-resolve-runner.ts"],"names":[],"mappings":";;;;AAAA,0DAA+G;AAC/G,8DAA6D;AAC7D,iEAA6D;AAC7D,yCAA2D;AAE3D,yCAAiD;AACjD,uDAAkD;AAClD,qDAAmE;AACnE,2CAAuC;AACvC,2DAA4E;AAC5E,iEAA8E;AAE9E,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE;;GAEG;AACU,QAAA,kBAAkB,GAAG,qCAAqC,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEJ;IACA;IACA;IACA;IACA;IACA;IACA;IAPrB,YACqB,OAAgB,EAChB,IAAmB,EACnB,KAAwB,EACxB,QAA8B,EAC9B,QAAkB,EAClB,SAA2B,EAC3B,YAAgC;QANhC,YAAO,GAAP,OAAO,CAAS;QAChB,SAAI,GAAJ,IAAI,CAAe;QACnB,UAAK,GAAL,KAAK,CAAmB;QACxB,aAAQ,GAAR,QAAQ,CAAsB;QAC9B,aAAQ,GAAR,QAA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AAmB;QAC9C,OAAO,IAAI,GAAG,GAAG,GAAG,eAAe,KAAK,CAAC,SAAS,mBAAmB,GAAG,CAAC,SAAS,IAAI,GAAG,GAAG,GAAG,IAAI;cAC7F,kBAAkB,GAAG,CAAC,SAAS,gCAAgC,KAAK,CAAC,SAAS,qCAAqC;cACnH,0GAA0G;cAC1G,wGAAwG;cACxG,qFAAqF;cACrF,+CAA+C,iCAAkB,oCAAoC;cACrG,2EAA2E;cAC3E,yBAAyB,KAAK,CAAC,cAAc,uCAAuC,CAAC;IAC/F,CAAC;CACJ,CAAA;AA1QY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGP,kBAAO;QACV,+BAAa;QACZ,kCAAiB;QACd,wCAAoB;QACpB,oBAAQ;QACP,iCAAgB;QACb,yCAAkB;GAR5C,gBAAgB,CA0Q5B","sourcesContent":["import { CliExitError, DevDeployConfig, WP_BUILD_PUSH_DEV, WP_FINISH_PUSH_DEV } from '@webpieces/rules-config';\nimport { NativeProcessApi } from '@webpieces/tooling-common';\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { GitExec, GitOutcome } from './git-exec';\nimport { DevDeployRefs } from './dev-deploy-refs';\nimport { PushDevState, PushDevStateStore } from './push-dev-state';\nimport { DevBuild } from './dev-build';\nimport { VerifiedDevCopy, VerifiedDevCopyStore } from './verified-dev-copy';\nimport { LandedCopyResolver, LandedResolution } from './landed-copy-resolver';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * The subject prefix of the ONE commit this flow writes onto a copy: the recorded conflict resolution.\n */\nexport const RESOLUTION_SUBJECT = 'Dev-deploy: conflict resolution for';\n\n/**\n * The engine behind `wp-build-push-dev`'s check against dev (#1403): merge `origin/<devBranch>` into a\n * THROWAWAY branch, take the publisher's side on conflicts caused only by copies already on main (#1405),\n * stop on any other conflict, `pnpm install`, run the dev build (compile + tests, no code rules), and record\n * the copy `wp-finish-push-dev` publishes.\n *\n * ONE class owns every git WRITE of the check, and that is a hard requirement rather than tidiness:\n * `redirect-how-to-merge-main` blocks `git merge` in every form INCLUDING `--continue`, and\n * `merge-in-progress-guard` blocks `git commit`. So an AI cannot be told \"now run `git commit`\" or\n * \"`git merge --continue`\" — those instructions are unrunnable by the only party reading them. The command\n * owns the merge and the commits (as child processes the hooks never see); the AI's entire job is editing\n * the conflicted files and `git add`-ing them, neither of which is blocked.\n *\n * It NEVER writes to the feature branch: every merge lands on a throwaway that is deleted at the end, so no\n * other developer's commits can reach the PR head even if the check is abandoned halfway.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class DevResolveRunner {\n constructor(\n private readonly gitExec: GitExec,\n private readonly refs: DevDeployRefs,\n private readonly store: PushDevStateStore,\n private readonly verified: VerifiedDevCopyStore,\n private readonly devBuild: DevBuild,\n private readonly processes: NativeProcessApi,\n private readonly landedCopies: LandedCopyResolver,\n ) {}\n\n /**\n * Start the check: park on a throwaway branch at the feature head, merge `origin/<devBranch>` into it,\n * and either halt on a conflict or go straight on to install, build and record.\n */\n async start(repoRoot: string, cfg: DevDeployConfig, state: PushDevState): Promise<void> {\n await this.refs.fetchCopies(repoRoot, [state.devBranch]);\n // Pinned to a SHA: the resolution is recorded on top of exactly what was merged, and stage ③\n // refuses to publish when the feature branch has moved since.\n state.baseSha = await this.refs.headSha(repoRoot, 'HEAD');\n this.store.write(repoRoot, state);\n await this.gitExec.runGitChecked(\n ['-C', repoRoot, 'checkout', '-B', state.tmpBranch, 'HEAD'],\n `Failed to create the throwaway branch ${state.tmpBranch}`);\n const merged = await this.gitExec.tryGit(\n ['-C', repoRoot, 'merge', '--no-ff', '--no-edit', '-m',\n `Dev-deploy: merge ${state.devBranch} into ${state.targetRef}`, `refs/remotes/origin/${state.devBranch}`],\n repoRoot);\n if (!merged.ok) await this.resolveLandedOrHalt(repoRoot, cfg, state, merged);\n process.stdout.write(` ✓ merged origin/${state.devBranch}\\n`);\n await this.finish(repoRoot, state);\n }\n\n /**\n * The merge conflicted. First take the publisher's side on every file whose dev side comes ONLY from\n * copies already on main (#1405, LandedCopyResolver); when that was every conflicted file, commit the\n * merge and carry on. Otherwise halt on what is left — the developer's job, as before.\n */\n private async resolveLandedOrHalt(\n repoRoot: string, cfg: DevDeployConfig, state: PushDevState, merged: GitOutcome,\n ): Promise<void> {\n const conflicted = await this.unmergedPaths(repoRoot);\n if (conflicted.length === 0) await this.mergeFailed(repoRoot, state, merged);\n const resolution = await this.landedCopies.resolve(repoRoot, cfg, conflicted);\n if (resolution.remaining.length > 0) await this.halt(repoRoot, state, resolution);\n process.stdout.write(this.landedCopies.describe(resolution));\n await this.gitExec.runGitChecked(['-C', repoRoot, 'commit', '--no-edit'],\n `Failed to commit the merge with origin/${state.devBranch} after resolving the landed copies' conflicts`);\n }\n\n /**\n * The merge failed WITHOUT leaving a conflicted file (an untracked file in the way, a broken ref, …).\n * There is nothing to resolve, so the checkout goes back to the feature branch and git's own words say why.\n */\n private async mergeFailed(repoRoot: string, state: PushDevState, merged: GitOutcome): Promise<never> {\n await this.restore(repoRoot, state);\n throw new CliExitError(1,\n '\\n' + SEP + `⛔ Merging origin/${state.devBranch} failed — and nothing conflicted\\n` + SEP + '\\n'\n + `git merge exited ${String(merged.status)} without leaving a conflicted file, so there is nothing to resolve.\\n`\n + 'What git said:\\n'\n + `${(merged.stderr + merged.stdout).trim()}\\n\\n`\n + `Nothing was built, recorded or published; you are back on \\`${state.originalBranch}\\`. Fix what git\\n`\n + `reported, then re-run: ${WP_BUILD_PUSH_DEV}\\n`);\n }\n\n /** Resume after the conflicted files were resolved and `git add`-ed: commit the merge, then finish. */\n async resume(repoRoot: string, state: PushDevState): Promise<void> {\n await this.assertNoUnmergedPaths(repoRoot);\n await this.gitExec.assertNoUntracked(repoRoot);\n await this.gitExec.runGitChecked(['-C', repoRoot, 'add', '-u'], 'Failed to stage the resolved files (git add -u)');\n await this.gitExec.runGitChecked(['-C', repoRoot, 'commit', '--no-edit'],\n `Failed to commit the resolution of the merge with origin/${state.devBranch}`);\n process.stdout.write(`✅ Committed the resolution of the merge with origin/${state.devBranch}.\\n`);\n await this.finish(repoRoot, state);\n }\n\n /**\n * Throw the whole check away: undo any halted merge, go back to the original branch, delete the\n * throwaway branch and the state file. Nothing verified, nothing on the feature branch.\n */\n async abort(repoRoot: string, state: PushDevState): Promise<void> {\n await this.restore(repoRoot, state);\n process.stdout.write(\n '\\n' + SEP + '🛑 Dev-deploy check aborted\\n' + SEP + '\\n'\n + `You are back on \\`${state.originalBranch}\\`; \\`${state.tmpBranch}\\` and the state file are gone.\\n`\n + `Nothing was published, and your feature branch is untouched.\\n`);\n }\n\n /** Stop with the conflicted files listed and the ONE command that continues. Exit 2 = \"your turn\". */\n private async halt(repoRoot: string, state: PushDevState, landed: LandedResolution): Promise<never> {\n const conflicted = landed.remaining;\n // Remembered so the finish records EXACTLY these files as the resolution — and nothing else the\n // merge brought in, which is other developers' work. Files resolved to the publisher's side\n // automatically are not among them: they hold what the base already has, so there is nothing to record.\n state.resolvedPaths = conflicted;\n this.store.write(repoRoot, state);\n throw new CliExitError(2,\n '\\n' + SEP + `⚠️ CONFLICT merging origin/${state.devBranch}\\n` + SEP + '\\n'\n + `You are on the throwaway branch \\`${state.tmpBranch}\\` — NOT \\`${state.originalBranch}\\`. Nothing here\\n`\n + 'can reach your feature branch or your PR, which is exactly why the resolution happens over here.\\n\\n'\n + 'Resolve these files (edit until no conflict markers remain, then `git add` each one):\\n'\n + conflicted.map((f: string): string => ` ${f}`).join('\\n') + '\\n'\n + this.landedCopies.describe(landed)\n + '\\nThen run ONE of:\\n'\n + ` ${WP_BUILD_PUSH_DEV} ← commit the resolution, pnpm install, run the dev build\\n`\n + ` ${WP_BUILD_PUSH_DEV} --abort ← throw it away and go back to \\`${state.originalBranch}\\`\\n\\n`\n + 'Do NOT run `git merge --continue`, `git commit` or `git push` yourself — they are blocked, and\\n'\n + 'the commands above do them for you.\\n');\n }\n\n /**\n * The merge is complete. Install and build the MERGED tree, then turn the throwaway into the copy and\n * record it for `wp-finish-push-dev`.\n *\n * `pnpm install` runs AFTER the merge, never before: other copies already on dev can add workspace\n * packages main does not have yet, so the feature branch's `node_modules` does not link the merged\n * tree (#1403 — a 30-commits-behind branch failed six minutes into its build on exactly that).\n */\n private async finish(repoRoot: string, state: PushDevState): Promise<void> {\n await this.onThrowaway(repoRoot, state, (): Promise<void> => this.install(repoRoot, state));\n await this.onThrowaway(repoRoot, state, (): Promise<void> => this.devBuild.run(repoRoot, WP_BUILD_PUSH_DEV));\n // The install may rewrite the lockfile on the throwaway; drop that before the throwaway moves.\n await this.gitExec.runGitChecked(['-C', repoRoot, 'reset', '--hard', 'HEAD'],\n `Failed to discard what pnpm install changed on ${state.tmpBranch}`);\n await this.recordResolution(repoRoot, state);\n const copySha = await this.refs.headSha(repoRoot, state.tmpBranch);\n await this.gitExec.runGitChecked(\n ['-C', repoRoot, 'update-ref', this.verified.keepRef(state.originalBranch), copySha],\n `Failed to keep the verified copy ${copySha.slice(0, 8)} reachable`);\n const devSha = await this.refs.headSha(repoRoot, `refs/remotes/origin/${state.devBranch}`);\n this.verified.write(repoRoot, new VerifiedDevCopy(\n state.originalBranch, state.baseSha, copySha, state.targetRef, state.leaseSha, devSha));\n await this.restore(repoRoot, state);\n process.stdout.write(this.verifiedBanner(state, devSha));\n }\n\n private async install(repoRoot: string, state: PushDevState): Promise<void> {\n process.stdout.write(`\\nRunning pnpm install on the merged throwaway \\`${state.tmpBranch}\\`.\\n`);\n const result = await this.processes.passThrough('pnpm', ['install'], repoRoot);\n if (result.ok) return;\n throw new CliExitError(1,\n '\\n' + SEP + `⛔ pnpm install failed on the merge with origin/${state.devBranch}\\n` + SEP + '\\n'\n + `\\`pnpm install\\` exited ${String(result.code)} on the merged tree (its output is above). No build ran and\\n`\n + `nothing was verified; you are back on \\`${state.originalBranch}\\`. Fix what it reported, then re-run:\\n`\n + ` ${WP_BUILD_PUSH_DEV}\\n`);\n }\n\n /**\n * Run one step on the throwaway. On a failure, put the checkout back first — the fix belongs on the\n * feature branch, and a developer left parked on a throwaway would make the next `wp-*` command act on\n * the wrong branch — then let the step's own failure (a build's carries its `FullLog :` pointer) reach\n * the top-level handler unchanged.\n */\n private async onThrowaway(repoRoot: string, state: PushDevState, step: () => Promise<void>): Promise<void> {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: the checkout must be restored whether or not the step passed; the step's own error is re-thrown unchanged\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n await step();\n } catch (err: unknown) {\n const error = toError(err);\n await this.restore(repoRoot, state);\n throw error;\n }\n }\n\n /**\n * Turn the throwaway into the copy: the base sha plus, when anything conflicted, ONE commit that sets\n * each resolved file to its resolved content.\n *\n * The merge is used for the conflict check and the build only, and is never published. Publishing it\n * would make every other copy an ancestor of this one, so a later `--remove` of that copy would leave\n * its commits on dev through ours. The resolution commit has exactly one parent, the base, so the only\n * thing it can carry of anybody else's work is the text of the hunks that were resolved — content,\n * never history.\n */\n private async recordResolution(repoRoot: string, state: PushDevState): Promise<void> {\n const merged = await this.refs.headSha(repoRoot, state.tmpBranch);\n await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', '-B', state.tmpBranch, state.baseSha],\n `Failed to move ${state.tmpBranch} back to ${state.baseSha.slice(0, 8)} to record the resolution`);\n if (state.resolvedPaths.length === 0) return;\n for (const file of state.resolvedPaths) {\n const inMerge = await this.gitExec.tryGit(['-C', repoRoot, 'cat-file', '-e', `${merged}:${file}`], repoRoot);\n await this.gitExec.runGitChecked(\n inMerge.ok\n ? ['-C', repoRoot, 'checkout', merged, '--', file]\n : ['-C', repoRoot, 'rm', '-q', '--ignore-unmatch', '--', file],\n `Failed to record the resolution of ${file}`);\n }\n // Resolved to exactly what the base already had (\"keep mine\") is a resolution with nothing to record.\n const unchanged = await this.gitExec.tryGit(['-C', repoRoot, 'diff', '--cached', '--quiet'], repoRoot);\n if (unchanged.ok) return;\n await this.gitExec.runGitChecked(['-C', repoRoot, 'commit', '-m',\n `${RESOLUTION_SUBJECT} ${state.targetRef}\\n\\n`\n + 'This commit carries only the files that conflicted and were resolved:\\n'\n + state.resolvedPaths.map((f: string): string => ` ${f}`).join('\\n') + '\\n'],\n `Failed to commit the recorded resolution for ${state.targetRef}`);\n }\n\n /** Back to the original branch; any halted merge, the throwaway and the state file are gone. */\n private async restore(repoRoot: string, state: PushDevState): Promise<void> {\n // Only ever on the throwaway: a reset anywhere else could destroy somebody's uncommitted work.\n // Both allowed to fail: there is no merge to abort once it completed, and nothing to reset on a\n // clean tree. Neither is an error — the rest of the teardown must still run.\n if (await this.gitExec.currentBranch(repoRoot) === state.tmpBranch) {\n await this.gitExec.tryGit(['-C', repoRoot, 'merge', '--abort'], repoRoot);\n await this.gitExec.tryGit(['-C', repoRoot, 'reset', '--hard', 'HEAD'], repoRoot);\n }\n await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', state.originalBranch],\n `Failed to return to ${state.originalBranch}`);\n await this.gitExec.tryGit(['-C', repoRoot, 'branch', '-D', state.tmpBranch], repoRoot);\n this.store.clear(repoRoot);\n }\n\n private verifiedBanner(state: PushDevState, devSha: string): string {\n const what = state.resolvedPaths.length === 0\n ? 'your branch exactly as it is'\n : `your branch plus ONE commit recording the resolution of ${String(state.resolvedPaths.length)} file(s) — no merge, so no other copy becomes part of its history`;\n return '\\n' + SEP + `✅ ${state.targetRef} is verified against origin/${state.devBranch}\\n` + SEP + '\\n'\n + `It merges with origin/${state.devBranch} (${devSha.slice(0, 8)}), pnpm install ran on the merged tree, and the dev\\n`\n + `build is green. The copy to publish is ${what}.\\n`\n + `You are back on \\`${state.originalBranch}\\`, which this check never modified.\\n\\n`\n + `▶ NEXT run: ${WP_FINISH_PUSH_DEV}\\n`\n + ` It publishes the verified copy as \\`${state.targetRef}\\`. It refuses if \\`${state.originalBranch}\\`\\n`\n + ' moves before then — a new commit means a new check.\\n';\n }\n\n /** Conflicted (unmerged-in-index) paths. Empty once every one has been resolved and `git add`ed. */\n private async unmergedPaths(repoRoot: string): Promise<string[]> {\n const out = await this.gitExec.gitQuery(['-C', repoRoot, 'diff', '--name-only', '--diff-filter=U'], repoRoot,\n 'Failed to list the conflicted files (git diff --name-only --diff-filter=U).');\n return out.split('\\n').filter((l: string): boolean => l.trim() !== '');\n }\n\n // The gate on resuming: refuse (and re-print the list) while anything is still unmerged.\n private async assertNoUnmergedPaths(repoRoot: string): Promise<void> {\n const conflicted = await this.unmergedPaths(repoRoot);\n if (conflicted.length === 0) return;\n throw new CliExitError(2,\n '\\n' + SEP + '⛔ Conflicts are NOT resolved yet\\n' + SEP + '\\n'\n + `${WP_BUILD_PUSH_DEV} commits the resolution — it cannot write one for you. These files are still\\n`\n + 'unmerged (edit until no conflict markers remain, then `git add` each one):\\n'\n + conflicted.map((f: string): string => ` ${f}`).join('\\n') + '\\n\\n'\n + `Give up instead with: ${WP_BUILD_PUSH_DEV} --abort\\n`);\n }\n\n /**\n * The name of the throwaway branch for a check of `branch`.\n *\n * Suffixed rather than prefixed, matching the existing `<feature>Squash` / `<feature>PreMerge<n>`\n * convention — and deliberately NOT inside the dev namespace, which holds REMOTE copies only.\n */\n tmpBranchFor(branch: string): string {\n return `${branch}DevResolve`;\n }\n\n /** The banner `wp-build-push-dev` prints before its check against dev. */\n announce(cfg: DevDeployConfig, state: PushDevState): string {\n return '\\n' + SEP + `🔎 Checking ${state.targetRef} against origin/${cfg.devBranch}\\n` + SEP + '\\n'\n + `Merging origin/${cfg.devBranch} into the throwaway branch \\`${state.tmpBranch}\\`, then running \\`pnpm install\\`\\n`\n + 'and `commands.push-dev.buildCommand` (compile + tests only — the code rules already judged your branch\\n'\n + 'against main, and must never judge the other copies on dev) on the merged tree. A conflict whose dev\\n'\n + 'side comes only from copies already on origin/main takes your side automatically.\\n'\n + `Nothing is published here — when both pass, ${WP_FINISH_PUSH_DEV} publishes your branch, plus ONE\\n`\n + 'commit holding any resolved files. The merge itself is never published.\\n'\n + `Your feature branch \\`${state.originalBranch}\\` is not touched by any of this.\\n\\n`;\n }\n}\n"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DevDeployConfig } from '@webpieces/rules-config';
|
|
2
|
+
import { GitExec } from './git-exec';
|
|
3
|
+
import { DevDeployRefs } from './dev-deploy-refs';
|
|
4
|
+
import { DevCopyOnMain } from './dev-copy-on-main';
|
|
5
|
+
/**
|
|
6
|
+
* One conflicted file resolved automatically, and the landed copies whose old version of it was
|
|
7
|
+
* overridden. Data-only per CLAUDE.md.
|
|
8
|
+
*/
|
|
9
|
+
export declare class LandedOverride {
|
|
10
|
+
readonly file: string;
|
|
11
|
+
/** The copy refs (`dev-include/<branch>`) whose dev-side version of `file` was overridden. */
|
|
12
|
+
readonly copies: string[];
|
|
13
|
+
constructor(file: string,
|
|
14
|
+
/** The copy refs (`dev-include/<branch>`) whose dev-side version of `file` was overridden. */
|
|
15
|
+
copies: string[]);
|
|
16
|
+
}
|
|
17
|
+
/** What {@link LandedCopyResolver.resolve} did: what it took the publisher's side on, and what is left. Data-only. */
|
|
18
|
+
export declare class LandedResolution {
|
|
19
|
+
readonly overridden: LandedOverride[];
|
|
20
|
+
/** The conflicted files nothing could prove safe to resolve automatically — the developer's job. */
|
|
21
|
+
readonly remaining: string[];
|
|
22
|
+
constructor(overridden: LandedOverride[],
|
|
23
|
+
/** The conflicted files nothing could prove safe to resolve automatically — the developer's job. */
|
|
24
|
+
remaining: string[]);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the conflicts of `wp-build-push-dev`'s dev merge that are caused ONLY by copies already on main
|
|
28
|
+
* (#1405), by taking the publisher's side.
|
|
29
|
+
*
|
|
30
|
+
* THE SHAPE IT CURES: a copy is published to dev, then its branch lands on main with DIFFERENT content
|
|
31
|
+
* (review commits, then a squash). `dev` still holds the published version of those lines, every branch cut
|
|
32
|
+
* from the latest main carries the landed version, and so every new publish conflicts in the same files —
|
|
33
|
+
* the landed copy's old version against its own final version, with nobody's own change involved.
|
|
34
|
+
*
|
|
35
|
+
* WHY THE PUBLISHER'S SIDE IS RIGHT: the publisher's branch contains the latest `origin/main` (stage ②
|
|
36
|
+
* refuses one that does not), so it already carries the landed copy's FINAL version of the file. Taking it
|
|
37
|
+
* loses nothing, and the copy's content is unchanged, so nothing is redeployed. Dropping landed copies when
|
|
38
|
+
* dev is composed would also cure it, but that is a recompose — a full redeploy (#1401).
|
|
39
|
+
*
|
|
40
|
+
* WHEN IT ACTS, per conflicted file: every live copy that changes the file (relative to its merge-base with
|
|
41
|
+
* `origin/main`) is superseded by main — its branch has a merged PR, or main already holds the copy's content
|
|
42
|
+
* of that file. One copy that is NOT on main, or no copy at all explaining the dev side, and the file is left
|
|
43
|
+
* for the developer, exactly as before: that conflict is somebody's live work.
|
|
44
|
+
*/
|
|
45
|
+
export declare class LandedCopyResolver {
|
|
46
|
+
private readonly gitExec;
|
|
47
|
+
private readonly refs;
|
|
48
|
+
private readonly onMain;
|
|
49
|
+
constructor(gitExec: GitExec, refs: DevDeployRefs, onMain: DevCopyOnMain);
|
|
50
|
+
/** Resolve what it can (taking HEAD's side, then `git add`), and return what it did and what remains. */
|
|
51
|
+
resolve(repoRoot: string, cfg: DevDeployConfig, conflicted: string[]): Promise<LandedResolution>;
|
|
52
|
+
/** The report line block for what was overridden; '' when nothing was. */
|
|
53
|
+
describe(resolution: LandedResolution): string;
|
|
54
|
+
private copiesTouching;
|
|
55
|
+
private takePublishersSide;
|
|
56
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LandedCopyResolver = exports.LandedResolution = exports.LandedOverride = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const git_exec_1 = require("./git-exec");
|
|
7
|
+
const dev_deploy_refs_1 = require("./dev-deploy-refs");
|
|
8
|
+
const dev_copy_on_main_1 = require("./dev-copy-on-main");
|
|
9
|
+
/**
|
|
10
|
+
* One conflicted file resolved automatically, and the landed copies whose old version of it was
|
|
11
|
+
* overridden. Data-only per CLAUDE.md.
|
|
12
|
+
*/
|
|
13
|
+
class LandedOverride {
|
|
14
|
+
file;
|
|
15
|
+
copies;
|
|
16
|
+
constructor(file,
|
|
17
|
+
/** The copy refs (`dev-include/<branch>`) whose dev-side version of `file` was overridden. */
|
|
18
|
+
copies) {
|
|
19
|
+
this.file = file;
|
|
20
|
+
this.copies = copies;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.LandedOverride = LandedOverride;
|
|
24
|
+
/** What {@link LandedCopyResolver.resolve} did: what it took the publisher's side on, and what is left. Data-only. */
|
|
25
|
+
class LandedResolution {
|
|
26
|
+
overridden;
|
|
27
|
+
remaining;
|
|
28
|
+
constructor(overridden,
|
|
29
|
+
/** The conflicted files nothing could prove safe to resolve automatically — the developer's job. */
|
|
30
|
+
remaining) {
|
|
31
|
+
this.overridden = overridden;
|
|
32
|
+
this.remaining = remaining;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.LandedResolution = LandedResolution;
|
|
36
|
+
/** One live copy and how it relates to `origin/main`, computed once per resolve. Data-only. */
|
|
37
|
+
class CopyOnMain {
|
|
38
|
+
copy;
|
|
39
|
+
landing;
|
|
40
|
+
branchLanded;
|
|
41
|
+
constructor(copy, landing,
|
|
42
|
+
/** The copy's branch has a MERGED PR — it landed, possibly with different content (review, squash). */
|
|
43
|
+
branchLanded) {
|
|
44
|
+
this.copy = copy;
|
|
45
|
+
this.landing = landing;
|
|
46
|
+
this.branchLanded = branchLanded;
|
|
47
|
+
}
|
|
48
|
+
/** Is the copy's version of `file` superseded by main — its branch landed, or main already carries it? */
|
|
49
|
+
supersededOn(file) {
|
|
50
|
+
return this.branchLanded || this.landing.landed.includes(file);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Resolves the conflicts of `wp-build-push-dev`'s dev merge that are caused ONLY by copies already on main
|
|
55
|
+
* (#1405), by taking the publisher's side.
|
|
56
|
+
*
|
|
57
|
+
* THE SHAPE IT CURES: a copy is published to dev, then its branch lands on main with DIFFERENT content
|
|
58
|
+
* (review commits, then a squash). `dev` still holds the published version of those lines, every branch cut
|
|
59
|
+
* from the latest main carries the landed version, and so every new publish conflicts in the same files —
|
|
60
|
+
* the landed copy's old version against its own final version, with nobody's own change involved.
|
|
61
|
+
*
|
|
62
|
+
* WHY THE PUBLISHER'S SIDE IS RIGHT: the publisher's branch contains the latest `origin/main` (stage ②
|
|
63
|
+
* refuses one that does not), so it already carries the landed copy's FINAL version of the file. Taking it
|
|
64
|
+
* loses nothing, and the copy's content is unchanged, so nothing is redeployed. Dropping landed copies when
|
|
65
|
+
* dev is composed would also cure it, but that is a recompose — a full redeploy (#1401).
|
|
66
|
+
*
|
|
67
|
+
* WHEN IT ACTS, per conflicted file: every live copy that changes the file (relative to its merge-base with
|
|
68
|
+
* `origin/main`) is superseded by main — its branch has a merged PR, or main already holds the copy's content
|
|
69
|
+
* of that file. One copy that is NOT on main, or no copy at all explaining the dev side, and the file is left
|
|
70
|
+
* for the developer, exactly as before: that conflict is somebody's live work.
|
|
71
|
+
*/
|
|
72
|
+
let LandedCopyResolver = class LandedCopyResolver {
|
|
73
|
+
gitExec;
|
|
74
|
+
refs;
|
|
75
|
+
onMain;
|
|
76
|
+
constructor(gitExec, refs, onMain) {
|
|
77
|
+
this.gitExec = gitExec;
|
|
78
|
+
this.refs = refs;
|
|
79
|
+
this.onMain = onMain;
|
|
80
|
+
}
|
|
81
|
+
/** Resolve what it can (taking HEAD's side, then `git add`), and return what it did and what remains. */
|
|
82
|
+
async resolve(repoRoot, cfg, conflicted) {
|
|
83
|
+
const copies = await this.refs.liveCopies(repoRoot, cfg);
|
|
84
|
+
await this.refs.fetchCopies(repoRoot, copies.map((c) => c.ref));
|
|
85
|
+
const touching = await this.copiesTouching(repoRoot, copies, conflicted);
|
|
86
|
+
const overridden = [];
|
|
87
|
+
const remaining = [];
|
|
88
|
+
for (const file of conflicted) {
|
|
89
|
+
const contributors = touching.filter((c) => c.landing.changed.includes(file));
|
|
90
|
+
const allLanded = contributors.length > 0
|
|
91
|
+
&& contributors.every((c) => c.supersededOn(file));
|
|
92
|
+
if (!allLanded) {
|
|
93
|
+
remaining.push(file);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
await this.takePublishersSide(repoRoot, file);
|
|
97
|
+
overridden.push(new LandedOverride(file, contributors.map((c) => c.copy.ref)));
|
|
98
|
+
}
|
|
99
|
+
return new LandedResolution(overridden, remaining);
|
|
100
|
+
}
|
|
101
|
+
/** The report line block for what was overridden; '' when nothing was. */
|
|
102
|
+
describe(resolution) {
|
|
103
|
+
if (resolution.overridden.length === 0)
|
|
104
|
+
return '';
|
|
105
|
+
return '\nResolved automatically — the dev side came only from copies already on origin/main, so your\n'
|
|
106
|
+
+ "branch (which carries main's final version) was taken:\n"
|
|
107
|
+
+ resolution.overridden.map((o) => ` ${o.file} ← overrode ${o.copies.join(', ')}`).join('\n')
|
|
108
|
+
+ '\n';
|
|
109
|
+
}
|
|
110
|
+
// Only the copies that change at least one conflicted file matter; the merged-PR lookup is paid for those only.
|
|
111
|
+
async copiesTouching(repoRoot, copies, conflicted) {
|
|
112
|
+
const touching = [];
|
|
113
|
+
for (const copy of copies) {
|
|
114
|
+
const landing = await this.onMain.landing(repoRoot, copy.ref);
|
|
115
|
+
if (!landing.changed.some((f) => conflicted.includes(f)))
|
|
116
|
+
continue;
|
|
117
|
+
const pr = await this.onMain.mergedPr(repoRoot, copy.sourceBranch);
|
|
118
|
+
touching.push(new CopyOnMain(copy, landing, pr !== null));
|
|
119
|
+
}
|
|
120
|
+
return touching;
|
|
121
|
+
}
|
|
122
|
+
// HEAD is the throwaway, i.e. the publisher's branch. A file HEAD deleted stays deleted.
|
|
123
|
+
async takePublishersSide(repoRoot, file) {
|
|
124
|
+
const inHead = await this.gitExec.tryGit(['-C', repoRoot, 'cat-file', '-e', `HEAD:${file}`], repoRoot);
|
|
125
|
+
const args = inHead.ok
|
|
126
|
+
? ['-C', repoRoot, 'checkout', '--ours', '--', file]
|
|
127
|
+
: ['-C', repoRoot, 'rm', '-q', '--ignore-unmatch', '--', file];
|
|
128
|
+
await this.gitExec.runGitChecked(args, `Failed to take your branch's side of ${file}`);
|
|
129
|
+
if (inHead.ok) {
|
|
130
|
+
await this.gitExec.runGitChecked(['-C', repoRoot, 'add', '--', file], `Failed to stage the resolution of ${file}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
exports.LandedCopyResolver = LandedCopyResolver;
|
|
135
|
+
exports.LandedCopyResolver = LandedCopyResolver = tslib_1.__decorate([
|
|
136
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
137
|
+
tslib_1.__metadata("design:paramtypes", [git_exec_1.GitExec,
|
|
138
|
+
dev_deploy_refs_1.DevDeployRefs,
|
|
139
|
+
dev_copy_on_main_1.DevCopyOnMain])
|
|
140
|
+
], LandedCopyResolver);
|
|
141
|
+
//# sourceMappingURL=landed-copy-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"landed-copy-resolver.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/landed-copy-resolver.ts"],"names":[],"mappings":";;;;AACA,yCAA2D;AAE3D,yCAAqC;AACrC,uDAA2D;AAC3D,yDAAmE;AAEnE;;;GAGG;AACH,MAAa,cAAc;IAEV;IAEA;IAHb,YACa,IAAY;IACrB,8FAA8F;IACrF,MAAgB;QAFhB,SAAI,GAAJ,IAAI,CAAQ;QAEZ,WAAM,GAAN,MAAM,CAAU;IAC1B,CAAC;CACP;AAND,wCAMC;AAED,sHAAsH;AACtH,MAAa,gBAAgB;IAEZ;IAEA;I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,EAAE,CAAC,CAAC;QACvF,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,qCAAqC,IAAI,EAAE,CAAC,CAAC;QACvH,CAAC;IACL,CAAC;CACJ,CAAA;AA5DY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGP,kBAAO;QACV,+BAAa;QACX,gCAAa;GAJjC,kBAAkB,CA4D9B","sourcesContent":["import { DevDeployConfig } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { GitExec } from './git-exec';\nimport { DevCopy, DevDeployRefs } from './dev-deploy-refs';\nimport { DevCopyLanding, DevCopyOnMain } from './dev-copy-on-main';\n\n/**\n * One conflicted file resolved automatically, and the landed copies whose old version of it was\n * overridden. Data-only per CLAUDE.md.\n */\nexport class LandedOverride {\n constructor(\n readonly file: string,\n /** The copy refs (`dev-include/<branch>`) whose dev-side version of `file` was overridden. */\n readonly copies: string[],\n ) {}\n}\n\n/** What {@link LandedCopyResolver.resolve} did: what it took the publisher's side on, and what is left. Data-only. */\nexport class LandedResolution {\n constructor(\n readonly overridden: LandedOverride[],\n /** The conflicted files nothing could prove safe to resolve automatically — the developer's job. */\n readonly remaining: string[],\n ) {}\n}\n\n/** One live copy and how it relates to `origin/main`, computed once per resolve. Data-only. */\nclass CopyOnMain {\n constructor(\n readonly copy: DevCopy,\n readonly landing: DevCopyLanding,\n /** The copy's branch has a MERGED PR — it landed, possibly with different content (review, squash). */\n readonly branchLanded: boolean,\n ) {}\n\n /** Is the copy's version of `file` superseded by main — its branch landed, or main already carries it? */\n supersededOn(file: string): boolean {\n return this.branchLanded || this.landing.landed.includes(file);\n }\n}\n\n/**\n * Resolves the conflicts of `wp-build-push-dev`'s dev merge that are caused ONLY by copies already on main\n * (#1405), by taking the publisher's side.\n *\n * THE SHAPE IT CURES: a copy is published to dev, then its branch lands on main with DIFFERENT content\n * (review commits, then a squash). `dev` still holds the published version of those lines, every branch cut\n * from the latest main carries the landed version, and so every new publish conflicts in the same files —\n * the landed copy's old version against its own final version, with nobody's own change involved.\n *\n * WHY THE PUBLISHER'S SIDE IS RIGHT: the publisher's branch contains the latest `origin/main` (stage ②\n * refuses one that does not), so it already carries the landed copy's FINAL version of the file. Taking it\n * loses nothing, and the copy's content is unchanged, so nothing is redeployed. Dropping landed copies when\n * dev is composed would also cure it, but that is a recompose — a full redeploy (#1401).\n *\n * WHEN IT ACTS, per conflicted file: every live copy that changes the file (relative to its merge-base with\n * `origin/main`) is superseded by main — its branch has a merged PR, or main already holds the copy's content\n * of that file. One copy that is NOT on main, or no copy at all explaining the dev side, and the file is left\n * for the developer, exactly as before: that conflict is somebody's live work.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class LandedCopyResolver {\n constructor(\n private readonly gitExec: GitExec,\n private readonly refs: DevDeployRefs,\n private readonly onMain: DevCopyOnMain,\n ) {}\n\n /** Resolve what it can (taking HEAD's side, then `git add`), and return what it did and what remains. */\n async resolve(repoRoot: string, cfg: DevDeployConfig, conflicted: string[]): Promise<LandedResolution> {\n const copies = await this.refs.liveCopies(repoRoot, cfg);\n await this.refs.fetchCopies(repoRoot, copies.map((c: DevCopy): string => c.ref));\n const touching = await this.copiesTouching(repoRoot, copies, conflicted);\n const overridden: LandedOverride[] = [];\n const remaining: string[] = [];\n for (const file of conflicted) {\n const contributors = touching.filter((c: CopyOnMain): boolean => c.landing.changed.includes(file));\n const allLanded = contributors.length > 0\n && contributors.every((c: CopyOnMain): boolean => c.supersededOn(file));\n if (!allLanded) {\n remaining.push(file);\n continue;\n }\n await this.takePublishersSide(repoRoot, file);\n overridden.push(new LandedOverride(file, contributors.map((c: CopyOnMain): string => c.copy.ref)));\n }\n return new LandedResolution(overridden, remaining);\n }\n\n /** The report line block for what was overridden; '' when nothing was. */\n describe(resolution: LandedResolution): string {\n if (resolution.overridden.length === 0) return '';\n return '\\nResolved automatically — the dev side came only from copies already on origin/main, so your\\n'\n + \"branch (which carries main's final version) was taken:\\n\"\n + resolution.overridden.map((o: LandedOverride): string => ` ${o.file} ← overrode ${o.copies.join(', ')}`).join('\\n')\n + '\\n';\n }\n\n // Only the copies that change at least one conflicted file matter; the merged-PR lookup is paid for those only.\n private async copiesTouching(repoRoot: string, copies: DevCopy[], conflicted: string[]): Promise<CopyOnMain[]> {\n const touching: CopyOnMain[] = [];\n for (const copy of copies) {\n const landing = await this.onMain.landing(repoRoot, copy.ref);\n if (!landing.changed.some((f: string): boolean => conflicted.includes(f))) continue;\n const pr = await this.onMain.mergedPr(repoRoot, copy.sourceBranch);\n touching.push(new CopyOnMain(copy, landing, pr !== null));\n }\n return touching;\n }\n\n // HEAD is the throwaway, i.e. the publisher's branch. A file HEAD deleted stays deleted.\n private async takePublishersSide(repoRoot: string, file: string): Promise<void> {\n const inHead = await this.gitExec.tryGit(['-C', repoRoot, 'cat-file', '-e', `HEAD:${file}`], repoRoot);\n const args = inHead.ok\n ? ['-C', repoRoot, 'checkout', '--ours', '--', file]\n : ['-C', repoRoot, 'rm', '-q', '--ignore-unmatch', '--', file];\n await this.gitExec.runGitChecked(args, `Failed to take your branch's side of ${file}`);\n if (inHead.ok) {\n await this.gitExec.runGitChecked(['-C', repoRoot, 'add', '--', file], `Failed to stage the resolution of ${file}`);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GitExec } from './git-exec';
|
|
2
|
+
/**
|
|
3
|
+
* "Does this branch already contain the latest `origin/main`?" — the question both ends of the dev-deploy
|
|
4
|
+
* flow ask (#1403). `wp-start-push-dev` asks it to decide whether to run the 3-point merge at all (it runs
|
|
5
|
+
* ONLY when the branch is behind), and `wp-build-push-dev` asks it to refuse a copy built from a stale
|
|
6
|
+
* fork point: such a copy builds against a `node_modules` missing whatever main added since, while dev
|
|
7
|
+
* already contains it.
|
|
8
|
+
*
|
|
9
|
+
* Always FETCHES first. A local `origin/main` from last week answers "contains main" confidently and
|
|
10
|
+
* wrongly, which is the exact staleness this check exists to catch.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MainFreshness {
|
|
13
|
+
private readonly gitExec;
|
|
14
|
+
constructor(gitExec: GitExec);
|
|
15
|
+
containsLatestMain(repoRoot: string): Promise<boolean>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MainFreshness = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const git_exec_1 = require("./git-exec");
|
|
7
|
+
/**
|
|
8
|
+
* "Does this branch already contain the latest `origin/main`?" — the question both ends of the dev-deploy
|
|
9
|
+
* flow ask (#1403). `wp-start-push-dev` asks it to decide whether to run the 3-point merge at all (it runs
|
|
10
|
+
* ONLY when the branch is behind), and `wp-build-push-dev` asks it to refuse a copy built from a stale
|
|
11
|
+
* fork point: such a copy builds against a `node_modules` missing whatever main added since, while dev
|
|
12
|
+
* already contains it.
|
|
13
|
+
*
|
|
14
|
+
* Always FETCHES first. A local `origin/main` from last week answers "contains main" confidently and
|
|
15
|
+
* wrongly, which is the exact staleness this check exists to catch.
|
|
16
|
+
*/
|
|
17
|
+
let MainFreshness = class MainFreshness {
|
|
18
|
+
gitExec;
|
|
19
|
+
constructor(gitExec) {
|
|
20
|
+
this.gitExec = gitExec;
|
|
21
|
+
}
|
|
22
|
+
async containsLatestMain(repoRoot) {
|
|
23
|
+
await this.gitExec.runGitChecked(['-C', repoRoot, 'fetch', 'origin', '+refs/heads/main:refs/remotes/origin/main'], 'Failed to fetch origin/main to check whether this branch is up to date with it');
|
|
24
|
+
const contains = await this.gitExec.tryGit(['-C', repoRoot, 'merge-base', '--is-ancestor', 'refs/remotes/origin/main', 'HEAD'], repoRoot);
|
|
25
|
+
return contains.ok;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.MainFreshness = MainFreshness;
|
|
29
|
+
exports.MainFreshness = MainFreshness = tslib_1.__decorate([
|
|
30
|
+
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
31
|
+
tslib_1.__metadata("design:paramtypes", [git_exec_1.GitExec])
|
|
32
|
+
], MainFreshness);
|
|
33
|
+
//# sourceMappingURL=main-freshness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main-freshness.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/main-freshness.ts"],"names":[],"mappings":";;;;AAAA,yCAA2D;AAE3D,yCAAqC;AAErC;;;;;;;;;GASG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAa;IACO;IAA7B,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEjD,KAAK,CAAC,kBAAkB,CAAC,QAAgB;QACrC,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,2CAA2C,CAAC,EAC7G,gFAAgF,CAAC,CAAC;QACtF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CACtC,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;QACnG,OAAO,QAAQ,CAAC,EAAE,CAAC;IACvB,CAAC;CACJ,CAAA;AAVY,sCAAa;wBAAb,aAAa;IADzB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEC,kBAAO;GADpC,aAAa,CAUzB","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\n\nimport { GitExec } from './git-exec';\n\n/**\n * \"Does this branch already contain the latest `origin/main`?\" — the question both ends of the dev-deploy\n * flow ask (#1403). `wp-start-push-dev` asks it to decide whether to run the 3-point merge at all (it runs\n * ONLY when the branch is behind), and `wp-build-push-dev` asks it to refuse a copy built from a stale\n * fork point: such a copy builds against a `node_modules` missing whatever main added since, while dev\n * already contains it.\n *\n * Always FETCHES first. A local `origin/main` from last week answers \"contains main\" confidently and\n * wrongly, which is the exact staleness this check exists to catch.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class MainFreshness {\n constructor(private readonly gitExec: GitExec) {}\n\n async containsLatestMain(repoRoot: string): Promise<boolean> {\n await this.gitExec.runGitChecked(['-C', repoRoot, 'fetch', 'origin', '+refs/heads/main:refs/remotes/origin/main'],\n 'Failed to fetch origin/main to check whether this branch is up to date with it');\n const contains = await this.gitExec.tryGit(\n ['-C', repoRoot, 'merge-base', '--is-ancestor', 'refs/remotes/origin/main', 'HEAD'], repoRoot);\n return contains.ok;\n }\n}\n"]}
|
|
@@ -1,53 +1,30 @@
|
|
|
1
1
|
import { DotWebpieces } from '@webpieces/tooling-common';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The persisted half of `wp-build-push-dev`'s conflict halt (#1403).
|
|
4
4
|
*
|
|
5
|
-
* -
|
|
6
|
-
* on the merged tree, and what is published is the feature head PLUS one commit recording the resolved
|
|
7
|
-
* files. The merge itself is never published.
|
|
8
|
-
* - `COMPOSE` — `wp-push-dev --resolve`: the other copies are merged into a throwaway, and what is
|
|
9
|
-
* published is the existing copy PLUS one commit recording the resolved files — never a merge parent,
|
|
10
|
-
* so no other copy becomes an ancestor of this one and a later `--remove` of it really takes it off dev.
|
|
11
|
-
* - `REPLAY` — `wp-push-dev --rebase-resolution`: the published copy is merged into the new local head
|
|
12
|
-
* and that merge IS what is published, so the copy's own resolution survives the new commits.
|
|
13
|
-
*/
|
|
14
|
-
export declare enum DevResolveMode {
|
|
15
|
-
PREBUILD = "prebuild",
|
|
16
|
-
COMPOSE = "compose",
|
|
17
|
-
REPLAY = "replay"
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* The persisted half of the `wp-push-dev --resolve` state machine.
|
|
21
|
-
*
|
|
22
|
-
* A single-shot wrapper is IMPOSSIBLE here and that is why this file exists: `git merge` halts on
|
|
5
|
+
* A single-shot command is IMPOSSIBLE here and that is why this file exists: `git merge` halts on
|
|
23
6
|
* conflict with markers in the working tree and a non-zero exit, and a human or an AI has to edit files
|
|
24
7
|
* before anything can be committed. So the command must be able to stop, hand the tree over, and be
|
|
25
|
-
* resumed by a
|
|
8
|
+
* resumed — by a re-run of itself — knowing exactly where it left off.
|
|
26
9
|
*
|
|
27
10
|
* Data-only (per CLAUDE.md) — the behaviour lives in {@link PushDevStateStore}.
|
|
28
11
|
*/
|
|
29
12
|
export declare class PushDevState {
|
|
30
|
-
/** The branch to return to when the
|
|
13
|
+
/** The branch to return to when the check finishes or aborts. NEVER written to by this flow. */
|
|
31
14
|
originalBranch: string;
|
|
32
|
-
/** The local throwaway branch the
|
|
15
|
+
/** The local throwaway branch the dev merge happens on. Deleted on finish and on abort. */
|
|
33
16
|
tmpBranch: string;
|
|
34
|
-
/** `<namespace>/<originalBranch>` — the remote copy
|
|
17
|
+
/** `<namespace>/<originalBranch>` — the remote copy `wp-finish-push-dev` will publish. */
|
|
35
18
|
targetRef: string;
|
|
36
|
-
/** The
|
|
37
|
-
|
|
38
|
-
/** The
|
|
39
|
-
current: string;
|
|
40
|
-
/** What the finish publishes — see DevResolveMode. */
|
|
41
|
-
mode: DevResolveMode;
|
|
42
|
-
/** The sha the published copy is built ON: the feature head (PREBUILD) or the published copy (COMPOSE). */
|
|
19
|
+
/** The composed dev branch merged into the throwaway, e.g. `dev`. */
|
|
20
|
+
devBranch: string;
|
|
21
|
+
/** The feature head the copy is built ON, pinned when the check started. */
|
|
43
22
|
baseSha: string;
|
|
44
23
|
/** Every path that conflicted and was resolved; the recorded resolution carries exactly these. */
|
|
45
24
|
resolvedPaths: string[];
|
|
46
|
-
/** The remote copy's sha when the
|
|
25
|
+
/** The remote copy's sha when the check started ('' = not published yet) — the publish's lease. */
|
|
47
26
|
leaseSha: string;
|
|
48
|
-
|
|
49
|
-
force: boolean;
|
|
50
|
-
constructor(originalBranch: string, tmpBranch: string, targetRef: string, queue: string[], current?: string);
|
|
27
|
+
constructor(originalBranch: string, tmpBranch: string, targetRef: string, devBranch: string);
|
|
51
28
|
}
|
|
52
29
|
/**
|
|
53
30
|
* Reads, writes and clears the resolve state file, and refuses the other `wp-*` commands while it
|
|
@@ -66,7 +43,7 @@ export declare class PushDevStateStore {
|
|
|
66
43
|
read(repoRoot: string): PushDevState | null;
|
|
67
44
|
write(repoRoot: string, state: PushDevState): void;
|
|
68
45
|
clear(repoRoot: string): void;
|
|
69
|
-
/** The read that MUST find a resolve — used by `wp-
|
|
46
|
+
/** The read that MUST find a resolve — used by `wp-build-push-dev --abort`, whose whole job is ending one. */
|
|
70
47
|
require(repoRoot: string): PushDevState;
|
|
71
48
|
/**
|
|
72
49
|
* Refuse `attempted` while a resolve is half-finished. Called from the app root for every command in
|