@webpieces/pr-gate 0.4.981 → 0.4.983

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/package.json +7 -6
  2. package/src/scripts/commands/build-dev-command.d.ts +27 -0
  3. package/src/scripts/commands/build-dev-command.js +99 -0
  4. package/src/scripts/commands/build-dev-command.js.map +1 -0
  5. package/src/scripts/commands/push-dev-command.d.ts +51 -18
  6. package/src/scripts/commands/push-dev-command.js +97 -34
  7. package/src/scripts/commands/push-dev-command.js.map +1 -1
  8. package/src/scripts/pr-gate-app.d.ts +10 -2
  9. package/src/scripts/pr-gate-app.js +15 -2
  10. package/src/scripts/pr-gate-app.js.map +1 -1
  11. package/src/scripts/pr-gate-cli-app.d.ts +1 -0
  12. package/src/scripts/pr-gate-cli-app.js +11 -3
  13. package/src/scripts/pr-gate-cli-app.js.map +1 -1
  14. package/src/scripts/workflow/build-affected.d.ts +7 -0
  15. package/src/scripts/workflow/build-affected.js +12 -4
  16. package/src/scripts/workflow/build-affected.js.map +1 -1
  17. package/src/scripts/workflow/build-gate-log.d.ts +4 -2
  18. package/src/scripts/workflow/build-gate-log.js +11 -3
  19. package/src/scripts/workflow/build-gate-log.js.map +1 -1
  20. package/src/scripts/workflow/dev-build.d.ts +31 -0
  21. package/src/scripts/workflow/dev-build.js +63 -0
  22. package/src/scripts/workflow/dev-build.js.map +1 -0
  23. package/src/scripts/workflow/dev-deploy-refs.d.ts +23 -3
  24. package/src/scripts/workflow/dev-deploy-refs.js +30 -6
  25. package/src/scripts/workflow/dev-deploy-refs.js.map +1 -1
  26. package/src/scripts/workflow/dev-resolve-runner.d.ts +55 -8
  27. package/src/scripts/workflow/dev-resolve-runner.js +150 -22
  28. package/src/scripts/workflow/dev-resolve-runner.js.map +1 -1
  29. package/src/scripts/workflow/push-dev-state.d.ts +27 -0
  30. package/src/scripts/workflow/push-dev-state.js +41 -3
  31. package/src/scripts/workflow/push-dev-state.js.map +1 -1
  32. package/src/scripts/wp-build-dev.d.ts +2 -0
  33. package/src/scripts/wp-build-dev.js +13 -0
  34. package/src/scripts/wp-build-dev.js.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/pr-gate",
3
- "version": "0.4.981",
3
+ "version": "0.4.983",
4
4
  "description": "Gated PR system: 3-point squash-merge, merge validation gate, and red/yellow/green PR dashboard. Standalone scripts, no Nx dependency required.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -16,22 +16,23 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@inversifyjs/binding-decorators": "1.1.5",
19
- "@webpieces/hook-runtime": "0.4.981",
20
- "@webpieces/rules-config": "0.4.981",
19
+ "@webpieces/hook-runtime": "0.4.983",
20
+ "@webpieces/rules-config": "0.4.983",
21
21
  "inversify": "7.10.4",
22
22
  "reflect-metadata": "0.2.2",
23
- "@webpieces/tooling-common": "0.4.981",
24
- "@webpieces/repo-workflow-core": "0.4.981"
23
+ "@webpieces/tooling-common": "0.4.983",
24
+ "@webpieces/repo-workflow-core": "0.4.983"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
29
  "devDependencies": {
30
- "@webpieces/tooling-testkit": "0.4.981"
30
+ "@webpieces/tooling-testkit": "0.4.983"
31
31
  },
32
32
  "types": "./src/index.d.ts",
33
33
  "bin": {
34
34
  "wp-build": "./src/scripts/wp-build.js",
35
+ "wp-build-dev": "./src/scripts/wp-build-dev.js",
35
36
  "wp-finish-upsert-pr": "./src/scripts/git-finishUpsertPr.js",
36
37
  "wp-human-post-pr": "./src/scripts/wp-human-post-pr.js",
37
38
  "wp-upsert-hotfix-pr": "./src/scripts/wp-upsert-hotfix-pr.js",
@@ -0,0 +1,27 @@
1
+ import { RepoRootFinder } from '@webpieces/rules-config';
2
+ import { GitExec } from '../workflow/git-exec';
3
+ import { DevDeployRefs } from '../workflow/dev-deploy-refs';
4
+ import { DevBuild } from '../workflow/dev-build';
5
+ /**
6
+ * `wp-build-dev` — the check `wp-push-dev` runs before it publishes, WITHOUT the publish (#1397).
7
+ *
8
+ * It merges `origin/<devBranch>` into a throwaway branch and runs `commands.push-dev.buildCommand` on the
9
+ * merged tree, then puts the checkout back. That is the cheap, honest form of the question a developer
10
+ * wants answered before publishing: does this branch build once it meets what is already on dev? Built on
11
+ * the feature branch itself, a `--base=origin/dev` build would also rebuild every project the OTHER copies
12
+ * on dev touched, because they differ from the feature branch too.
13
+ *
14
+ * It RESOLVES NOTHING. A conflict aborts the throwaway merge and names the files; resolving them is
15
+ * `wp-push-dev`'s job, because a resolution is only worth anything once it is recorded on the published
16
+ * copy. The feature branch is never written to, by the same rule as every other dev-deploy command.
17
+ */
18
+ export declare class BuildDevCommand {
19
+ private readonly repoRootFinder;
20
+ private readonly gitExec;
21
+ private readonly refs;
22
+ private readonly devBuild;
23
+ constructor(repoRootFinder: RepoRootFinder, gitExec: GitExec, refs: DevDeployRefs, devBuild: DevBuild);
24
+ run(): Promise<void>;
25
+ private refuseConflict;
26
+ private restore;
27
+ }
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildDevCommand = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const rules_config_1 = require("@webpieces/rules-config");
6
+ const to_error_1 = require("@webpieces/tooling-common/to-error");
7
+ const inversify_1 = require("inversify");
8
+ const git_exec_1 = require("../workflow/git-exec");
9
+ const dev_deploy_refs_1 = require("../workflow/dev-deploy-refs");
10
+ const dev_build_1 = require("../workflow/dev-build");
11
+ const SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n';
12
+ /**
13
+ * `wp-build-dev` — the check `wp-push-dev` runs before it publishes, WITHOUT the publish (#1397).
14
+ *
15
+ * It merges `origin/<devBranch>` into a throwaway branch and runs `commands.push-dev.buildCommand` on the
16
+ * merged tree, then puts the checkout back. That is the cheap, honest form of the question a developer
17
+ * wants answered before publishing: does this branch build once it meets what is already on dev? Built on
18
+ * the feature branch itself, a `--base=origin/dev` build would also rebuild every project the OTHER copies
19
+ * on dev touched, because they differ from the feature branch too.
20
+ *
21
+ * It RESOLVES NOTHING. A conflict aborts the throwaway merge and names the files; resolving them is
22
+ * `wp-push-dev`'s job, because a resolution is only worth anything once it is recorded on the published
23
+ * copy. The feature branch is never written to, by the same rule as every other dev-deploy command.
24
+ */
25
+ let BuildDevCommand = class BuildDevCommand {
26
+ repoRootFinder;
27
+ gitExec;
28
+ refs;
29
+ devBuild;
30
+ constructor(repoRootFinder, gitExec, refs, devBuild) {
31
+ this.repoRootFinder = repoRootFinder;
32
+ this.gitExec = gitExec;
33
+ this.refs = refs;
34
+ this.devBuild = devBuild;
35
+ }
36
+ async run() {
37
+ const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());
38
+ (0, rules_config_1.writeTemplate)(repoRoot, 'webpieces.git-workflow.md');
39
+ const cfg = this.refs.config(repoRoot);
40
+ const branch = this.refs.currentBranch(repoRoot);
41
+ this.refs.assertPushable(cfg, branch);
42
+ // Before any git write: an unconfigured dev build refuses here.
43
+ this.devBuild.command(repoRoot);
44
+ // The merge below must be of committed work only, and must not sweep uncommitted edits along.
45
+ await this.gitExec.assertCleanTree(repoRoot);
46
+ if (await this.refs.remoteSha(repoRoot, cfg.devBranch) === '') {
47
+ throw new rules_config_1.CliExitError(2, '\n' + SEP + `⛔ \`origin/${cfg.devBranch}\` does not exist yet\n` + SEP + '\n'
48
+ + `There is nothing to build against. ${rules_config_1.WP_PUSH_DEV} publishes your copy without this check while\n`
49
+ + `\`${cfg.devBranch}\` does not exist, and your CI creates it on its first composition run.\n`);
50
+ }
51
+ await this.refs.fetchCopies(repoRoot, [cfg.devBranch]);
52
+ const tmp = `${branch}DevCheck`;
53
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', '-B', tmp, 'HEAD'], `Failed to create the throwaway check branch ${tmp}`);
54
+ const merged = await this.gitExec.tryGit(['-C', repoRoot, 'merge', '--no-ff', '--no-edit', '-m',
55
+ `Dev-check: merge ${cfg.devBranch} into ${tmp}`, `refs/remotes/origin/${cfg.devBranch}`], repoRoot);
56
+ if (!merged.ok)
57
+ await this.refuseConflict(repoRoot, branch, tmp, cfg.devBranch);
58
+ // webpieces-disable no-unmanaged-exceptions -- chokepoint: the checkout must go back to the feature branch whether or not the build passed; the build's own CliExitError is re-thrown unchanged
59
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
60
+ try {
61
+ await this.devBuild.run(repoRoot, rules_config_1.WP_BUILD_DEV);
62
+ }
63
+ catch (err) {
64
+ const error = (0, to_error_1.toError)(err);
65
+ await this.restore(repoRoot, branch, tmp);
66
+ throw error;
67
+ }
68
+ await this.restore(repoRoot, branch, tmp);
69
+ process.stdout.write(`\n\`${branch}\` merges cleanly with origin/${cfg.devBranch} and the dev build is green.\n`
70
+ + `Nothing was published — ${rules_config_1.WP_PUSH_DEV} runs this same check and then publishes.\n`);
71
+ }
72
+ // A conflict: list the files, undo the merge, go back — and say which command resolves it.
73
+ async refuseConflict(repoRoot, branch, tmp, devBranch) {
74
+ const out = await this.gitExec.gitQuery(['-C', repoRoot, 'diff', '--name-only', '--diff-filter=U'], repoRoot, 'Failed to list the conflicted files (git diff --name-only --diff-filter=U).');
75
+ const conflicted = out.split('\n').filter((l) => l.trim() !== '');
76
+ await this.gitExec.tryGit(['-C', repoRoot, 'merge', '--abort'], repoRoot);
77
+ await this.restore(repoRoot, branch, tmp);
78
+ throw new rules_config_1.CliExitError(2, '\n' + SEP + `⚠️ \`${branch}\` CONFLICTS with origin/${devBranch}\n` + SEP + '\n'
79
+ + (conflicted.length === 0
80
+ ? 'git could not merge it (no conflicted file was reported).\n'
81
+ : 'These files conflict:\n' + conflicted.map((f) => ` ${f}`).join('\n') + '\n')
82
+ + '\nNo build ran and nothing was published; the throwaway merge is undone and you are back on\n'
83
+ + `\`${branch}\`, which was never modified. ${rules_config_1.WP_PUSH_DEV} stops on these same files on a throwaway\n`
84
+ + 'branch, lets you resolve them there, builds, and publishes the copy with the resolution recorded.\n');
85
+ }
86
+ async restore(repoRoot, branch, tmp) {
87
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', branch], `Failed to return to ${branch}`);
88
+ await this.gitExec.tryGit(['-C', repoRoot, 'branch', '-D', tmp], repoRoot);
89
+ }
90
+ };
91
+ exports.BuildDevCommand = BuildDevCommand;
92
+ exports.BuildDevCommand = BuildDevCommand = tslib_1.__decorate([
93
+ (0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
94
+ tslib_1.__metadata("design:paramtypes", [rules_config_1.RepoRootFinder,
95
+ git_exec_1.GitExec,
96
+ dev_deploy_refs_1.DevDeployRefs,
97
+ dev_build_1.DevBuild])
98
+ ], BuildDevCommand);
99
+ //# sourceMappingURL=build-dev-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-dev-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/build-dev-command.ts"],"names":[],"mappings":";;;;AAAA,0DAAiH;AACjH,iEAA6D;AAC7D,yCAA2D;AAE3D,mDAA+C;AAC/C,iEAA4D;AAC5D,qDAAiD;AAEjD,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE;;;;;;;;;;;;GAYG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IAEH;IACA;IACA;IACA;IAJrB,YACqB,cAA8B,EAC9B,OAAgB,EAChB,IAAmB,EACnB,QAAkB;QAHlB,mBAAc,GAAd,cAAc,CAAgB;QAC9B,YAAO,GAAP,OAAO,CAAS;QAChB,SAAI,GAAJ,IAAI,CAAe;QACnB,aAAQ,GAAR,QAAQ,CAAU;IACpC,CAAC;IAEJ,KAAK,CAAC,GAAG;QACL,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpE,IAAA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, RepoRootFinder, WP_BUILD_DEV, WP_PUSH_DEV, writeTemplate } from '@webpieces/rules-config';\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { GitExec } from '../workflow/git-exec';\nimport { DevDeployRefs } from '../workflow/dev-deploy-refs';\nimport { DevBuild } from '../workflow/dev-build';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * `wp-build-dev` — the check `wp-push-dev` runs before it publishes, WITHOUT the publish (#1397).\n *\n * It merges `origin/<devBranch>` into a throwaway branch and runs `commands.push-dev.buildCommand` on the\n * merged tree, then puts the checkout back. That is the cheap, honest form of the question a developer\n * wants answered before publishing: does this branch build once it meets what is already on dev? Built on\n * the feature branch itself, a `--base=origin/dev` build would also rebuild every project the OTHER copies\n * on dev touched, because they differ from the feature branch too.\n *\n * It RESOLVES NOTHING. A conflict aborts the throwaway merge and names the files; resolving them is\n * `wp-push-dev`'s job, because a resolution is only worth anything once it is recorded on the published\n * copy. The feature branch is never written to, by the same rule as every other dev-deploy command.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class BuildDevCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly gitExec: GitExec,\n private readonly refs: DevDeployRefs,\n private readonly devBuild: DevBuild,\n ) {}\n\n async run(): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n const cfg = this.refs.config(repoRoot);\n const branch = this.refs.currentBranch(repoRoot);\n this.refs.assertPushable(cfg, branch);\n // Before any git write: an unconfigured dev build refuses here.\n this.devBuild.command(repoRoot);\n // The merge below must be of committed work only, and must not sweep uncommitted edits along.\n await this.gitExec.assertCleanTree(repoRoot);\n if (await this.refs.remoteSha(repoRoot, cfg.devBranch) === '') {\n throw new CliExitError(2,\n '\\n' + SEP + `⛔ \\`origin/${cfg.devBranch}\\` does not exist yet\\n` + SEP + '\\n'\n + `There is nothing to build against. ${WP_PUSH_DEV} publishes your copy without this check while\\n`\n + `\\`${cfg.devBranch}\\` does not exist, and your CI creates it on its first composition run.\\n`);\n }\n await this.refs.fetchCopies(repoRoot, [cfg.devBranch]);\n const tmp = `${branch}DevCheck`;\n await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', '-B', tmp, 'HEAD'],\n `Failed to create the throwaway check branch ${tmp}`);\n const merged = await this.gitExec.tryGit(\n ['-C', repoRoot, 'merge', '--no-ff', '--no-edit', '-m',\n `Dev-check: merge ${cfg.devBranch} into ${tmp}`, `refs/remotes/origin/${cfg.devBranch}`],\n repoRoot);\n if (!merged.ok) await this.refuseConflict(repoRoot, branch, tmp, cfg.devBranch);\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: the checkout must go back to the feature branch 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_BUILD_DEV);\n } catch (err: unknown) {\n const error = toError(err);\n await this.restore(repoRoot, branch, tmp);\n throw error;\n }\n await this.restore(repoRoot, branch, tmp);\n process.stdout.write(\n `\\n\\`${branch}\\` merges cleanly with origin/${cfg.devBranch} and the dev build is green.\\n`\n + `Nothing was published — ${WP_PUSH_DEV} runs this same check and then publishes.\\n`);\n }\n\n // A conflict: list the files, undo the merge, go back — and say which command resolves it.\n private async refuseConflict(repoRoot: string, branch: string, tmp: string, devBranch: string): Promise<never> {\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 const conflicted = out.split('\\n').filter((l: string): boolean => l.trim() !== '');\n await this.gitExec.tryGit(['-C', repoRoot, 'merge', '--abort'], repoRoot);\n await this.restore(repoRoot, branch, tmp);\n throw new CliExitError(2,\n '\\n' + SEP + `⚠️ \\`${branch}\\` CONFLICTS with origin/${devBranch}\\n` + SEP + '\\n'\n + (conflicted.length === 0\n ? 'git could not merge it (no conflicted file was reported).\\n'\n : 'These files conflict:\\n' + conflicted.map((f: string): string => ` ${f}`).join('\\n') + '\\n')\n + '\\nNo build ran and nothing was published; the throwaway merge is undone and you are back on\\n'\n + `\\`${branch}\\`, which was never modified. ${WP_PUSH_DEV} stops on these same files on a throwaway\\n`\n + 'branch, lets you resolve them there, builds, and publishes the copy with the resolution recorded.\\n');\n }\n\n private async restore(repoRoot: string, branch: string, tmp: string): Promise<void> {\n await this.gitExec.runGitChecked(['-C', repoRoot, 'checkout', branch], `Failed to return to ${branch}`);\n await this.gitExec.tryGit(['-C', repoRoot, 'branch', '-D', tmp], repoRoot);\n }\n}\n"]}
@@ -4,6 +4,7 @@ import { DevDeployRefs } from '../workflow/dev-deploy-refs';
4
4
  import { PushDevStateStore } from '../workflow/push-dev-state';
5
5
  import { DevResolveRunner } from '../workflow/dev-resolve-runner';
6
6
  import { DevDeployWatchHints } from '../workflow/dev-deploy-watch-hints';
7
+ import { DevBuild } from '../workflow/dev-build';
7
8
  /**
8
9
  * Which of `wp-push-dev`'s modes was asked for. Data-only (per CLAUDE.md) with plain assigned fields
9
10
  * rather than a seven-argument constructor — the bin sets what argv carried and nothing else.
@@ -32,10 +33,17 @@ export declare class PushDevOptions {
32
33
  * a gated command there is simply no legal way for an AI to get a branch onto a dev server, so the
33
34
  * feature was undoable rather than merely awkward.
34
35
  *
35
- * WHY THERE IS NO BUILD, deliberately unlike `wp-start-upsert-pr`: the shared environment's CI builds the
36
- * COMPOSED tree (main + every listed branch). A local build here proves the branch compiles against
37
- * `main` alone, which is not the question — it would be both slower and reassuring about the wrong thing.
38
- * The gate that matters runs on the composition, in CI, where it belongs.
36
+ * WHY IT CHECKS AGAINST `dev` FIRST (#1397): 61 of 73 failed dev publishes on one consumer failed on a git
37
+ * conflict, which the developer only learned about after the server-side composition failed. So a plain
38
+ * publish now does locally what CI is about to do: merge `origin/<devBranch>` into a THROWAWAY branch,
39
+ * resolve any conflict there (the same halt / `wp-finish-push-dev` state machine `--resolve` uses), and run
40
+ * `commands.push-dev.buildCommand` on the merged tree. A build against `main` alone would prove the wrong
41
+ * thing; a build of only what differs from `dev` proves the right one, quickly.
42
+ *
43
+ * WHAT IS PUBLISHED IS NEVER THAT MERGE: the copy is the feature head plus, when something conflicted, one
44
+ * commit recording the resolved files (DevResolveRunner.recordResolution). A copy that contained `dev`
45
+ * would carry every other copy's history, and a later `--remove` of one of them would leave it on dev
46
+ * through this one.
39
47
  *
40
48
  * WHAT IT NEVER DOES: touch the feature branch. See DevDeployRefs for the invariant and why the copy
41
49
  * exists to hold conflict resolutions that must not reach the PR.
@@ -47,22 +55,53 @@ export declare class PushDevCommand {
47
55
  private readonly store;
48
56
  private readonly runner;
49
57
  private readonly watchHints;
50
- constructor(repoRootFinder: RepoRootFinder, gitExec: GitExec, refs: DevDeployRefs, store: PushDevStateStore, runner: DevResolveRunner, watchHints: DevDeployWatchHints);
58
+ private readonly devBuild;
59
+ constructor(repoRootFinder: RepoRootFinder, gitExec: GitExec, refs: DevDeployRefs, store: PushDevStateStore, runner: DevResolveRunner, watchHints: DevDeployWatchHints, devBuild: DevBuild);
51
60
  run(opts: PushDevOptions): Promise<void>;
52
61
  /** `--list`: exactly the live copies, straight from the remote — never a cached local view. */
53
62
  private list;
54
- /** `--remove`: delete the remote copy. This IS the rollback — nothing else has to be undone. */
63
+ /**
64
+ * `--remove`: delete the remote copy, then push the `<removeNamespace>/<branch>` marker (#1395). This
65
+ * IS the rollback — nothing else has to be undone.
66
+ *
67
+ * WHY A MARKER AS WELL AS THE DELETION: a deletion can only be heard by a workflow's `on: delete:`,
68
+ * which GitHub cannot filter by branch, so every branch deletion in the repo started a dev-deploy run.
69
+ * A PUSH to `<removeNamespace>/**` is filterable. The deletion stays, unchanged, so a consumer whose
70
+ * workflow still listens on `delete:` keeps working through the rollout window; the marker is purely
71
+ * additive at the transport level.
72
+ *
73
+ * ORDER: `origin/main` is fetched BEFORE anything is deleted, so a network failure there leaves the
74
+ * pool exactly as it was. The marker push is the last step, and the only one that can fail with the
75
+ * copy already gone — that is the state {@link markerPushFailed} names.
76
+ */
55
77
  private remove;
56
78
  /**
57
- * The ordinary path: publish HEAD as `<namespace>/<branch>`.
79
+ * The one half-done state `--remove` can leave: the copy is deleted, the rebuild signal is not sent.
80
+ * Said out loud because it is invisible otherwise — `--list` already looks right, while the deployed
81
+ * `dev` still runs the removed branch until something else triggers a composition.
82
+ */
83
+ private markerPushFailed;
84
+ /**
85
+ * The ordinary path: check the copy against `origin/<devBranch>`, build it, then publish it as
86
+ * `<namespace>/<branch>` (#1397). The merge, the conflict halt and the build all happen on a throwaway
87
+ * branch through DevResolveRunner, in DevResolveMode.PREBUILD — so a conflict stops in exactly the
88
+ * same `wp-finish-push-dev` state machine `--resolve` uses, rather than inventing a second way to be
89
+ * stuck.
58
90
  *
59
- * THE CLOBBER GUARD is the whole of the interesting logic here. If the remote copy holds commits the
60
- * local branch does not, somebody (quite possibly this developer, days ago) resolved a real conflict
61
- * over there. A silent force-push destroys work that cost a human a genuine merge resolution, so the
62
- * default is refusal with two named ways forward — never a "use --force" one-liner, which is how a
63
- * warning becomes a reflex.
91
+ * THE CLOBBER GUARD runs first. If the remote copy holds commits the local branch does not, somebody
92
+ * (quite possibly this developer, days ago) put real work there, and a silent force-push destroys it,
93
+ * so the default is refusal with two named ways forward — never a "use --force" one-liner, which is how
94
+ * a warning becomes a reflex. The one exception is a commit this flow wrote itself
95
+ * ({@link RESOLUTION_SUBJECT}): the check below re-derives it against today's dev, so replacing it
96
+ * loses nothing.
64
97
  */
65
98
  private publish;
99
+ /**
100
+ * `origin/<devBranch>` does not exist yet — the very first publish in a repo whose CI has never
101
+ * composed. There is nothing to conflict with and no base for a dev-scoped build, so the copy is
102
+ * published as it is; refusing here would make the first dev composition impossible to start.
103
+ */
104
+ private publishWithoutDev;
66
105
  /**
67
106
  * `--rebase-resolution`: keep the published resolution, replay it on top of the new commits.
68
107
  *
@@ -80,12 +119,6 @@ export declare class PushDevCommand {
80
119
  */
81
120
  private startResolve;
82
121
  private resolveQueue;
83
- /**
84
- * `--force-with-lease` pinned to the sha we just inspected, so the clobber guard's verdict cannot go
85
- * stale between the check and the push. Plain `--force` only when the caller explicitly asked to
86
- * discard, and no force at all for a brand-new copy.
87
- */
88
- private pushSafety;
89
122
  private refuseClobber;
90
123
  private assertNoResolveInProgress;
91
124
  }
@@ -9,6 +9,7 @@ const dev_deploy_refs_1 = require("../workflow/dev-deploy-refs");
9
9
  const push_dev_state_1 = require("../workflow/push-dev-state");
10
10
  const dev_resolve_runner_1 = require("../workflow/dev-resolve-runner");
11
11
  const dev_deploy_watch_hints_1 = require("../workflow/dev-deploy-watch-hints");
12
+ const dev_build_1 = require("../workflow/dev-build");
12
13
  const SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n';
13
14
  /**
14
15
  * Which of `wp-push-dev`'s modes was asked for. Data-only (per CLAUDE.md) with plain assigned fields
@@ -39,10 +40,17 @@ exports.PushDevOptions = PushDevOptions;
39
40
  * a gated command there is simply no legal way for an AI to get a branch onto a dev server, so the
40
41
  * feature was undoable rather than merely awkward.
41
42
  *
42
- * WHY THERE IS NO BUILD, deliberately unlike `wp-start-upsert-pr`: the shared environment's CI builds the
43
- * COMPOSED tree (main + every listed branch). A local build here proves the branch compiles against
44
- * `main` alone, which is not the question — it would be both slower and reassuring about the wrong thing.
45
- * The gate that matters runs on the composition, in CI, where it belongs.
43
+ * WHY IT CHECKS AGAINST `dev` FIRST (#1397): 61 of 73 failed dev publishes on one consumer failed on a git
44
+ * conflict, which the developer only learned about after the server-side composition failed. So a plain
45
+ * publish now does locally what CI is about to do: merge `origin/<devBranch>` into a THROWAWAY branch,
46
+ * resolve any conflict there (the same halt / `wp-finish-push-dev` state machine `--resolve` uses), and run
47
+ * `commands.push-dev.buildCommand` on the merged tree. A build against `main` alone would prove the wrong
48
+ * thing; a build of only what differs from `dev` proves the right one, quickly.
49
+ *
50
+ * WHAT IS PUBLISHED IS NEVER THAT MERGE: the copy is the feature head plus, when something conflicted, one
51
+ * commit recording the resolved files (DevResolveRunner.recordResolution). A copy that contained `dev`
52
+ * would carry every other copy's history, and a later `--remove` of one of them would leave it on dev
53
+ * through this one.
46
54
  *
47
55
  * WHAT IT NEVER DOES: touch the feature branch. See DevDeployRefs for the invariant and why the copy
48
56
  * exists to hold conflict resolutions that must not reach the PR.
@@ -54,13 +62,15 @@ let PushDevCommand = class PushDevCommand {
54
62
  store;
55
63
  runner;
56
64
  watchHints;
57
- constructor(repoRootFinder, gitExec, refs, store, runner, watchHints) {
65
+ devBuild;
66
+ constructor(repoRootFinder, gitExec, refs, store, runner, watchHints, devBuild) {
58
67
  this.repoRootFinder = repoRootFinder;
59
68
  this.gitExec = gitExec;
60
69
  this.refs = refs;
61
70
  this.store = store;
62
71
  this.runner = runner;
63
72
  this.watchHints = watchHints;
73
+ this.devBuild = devBuild;
64
74
  }
65
75
  async run(opts) {
66
76
  const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());
@@ -102,35 +112,79 @@ let PushDevCommand = class PushDevCommand {
102
112
  for (const copy of copies)
103
113
  out += ` ${copy.sha.slice(0, 8)} ${copy.ref}\n`;
104
114
  out += `\nYour CI composes \`${cfg.devBranch}\` from origin/main plus every ref above, on every run.\n`
105
- + `Remove yours with: ${rules_config_1.WP_PUSH_DEV} --remove\n`;
115
+ + `Remove yours with: ${rules_config_1.WP_PUSH_DEV} --remove (deletes your copy, then pushes the content-free\n`
116
+ + `\`${cfg.removeMarkerRefFor('<your-branch>')}\` marker your dev workflow triggers on and deletes)\n`;
106
117
  process.stdout.write(out);
107
118
  }
108
- /** `--remove`: delete the remote copy. This IS the rollback — nothing else has to be undone. */
119
+ /**
120
+ * `--remove`: delete the remote copy, then push the `<removeNamespace>/<branch>` marker (#1395). This
121
+ * IS the rollback — nothing else has to be undone.
122
+ *
123
+ * WHY A MARKER AS WELL AS THE DELETION: a deletion can only be heard by a workflow's `on: delete:`,
124
+ * which GitHub cannot filter by branch, so every branch deletion in the repo started a dev-deploy run.
125
+ * A PUSH to `<removeNamespace>/**` is filterable. The deletion stays, unchanged, so a consumer whose
126
+ * workflow still listens on `delete:` keeps working through the rollout window; the marker is purely
127
+ * additive at the transport level.
128
+ *
129
+ * ORDER: `origin/main` is fetched BEFORE anything is deleted, so a network failure there leaves the
130
+ * pool exactly as it was. The marker push is the last step, and the only one that can fail with the
131
+ * copy already gone — that is the state {@link markerPushFailed} names.
132
+ */
109
133
  async remove(repoRoot, cfg, branch, targetRef) {
110
134
  if (await this.refs.remoteSha(repoRoot, targetRef) === '') {
111
135
  process.stdout.write(`\nNothing to remove — \`${targetRef}\` is not published.\n`
112
136
  + `List what IS published with: ${rules_config_1.WP_PUSH_DEV} --list\n`);
113
137
  return;
114
138
  }
139
+ const markerRef = cfg.removeMarkerRefFor(branch);
140
+ const mainTip = await this.refs.freshMainTip(repoRoot);
115
141
  await this.gitExec.runGitChecked(['-C', repoRoot, 'push', 'origin', '--delete', `refs/heads/${targetRef}`], `Failed to delete the dev copy ${targetRef}`);
142
+ // --force: the marker carries no content, so whatever an earlier, never-deleted marker pointed at
143
+ // is worthless — and refusing a non-fast-forward here would strand the rollback half-done.
144
+ const pushed = await this.gitExec.tryGit(['-C', repoRoot, 'push', '--force', 'origin', `${mainTip}:refs/heads/${markerRef}`], repoRoot);
145
+ if (!pushed.ok)
146
+ this.markerPushFailed(cfg, branch, targetRef, markerRef, pushed.stderr);
116
147
  process.stdout.write('\n' + SEP + `🗑️ Removed ${targetRef}\n` + SEP + '\n'
117
- + `\`${branch}\` will drop out of \`${cfg.devBranch}\` on its next composition run. Your branch and any\n`
118
- + 'PR on it are untouched.\n');
148
+ + `Pushed the marker \`${markerRef}\` (at origin/main ${mainTip.slice(0, 8)}) — your dev workflow triggers\n`
149
+ + `on it, deletes it, and rebuilds \`${cfg.devBranch}\` without \`${branch}\`. Your branch and any PR on it\n`
150
+ + 'are untouched.\n');
151
+ }
152
+ /**
153
+ * The one half-done state `--remove` can leave: the copy is deleted, the rebuild signal is not sent.
154
+ * Said out loud because it is invisible otherwise — `--list` already looks right, while the deployed
155
+ * `dev` still runs the removed branch until something else triggers a composition.
156
+ */
157
+ markerPushFailed(cfg, branch, targetRef, markerRef, stderr) {
158
+ throw new rules_config_1.CliExitError(1, '\n' + SEP + `⛔ Removed \`${targetRef}\`, but pushing the rebuild marker \`${markerRef}\` FAILED\n` + SEP + '\n'
159
+ + `Your copy is already GONE from origin, but \`${cfg.devBranch}\` was NOT rebuilt: the deployed dev server\n`
160
+ + `still runs \`${branch}\` until the next composition run.\n\n`
161
+ + 'git said:\n' + (stderr === '' ? ' (no output)' : stderr.split('\n').map((l) => ` ${l}`).join('\n')) + '\n\n'
162
+ + 'Any later composition run drops your branch on its own, because the copy no longer exists — the next\n'
163
+ + `\`${rules_config_1.WP_PUSH_DEV}\` by anyone, or a push to main if your workflow composes on that. To force one now,\n`
164
+ + 'once the cause above is fixed (network, auth, a branch-protection rule on the marker namespace),\n'
165
+ + 're-publish and remove again; the second remove pushes the marker:\n\n'
166
+ + ` ${rules_config_1.WP_PUSH_DEV}\n ${rules_config_1.WP_PUSH_DEV} --remove\n`);
119
167
  }
120
168
  /**
121
- * The ordinary path: publish HEAD as `<namespace>/<branch>`.
169
+ * The ordinary path: check the copy against `origin/<devBranch>`, build it, then publish it as
170
+ * `<namespace>/<branch>` (#1397). The merge, the conflict halt and the build all happen on a throwaway
171
+ * branch through DevResolveRunner, in DevResolveMode.PREBUILD — so a conflict stops in exactly the
172
+ * same `wp-finish-push-dev` state machine `--resolve` uses, rather than inventing a second way to be
173
+ * stuck.
122
174
  *
123
- * THE CLOBBER GUARD is the whole of the interesting logic here. If the remote copy holds commits the
124
- * local branch does not, somebody (quite possibly this developer, days ago) resolved a real conflict
125
- * over there. A silent force-push destroys work that cost a human a genuine merge resolution, so the
126
- * default is refusal with two named ways forward — never a "use --force" one-liner, which is how a
127
- * warning becomes a reflex.
175
+ * THE CLOBBER GUARD runs first. If the remote copy holds commits the local branch does not, somebody
176
+ * (quite possibly this developer, days ago) put real work there, and a silent force-push destroys it,
177
+ * so the default is refusal with two named ways forward — never a "use --force" one-liner, which is how
178
+ * a warning becomes a reflex. The one exception is a commit this flow wrote itself
179
+ * ({@link RESOLUTION_SUBJECT}): the check below re-derives it against today's dev, so replacing it
180
+ * loses nothing.
128
181
  */
129
182
  async publish(repoRoot, cfg, branch, targetRef, opts) {
130
183
  const remoteSha = await this.refs.remoteSha(repoRoot, targetRef);
131
184
  if (remoteSha !== '') {
132
185
  await this.refs.fetchCopies(repoRoot, [targetRef]);
133
- const ahead = await this.refs.commitsOnlyOnRemote(repoRoot, targetRef);
186
+ const subjects = await this.refs.subjectsOnlyOnRemote(repoRoot, targetRef);
187
+ const ahead = subjects.filter((s) => !s.startsWith(dev_resolve_runner_1.RESOLUTION_SUBJECT)).length;
134
188
  if (ahead > 0 && opts.rebaseResolution) {
135
189
  await this.rebaseResolution(repoRoot, branch, targetRef);
136
190
  return;
@@ -138,13 +192,31 @@ let PushDevCommand = class PushDevCommand {
138
192
  if (ahead > 0 && !opts.force)
139
193
  this.refuseClobber(cfg, branch, targetRef, ahead);
140
194
  }
141
- await this.gitExec.runGitChecked(['-C', repoRoot, 'push', ...this.pushSafety(targetRef, remoteSha, opts.force),
142
- 'origin', `HEAD:refs/heads/${targetRef}`], `Failed to publish the dev copy ${targetRef}`);
143
- // Read AFTER the push, so the sha in the watch hints is provably the one that is now published.
195
+ // Before any git write: an unconfigured dev build refuses here, with nothing merged or published.
196
+ this.devBuild.command(repoRoot);
197
+ if (await this.refs.remoteSha(repoRoot, cfg.devBranch) === '') {
198
+ await this.publishWithoutDev(repoRoot, cfg, branch, targetRef, remoteSha, opts.force);
199
+ return;
200
+ }
201
+ const state = new push_dev_state_1.PushDevState(branch, this.runner.tmpBranchFor(branch), targetRef, [cfg.devBranch]);
202
+ state.mode = push_dev_state_1.DevResolveMode.PREBUILD;
203
+ state.leaseSha = remoteSha;
204
+ state.force = opts.force;
205
+ process.stdout.write(this.runner.announcePrebuild(cfg, state));
206
+ await this.runner.start(repoRoot, state, 'HEAD', [cfg.devBranch]);
207
+ }
208
+ /**
209
+ * `origin/<devBranch>` does not exist yet — the very first publish in a repo whose CI has never
210
+ * composed. There is nothing to conflict with and no base for a dev-scoped build, so the copy is
211
+ * published as it is; refusing here would make the first dev composition impossible to start.
212
+ */
213
+ async publishWithoutDev(repoRoot, cfg, branch, targetRef, remoteSha, force) {
214
+ const lease = remoteSha === '' ? [] : force ? ['--force'] : [`--force-with-lease=refs/heads/${targetRef}:${remoteSha}`];
215
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'push', ...lease, 'origin', `HEAD:refs/heads/${targetRef}`], `Failed to publish the dev copy ${targetRef}`);
144
216
  const published = await this.refs.headSha(repoRoot);
145
217
  process.stdout.write('\n' + SEP + `✅ Published ${targetRef}\n` + SEP + '\n'
146
- + `\`${branch}\` is now in the pool your CI composes \`${cfg.devBranch}\` from — it will be picked up on\n`
147
- + 'the next composition run. No PR was opened and nothing landed on main.\n\n'
218
+ + `\`origin/${cfg.devBranch}\` does not exist yet, so there was nothing to check the copy against and no\n`
219
+ + `dev build ran. \`${branch}\` is now in the pool your CI composes \`${cfg.devBranch}\` from.\n\n`
148
220
  + ` ${rules_config_1.WP_PUSH_DEV} --list ← what else is in the pool\n`
149
221
  + ` ${rules_config_1.WP_PUSH_DEV} --remove ← take this branch back out\n`
150
222
  + this.watchHints.render(cfg, targetRef, published));
@@ -158,6 +230,7 @@ let PushDevCommand = class PushDevCommand {
158
230
  */
159
231
  async rebaseResolution(repoRoot, branch, targetRef) {
160
232
  const state = new push_dev_state_1.PushDevState(branch, this.runner.tmpBranchFor(branch), targetRef, [targetRef]);
233
+ state.mode = push_dev_state_1.DevResolveMode.REPLAY;
161
234
  process.stdout.write('\n' + SEP + `♻️ Replaying the published resolution onto \`${branch}\`\n` + SEP + '\n'
162
235
  + `Merging \`${targetRef}\` (which holds the resolution) into your new commits on a throwaway branch.\n`
163
236
  + `Your feature branch \`${branch}\` is not touched.\n\n`);
@@ -183,6 +256,7 @@ let PushDevCommand = class PushDevCommand {
183
256
  return;
184
257
  }
185
258
  const state = new push_dev_state_1.PushDevState(branch, this.runner.tmpBranchFor(branch), targetRef, queue);
259
+ state.mode = push_dev_state_1.DevResolveMode.COMPOSE;
186
260
  process.stdout.write(this.runner.announce(cfg, state));
187
261
  await this.runner.start(repoRoot, state, `refs/remotes/origin/${targetRef}`, [targetRef, ...queue]);
188
262
  }
@@ -204,18 +278,6 @@ let PushDevCommand = class PushDevCommand {
204
278
  }
205
279
  return [wanted];
206
280
  }
207
- /**
208
- * `--force-with-lease` pinned to the sha we just inspected, so the clobber guard's verdict cannot go
209
- * stale between the check and the push. Plain `--force` only when the caller explicitly asked to
210
- * discard, and no force at all for a brand-new copy.
211
- */
212
- pushSafety(targetRef, remoteSha, force) {
213
- if (remoteSha === '')
214
- return [];
215
- if (force)
216
- return ['--force'];
217
- return [`--force-with-lease=refs/heads/${targetRef}:${remoteSha}`];
218
- }
219
281
  refuseClobber(cfg, branch, targetRef, ahead) {
220
282
  throw new rules_config_1.CliExitError(2, '\n' + SEP + `⛔ \`${targetRef}\` holds ${String(ahead)} commit(s) your branch does not\n` + SEP + '\n'
221
283
  + 'That is what a CONFLICT RESOLUTION looks like: somebody composed this copy against another\n'
@@ -250,6 +312,7 @@ exports.PushDevCommand = PushDevCommand = tslib_1.__decorate([
250
312
  dev_deploy_refs_1.DevDeployRefs,
251
313
  push_dev_state_1.PushDevStateStore,
252
314
  dev_resolve_runner_1.DevResolveRunner,
253
- dev_deploy_watch_hints_1.DevDeployWatchHints])
315
+ dev_deploy_watch_hints_1.DevDeployWatchHints,
316
+ dev_build_1.DevBuild])
254
317
  ], PushDevCommand);
255
318
  //# sourceMappingURL=push-dev-command.js.map