@intentius/chant 0.124.56 → 0.124.58
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/dist/ci-audit/index.d.ts.map +1 -1
- package/dist/ci-audit/index.js +1 -2
- package/dist/ci-product-words.d.ts +47 -2
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +59 -1
- package/dist/ci-product.d.ts +26 -2
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +30 -7
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +5 -1
- package/dist/cli/handlers/init.d.ts.map +1 -1
- package/dist/cli/handlers/init.js +16 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +14 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +90 -35
- package/dist/cli/handlers/serve.d.ts.map +1 -1
- package/dist/cli/handlers/serve.js +9 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +6 -2
- package/dist/cli/mcp/product-tools.d.ts +40 -7
- package/dist/cli/mcp/product-tools.d.ts.map +1 -1
- package/dist/cli/mcp/product-tools.js +59 -15
- package/dist/cli/mcp/read-only.d.ts +2 -1
- package/dist/cli/mcp/read-only.d.ts.map +1 -1
- package/dist/cli/mcp/read-only.js +2 -1
- package/dist/cli/mcp/server.d.ts +11 -0
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/server.js +15 -3
- package/dist/cli/mcp-config.d.ts +4 -1
- package/dist/cli/mcp-config.d.ts.map +1 -1
- package/dist/cli/mcp-config.js +6 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +9 -0
- package/dist/cli/registry.d.ts +8 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts +5 -2
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +9 -4
- package/dist/components/capability.d.ts +10 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/deploy-units.d.ts +12 -0
- package/dist/components/deploy-units.d.ts.map +1 -1
- package/dist/components/deploy-units.js +20 -1
- package/dist/components/pr-pipeline.d.ts +64 -2
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +66 -5
- package/dist/components/product-pipeline.d.ts +18 -1
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +8 -2
- package/dist/components/row-lease.d.ts +22 -1
- package/dist/components/row-lease.d.ts.map +1 -1
- package/dist/components/row-lease.js +32 -6
- package/dist/e2e-harness/driver.d.ts.map +1 -1
- package/dist/e2e-harness/driver.js +97 -0
- package/dist/e2e-harness/forgejo.d.ts +5 -1
- package/dist/e2e-harness/forgejo.d.ts.map +1 -1
- package/dist/e2e-harness/forgejo.js +35 -0
- package/dist/e2e-harness/index.d.ts +7 -0
- package/dist/e2e-harness/index.d.ts.map +1 -1
- package/dist/e2e-harness/index.js +11 -2
- package/dist/e2e-harness/ports.d.ts +31 -0
- package/dist/e2e-harness/ports.d.ts.map +1 -1
- package/dist/e2e-harness/scenario.d.ts.map +1 -1
- package/dist/e2e-harness/scenario.js +9 -5
- package/dist/e2e-harness/schemas/e2e-scenario.schema.json +43 -3
- package/dist/e2e-harness/schemas/index.d.ts +22 -1
- package/dist/e2e-harness/schemas/index.d.ts.map +1 -1
- package/dist/e2e-harness/schemas/index.js +1 -1
- package/dist/e2e-harness/steps.d.ts.map +1 -1
- package/dist/e2e-harness/steps.js +4 -0
- package/dist/lexicon.d.ts +9 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +39 -3
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +223 -15
- package/dist/lifecycle/lock-rows.d.ts +23 -0
- package/dist/lifecycle/lock-rows.d.ts.map +1 -1
- package/dist/lifecycle/lock-rows.js +47 -8
- package/dist/lifecycle/resource-lock.d.ts +70 -0
- package/dist/lifecycle/resource-lock.d.ts.map +1 -1
- package/dist/lifecycle/resource-lock.js +241 -5
- package/dist/mcp/types.d.ts +9 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/op/gate.js +21 -4
- package/dist/op/op-waves-release-port.js +1 -1
- package/dist/op/op-waves-release.d.ts +2 -1
- package/dist/op/op-waves-release.d.ts.map +1 -1
- package/dist/op/op-waves-run.d.ts +8 -0
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +101 -29
- package/dist/op/op-waves.d.ts +18 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +16 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +1 -2
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/template-request/index.d.ts +9 -0
- package/dist/template-request/index.d.ts.map +1 -0
- package/dist/template-request/index.js +8 -0
- package/dist/template-request/request-body.d.ts +21 -0
- package/dist/template-request/request-body.d.ts.map +1 -0
- package/dist/template-request/request-body.js +86 -0
- package/dist/template-request/template-request.d.ts +100 -0
- package/dist/template-request/template-request.d.ts.map +1 -0
- package/dist/template-request/template-request.js +150 -0
- package/dist/template-request/template-request.schema.json +100 -0
- package/dist/template-request/template-spec.d.ts +83 -0
- package/dist/template-request/template-spec.d.ts.map +1 -0
- package/dist/template-request/template-spec.js +146 -0
- package/dist/template-request/template.schema.json +114 -0
- package/dist/template-request/validate.d.ts +4 -0
- package/dist/template-request/validate.d.ts.map +1 -0
- package/dist/template-request/validate.js +21 -0
- package/dist/wave-runtime.mjs +310 -300
- package/package.json +8 -1
- package/src/ci-audit/index.ts +1 -2
- package/src/ci-product-words.test.ts +23 -0
- package/src/ci-product-words.ts +68 -3
- package/src/ci-product.ts +36 -6
- package/src/cli/commands/init.ts +3 -1
- package/src/cli/handlers/build.ts +5 -1
- package/src/cli/handlers/init.ts +18 -0
- package/src/cli/handlers/lifecycle.ts +13 -0
- package/src/cli/handlers/pr-before-merge.test.ts +1 -1
- package/src/cli/handlers/pr-deploy-inputs.test.ts +1 -1
- package/src/cli/handlers/pr-endpoint.test.ts +1 -1
- package/src/cli/handlers/pr-green.test.ts +1 -1
- package/src/cli/handlers/pr-plan-comment-targets.test.ts +1 -1
- package/src/cli/handlers/pr-plan-flags.test.ts +1 -1
- package/src/cli/handlers/pr-plan-targets.test.ts +1 -1
- package/src/cli/handlers/pr-record.test.ts +34 -2
- package/src/cli/handlers/pr-waves-blocked.test.ts +1 -1
- package/src/cli/handlers/pr-waves.test.ts +1 -1
- package/src/cli/handlers/pr.test.ts +1 -1
- package/src/cli/handlers/pr.ts +86 -31
- package/src/cli/handlers/serve.ts +9 -0
- package/src/cli/main.ts +6 -2
- package/src/cli/mcp/product-tools.test.ts +57 -1
- package/src/cli/mcp/product-tools.ts +67 -15
- package/src/cli/mcp/read-only.ts +2 -1
- package/src/cli/mcp/server.ts +20 -5
- package/src/cli/mcp-config.test.ts +52 -2
- package/src/cli/mcp-config.ts +6 -3
- package/src/cli/parse-args.ts +7 -0
- package/src/cli/registry.ts +8 -0
- package/src/components/auto-release.test.ts +4 -2
- package/src/components/auto-release.ts +9 -5
- package/src/components/capability.ts +10 -0
- package/src/components/deploy-units.test.ts +18 -1
- package/src/components/deploy-units.ts +26 -1
- package/src/components/pr-pipeline.ts +99 -5
- package/src/components/product-actions.test.ts +76 -0
- package/src/components/product-pipeline.ts +21 -2
- package/src/components/row-lease.test.ts +61 -1
- package/src/components/row-lease.ts +48 -7
- package/src/e2e-harness/driver.test.ts +163 -0
- package/src/e2e-harness/driver.ts +86 -1
- package/src/e2e-harness/forgejo.ts +42 -1
- package/src/e2e-harness/index.ts +12 -2
- package/src/e2e-harness/ports.ts +33 -0
- package/src/e2e-harness/scenario.ts +8 -6
- package/src/e2e-harness/schemas/README.md +11 -2
- package/src/e2e-harness/schemas/e2e-scenario.schema.json +43 -3
- package/src/e2e-harness/schemas/index.ts +5 -1
- package/src/e2e-harness/schemas.test.ts +44 -1
- package/src/e2e-harness/steps.ts +4 -0
- package/src/lexicon.ts +9 -0
- package/src/lifecycle/git.test.ts +155 -0
- package/src/lifecycle/git.ts +213 -17
- package/src/lifecycle/lock-rows.test.ts +6 -1
- package/src/lifecycle/lock-rows.ts +58 -7
- package/src/lifecycle/resource-lock-wait.test.ts +292 -0
- package/src/lifecycle/resource-lock.ts +261 -7
- package/src/mcp/types.ts +9 -0
- package/src/op/gate.test.ts +7 -5
- package/src/op/gate.ts +20 -4
- package/src/op/op-waves-after-plan.test.ts +1 -2
- package/src/op/op-waves-ledger-lock.test.ts +208 -0
- package/src/op/op-waves-release-port.ts +1 -1
- package/src/op/op-waves-release.ts +1 -1
- package/src/op/op-waves-run.ts +104 -29
- package/src/op/op-waves.ts +18 -0
- package/src/pr-loop-bundle.test.ts +0 -2
- package/src/pr-loop.ts +1 -2
- package/src/release-floors.ts +1 -1
- package/src/template-request/__fixtures__/request-body.md +41 -0
- package/src/template-request/index.ts +8 -0
- package/src/template-request/request-body.ts +91 -0
- package/src/template-request/template-request.schema.json +100 -0
- package/src/template-request/template-request.test.ts +316 -0
- package/src/template-request/template-request.ts +235 -0
- package/src/template-request/template-spec.ts +176 -0
- package/src/template-request/template.schema.json +114 -0
- package/src/template-request/validate.ts +28 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant",
|
|
3
|
-
"version": "0.124.
|
|
3
|
+
"version": "0.124.58",
|
|
4
4
|
"description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -93,6 +93,13 @@
|
|
|
93
93
|
"import": "./dist/op/activities/index.js",
|
|
94
94
|
"default": "./src/op/activities/index.ts"
|
|
95
95
|
},
|
|
96
|
+
"./template-request": {
|
|
97
|
+
"development": "./src/template-request/index.ts",
|
|
98
|
+
"types": "./dist/template-request/index.d.ts",
|
|
99
|
+
"import": "./dist/template-request/index.js",
|
|
100
|
+
"default": "./src/template-request/index.ts"
|
|
101
|
+
},
|
|
102
|
+
"./template-request/*.schema.json": "./src/template-request/*.schema.json",
|
|
96
103
|
"./components": {
|
|
97
104
|
"development": "./src/components/index.ts",
|
|
98
105
|
"types": "./dist/components/index.d.ts",
|
package/src/ci-audit/index.ts
CHANGED
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
* on `CI_AUDIT_FLOOR`.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
9
8
|
|
|
10
9
|
/** The first chant with drift attribution and the unrecorded writer audit in core. */
|
|
11
|
-
export const CI_AUDIT_FLOOR =
|
|
10
|
+
export const CI_AUDIT_FLOOR = "0.124.56";
|
|
12
11
|
|
|
13
12
|
export * from "./audit-log";
|
|
14
13
|
export * from "./attribution";
|
|
@@ -92,6 +92,29 @@ describe("the comment grammar (moved from terragucci's comment.ts)", () => {
|
|
|
92
92
|
expect(parseProductComment(pw, "/plywood lock everything")).toMatchObject({ kind: "refused" });
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
+
test("an action command names one member and one action, and nothing else (#4653)", () => {
|
|
96
|
+
const words = assertProductWords({ ...TERRAGUCCI, commands: { ...TERRAGUCCI.commands, action: "action" as const } });
|
|
97
|
+
expect(parseProductComment(words, "/terragucci action apps/orders action.aws_lambda_invoke.rotate")).toEqual({ kind: "action", member: "apps/orders", address: "action.aws_lambda_invoke.rotate" });
|
|
98
|
+
expect(parseProductComment(words, "/terragucci action apps/orders module.app.action.aws_lambda_invoke.rotate")).toEqual({ kind: "action", member: "apps/orders", address: "module.app.action.aws_lambda_invoke.rotate" });
|
|
99
|
+
expect(parseProductComment(words, '/terragucci action apps/orders module.app["blue"].action.t.l[0]')).toEqual({ kind: "action", member: "apps/orders", address: 'module.app["blue"].action.t.l[0]' });
|
|
100
|
+
for (const bad of [
|
|
101
|
+
"/terragucci action",
|
|
102
|
+
"/terragucci action apps/orders",
|
|
103
|
+
"/terragucci action apps/orders action.t.l extra",
|
|
104
|
+
"/terragucci action ../etc action.t.l",
|
|
105
|
+
"/terragucci action apps/orders -target=x",
|
|
106
|
+
"/terragucci action apps/orders action.t.l;id",
|
|
107
|
+
"/terragucci action apps/orders $(id)",
|
|
108
|
+
"/terragucci action apps/orders action.t.l\nrm",
|
|
109
|
+
]) {
|
|
110
|
+
expect(parseProductComment(words, bad.replace("\\n", "\n"))).toMatchObject({ kind: "refused" });
|
|
111
|
+
}
|
|
112
|
+
// A product without the word does not read it.
|
|
113
|
+
expect(parseProductComment(tg, "/terragucci action apps/orders action.t.l")).toMatchObject({ kind: "refused", reason: expect.stringMatching(/the commands are/) });
|
|
114
|
+
expect(commentLine(words, "action")).toBe("/terragucci action");
|
|
115
|
+
expect(productWordsProblems(words, { jobs: ["plan", "apply", "lock", "unlock", "agent"] })).toContain("commands.action needs a action job, and the pipeline has none");
|
|
116
|
+
});
|
|
117
|
+
|
|
95
118
|
test("an alias reads only where its variable turns it on", () => {
|
|
96
119
|
expect(parseProductComment(tg, "atlantis plan -d envs/dev/orders")).toBeUndefined();
|
|
97
120
|
expect(parseProductComment(tg, "atlantis plan -d ./envs/dev/orders/", { TG_ATLANTIS_COMMENTS: "1" })).toEqual({ kind: "plan", member: "envs/dev/orders" });
|
package/src/ci-product-words.ts
CHANGED
|
@@ -29,10 +29,14 @@ export type CiProductStage = "plan" | "apply" | "record" | "check" | "drift" | "
|
|
|
29
29
|
/** Every stage slot, in the order {@link assertProductWords} reports them. */
|
|
30
30
|
export const CI_PRODUCT_STAGES: readonly CiProductStage[] = ["plan", "apply", "record", "check", "drift", "lock", "approval", "control"];
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The commands a comment may name. Each one needs a job in the pipeline that
|
|
34
|
+
* answers it. `action` (#4653) asks for a day-2 action on one member, which
|
|
35
|
+
* runs under a gated request.
|
|
36
|
+
*/
|
|
37
|
+
export type CiProductCommand = "plan" | "apply" | "lock" | "unlock" | "agent" | "action";
|
|
34
38
|
|
|
35
|
-
export const CI_PRODUCT_COMMANDS: readonly CiProductCommand[] = ["plan", "apply", "lock", "unlock", "agent"];
|
|
39
|
+
export const CI_PRODUCT_COMMANDS: readonly CiProductCommand[] = ["plan", "apply", "lock", "unlock", "agent", "action"];
|
|
36
40
|
|
|
37
41
|
/**
|
|
38
42
|
* What an approval of a product's waves binds to (ruling B, 2026-10-27).
|
|
@@ -454,6 +458,12 @@ export type ParsedProductComment =
|
|
|
454
458
|
| { kind: "unlock" }
|
|
455
459
|
/** An ask for the agent: data, never split or run. */
|
|
456
460
|
| { kind: "agent"; ask: string }
|
|
461
|
+
/**
|
|
462
|
+
* A day-2 action (#4653): `<member> <action>`, such as `apps/orders
|
|
463
|
+
* module.app.action.aws_lambda_invoke.rotate` or a stack's action name.
|
|
464
|
+
* The engine's lexicon checks the action against the member's plan.
|
|
465
|
+
*/
|
|
466
|
+
| { kind: "action"; member: string; address: string }
|
|
457
467
|
| { kind: "refused"; reason: string };
|
|
458
468
|
|
|
459
469
|
/** A member as a comment may name it: path segments, no leading dash, no shell or glob syntax. */
|
|
@@ -465,6 +475,12 @@ const MEMBER = /^[A-Za-z0-9_][A-Za-z0-9_.\/-]{0,199}$/;
|
|
|
465
475
|
* It never reaches a shell: the job reads the comment from a variable.
|
|
466
476
|
*/
|
|
467
477
|
const TARGET = /^[A-Za-z0-9_][A-Za-z0-9_.:\/\[\]"*@=+$,-]{0,499}$/;
|
|
478
|
+
/**
|
|
479
|
+
* An action as a comment may name it (#4653): a Terraform action address,
|
|
480
|
+
* module steps and instance keys included, or a configured action's name.
|
|
481
|
+
* No leading dash, no spaces, no shell or glob syntax.
|
|
482
|
+
*/
|
|
483
|
+
const ACTION = /^[A-Za-z_][A-Za-z0-9_.\[\]"-]{0,299}$/;
|
|
468
484
|
/** The longest ask an agent comment may carry. */
|
|
469
485
|
export const PRODUCT_COMMENT_ASK_MAX = 2000;
|
|
470
486
|
/** Commands a comment never runs, named in the reply so nobody waits on them. */
|
|
@@ -530,6 +546,15 @@ export function parseProductComment(words: CiProductWords, body: unknown, env: R
|
|
|
530
546
|
if (/[\u0000-\u0008\u000b-\u001f\u007f]/.test(ask)) return { kind: "refused", reason: "an ask is plain text, with no control characters" };
|
|
531
547
|
return { kind: "agent", ask };
|
|
532
548
|
}
|
|
549
|
+
case "action": {
|
|
550
|
+
const usage = `${line} takes a ${words.noun[0]} and an action: \`${prefix} ${typed} <${words.noun[0]}> <action>\``;
|
|
551
|
+
if (parts.length !== 4) return { kind: "refused", reason: usage };
|
|
552
|
+
const member = parts[2]!;
|
|
553
|
+
const address = parts[3]!;
|
|
554
|
+
if (!MEMBER.test(member) || member.split("/").some((s) => s === "" || s === "." || s === "..")) return { kind: "refused", reason: `the ${words.noun[0]} is a name or a path from the repository root` };
|
|
555
|
+
if (!ACTION.test(address)) return { kind: "refused", reason: "an action is an action address or name, with no spaces or shell characters" };
|
|
556
|
+
return { kind: "action", member, address };
|
|
557
|
+
}
|
|
533
558
|
case "apply": {
|
|
534
559
|
if (parts.length === 2) return { kind: "apply" };
|
|
535
560
|
const m = parts.length === 3 ? /^wave-([1-9][0-9]{0,3})$/.exec(parts[2]!) : null;
|
|
@@ -563,3 +588,43 @@ export function parseProductComment(words: CiProductWords, body: unknown, env: R
|
|
|
563
588
|
}
|
|
564
589
|
}
|
|
565
590
|
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* The variables the generated action job (#4654) hands the product's action
|
|
594
|
+
* verb: the comment that started it, on a comment, and the dispatch's two
|
|
595
|
+
* inputs, on a dispatch. The values reach the job as variables and never as
|
|
596
|
+
* shell text; {@link productActionFromEnv} reads them.
|
|
597
|
+
*/
|
|
598
|
+
export const PRODUCT_ACTION_ENV = { comment: "CHANT_ACTION_COMMENT", member: "CHANT_ACTION_MEMBER", action: "CHANT_ACTION" } as const;
|
|
599
|
+
|
|
600
|
+
/** The flag the generated action job passes the product's action verb, so it reads {@link PRODUCT_ACTION_ENV} (#4654). */
|
|
601
|
+
export const PRODUCT_ACTION_EVENT_FLAG = "--from-event";
|
|
602
|
+
|
|
603
|
+
/** What an action job was asked for (#4654): a member and an action, from a comment or a dispatch. */
|
|
604
|
+
export type ProductActionRequest = { kind: "action"; member: string; address: string; from: "comment" | "dispatch" } | { kind: "refused"; reason: string };
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* The action an action job was started for (#4654), read from
|
|
608
|
+
* {@link PRODUCT_ACTION_ENV}: a comment, parsed as {@link parseProductComment}
|
|
609
|
+
* parses it, else the dispatch's member and action, checked by the same
|
|
610
|
+
* rules. A product's action verb calls this under
|
|
611
|
+
* {@link PRODUCT_ACTION_EVENT_FLAG}.
|
|
612
|
+
*/
|
|
613
|
+
export function productActionFromEnv(words: CiProductWords, env: Record<string, string | undefined>): ProductActionRequest {
|
|
614
|
+
const typed = commandWord(words, "action");
|
|
615
|
+
if (typed === undefined) return { kind: "refused", reason: `${words.product} names no action command, so no job answers one` };
|
|
616
|
+
const comment = env[PRODUCT_ACTION_ENV.comment]?.trim();
|
|
617
|
+
if (comment) {
|
|
618
|
+
const parsed = parseProductComment(words, comment, env);
|
|
619
|
+
if (parsed?.kind === "action") return { ...parsed, from: "comment" };
|
|
620
|
+
if (parsed?.kind === "refused") return parsed;
|
|
621
|
+
return { kind: "refused", reason: `the comment is not \`/${words.product} ${typed} <${words.noun[0]}> <action>\`` };
|
|
622
|
+
}
|
|
623
|
+
const member = env[PRODUCT_ACTION_ENV.member]?.trim() ?? "";
|
|
624
|
+
const action = env[PRODUCT_ACTION_ENV.action]?.trim() ?? "";
|
|
625
|
+
if (member === "" || action === "") return { kind: "refused", reason: `a dispatched action names a ${words.noun[0]} and an action` };
|
|
626
|
+
if (/\s/.test(member) || /\s/.test(action)) return { kind: "refused", reason: `a ${words.noun[0]} and an action are one word each` };
|
|
627
|
+
const parsed = parseProductComment(words, `/${words.product} ${typed} ${member} ${action}`, {});
|
|
628
|
+
if (parsed?.kind === "action") return { ...parsed, from: "dispatch" };
|
|
629
|
+
return parsed?.kind === "refused" ? parsed : { kind: "refused", reason: `a dispatched action names a ${words.noun[0]} and an action` };
|
|
630
|
+
}
|
package/src/ci-product.ts
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* and `assertProductWords` present means the rest is too.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { NEXT_RELEASE } from "./release-floors";
|
|
13
12
|
import type { CiProductWords, CiProductWordsInput } from "./ci-product-words";
|
|
14
13
|
import type { ProductMcpHook } from "./cli/mcp/product-tools";
|
|
15
14
|
import type { ProductWaveHook } from "./op/op-waves-after-plan";
|
|
16
15
|
import { OTLP_EXPORTER_FLOOR } from "./otlp";
|
|
16
|
+
import { NEXT_RELEASE } from "./release-floors";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* The first chant with the product pipeline (#4550): the words, the
|
|
@@ -41,6 +41,9 @@ export {
|
|
|
41
41
|
notifyWaveLabel,
|
|
42
42
|
overrideLine,
|
|
43
43
|
parseProductComment,
|
|
44
|
+
productActionFromEnv,
|
|
45
|
+
PRODUCT_ACTION_ENV,
|
|
46
|
+
PRODUCT_ACTION_EVENT_FLAG,
|
|
44
47
|
productContext,
|
|
45
48
|
productStatusContext,
|
|
46
49
|
productWaveGate,
|
|
@@ -60,6 +63,7 @@ export {
|
|
|
60
63
|
type CiProductWordsInput,
|
|
61
64
|
type OverrideLineInput,
|
|
62
65
|
type ParsedProductComment,
|
|
66
|
+
type ProductActionRequest,
|
|
63
67
|
} from "./ci-product-words";
|
|
64
68
|
export { driftNotifyFields, productNotifySource, productNotifyWords, productSendOptions, type DriftNotifyInput } from "./notify-product";
|
|
65
69
|
|
|
@@ -111,7 +115,19 @@ export {
|
|
|
111
115
|
type ProductPipelineJobs,
|
|
112
116
|
type ProductPipelineOptions,
|
|
113
117
|
} from "./components/product-pipeline";
|
|
114
|
-
export { prApplyComment, prCommentLockJobs, prCommentPreviewJob, prLoopSetup, engineSetupLines, withProductBin, type PrCommentLockJob, type PrCommentPreviewJob } from "./components/pr-pipeline";
|
|
118
|
+
export { prActionJob, PR_ACTION_JOB, prApplyComment, prCommentLockJobs, prCommentPreviewJob, prLoopSetup, engineSetupLines, withProductBin, type PrActionJob, type PrActionJobOptions, type PrCommentLockJob, type PrCommentPreviewJob } from "./components/pr-pipeline";
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Day-2 actions in the product pipeline (#4654): the `action` comment
|
|
122
|
+
* command counted as answered by the product's own workflow
|
|
123
|
+
* (`productPipelineJobs(forge, env, { words, actions: true })`), or the
|
|
124
|
+
* pipeline's own action job (`actionJob`, `build --pr-loop --action-job`),
|
|
125
|
+
* which answers the comment and a dispatch with a member and an action
|
|
126
|
+
* input, and runs the product's action verb with `--from-event`. The verb
|
|
127
|
+
* reads what was asked with `productActionFromEnv`. A product
|
|
128
|
+
* feature-detects on this floor.
|
|
129
|
+
*/
|
|
130
|
+
export const PRODUCT_ACTIONS_FLOOR = NEXT_RELEASE;
|
|
115
131
|
export { CI_SERVICES_FLOOR, engineServices, githubServices, gitlabServices, serviceWaitLine, servicesJobEnv, type CiService } from "./components/ci-services";
|
|
116
132
|
export { renderPrNote, prStatusContext, prApproveCommand, prApproveCommands, prApproveTargets, prMergeSentence, type PrMemberDetail } from "./pr-loop";
|
|
117
133
|
export { upsertPlanNote } from "./pr-post";
|
|
@@ -122,7 +138,7 @@ export { upsertPlanNote } from "./pr-post";
|
|
|
122
138
|
* open pull request's head. A product feature-detects on
|
|
123
139
|
* `APPROVAL_STATUS_FLOOR`.
|
|
124
140
|
*/
|
|
125
|
-
export const APPROVAL_STATUS_FLOOR =
|
|
141
|
+
export const APPROVAL_STATUS_FLOOR = "0.124.56";
|
|
126
142
|
/**
|
|
127
143
|
* The approval status for `pull-request` waves too (#4630, 2026-10-28
|
|
128
144
|
* ruling): the generators add the record-plans and approval-status jobs for
|
|
@@ -131,7 +147,7 @@ export const APPROVAL_STATUS_FLOOR = NEXT_RELEASE;
|
|
|
131
147
|
* as plywood, whose waves all take `approval: pull-request`, feature-detects
|
|
132
148
|
* on this floor.
|
|
133
149
|
*/
|
|
134
|
-
export const APPROVAL_STATUS_PULL_REQUEST_FLOOR =
|
|
150
|
+
export const APPROVAL_STATUS_PULL_REQUEST_FLOOR = "0.124.56";
|
|
135
151
|
export { opWavesPostsApprovalStatus } from "./op/op-waves";
|
|
136
152
|
export { approvalStatusOf, headWaveHolds, postApprovalStatus, postOpenApprovalStatuses, type ApprovalStatus, type ApprovalStatusInput } from "./op/approval-status";
|
|
137
153
|
|
|
@@ -141,7 +157,7 @@ export { approvalStatusOf, headWaveHolds, postApprovalStatus, postOpenApprovalSt
|
|
|
141
157
|
* words. `productPipelineJobs(forge, env, { words, respond, decide })` turns
|
|
142
158
|
* them on and off; a product feature-detects on `CI_RESPOND_FLOOR`.
|
|
143
159
|
*/
|
|
144
|
-
export const CI_RESPOND_FLOOR =
|
|
160
|
+
export const CI_RESPOND_FLOOR = "0.124.56";
|
|
145
161
|
|
|
146
162
|
/**
|
|
147
163
|
* `chant build --pr-loop` carries `--merge auto --merge-token-env <VAR>
|
|
@@ -150,7 +166,7 @@ export const CI_RESPOND_FLOOR = NEXT_RELEASE;
|
|
|
150
166
|
* the build parsed them and wrote jobs without them; a product that writes
|
|
151
167
|
* its pull request jobs with the build feature-detects on this floor.
|
|
152
168
|
*/
|
|
153
|
-
export const PR_LOOP_BUILD_FLAGS_FLOOR =
|
|
169
|
+
export const PR_LOOP_BUILD_FLAGS_FLOOR = "0.124.56";
|
|
154
170
|
export {
|
|
155
171
|
CI_RESPOND_DEFAULTS,
|
|
156
172
|
CI_RESPOND_ENV,
|
|
@@ -215,6 +231,20 @@ export { parseRequiresList, PR_APPLY_REQUIRES, type PrApplyRequire } from "./pr-
|
|
|
215
231
|
*/
|
|
216
232
|
export const PRODUCT_MCP_HOOK_FLOOR = OTLP_EXPORTER_FLOOR;
|
|
217
233
|
export type { ProductMcpContext, ProductMcpHook } from "./cli/mcp/product-tools";
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* The `--propose` tier (chant#4655): `runChantInProcess(["serve", "mcp",
|
|
237
|
+
* "--read-only", "--propose"], words, { mcp: hook })`, or `propose: true` on
|
|
238
|
+
* the hook, serves the read-only server's tools plus the product tools that
|
|
239
|
+
* declare `forgeWrite: true` on their `McpToolContribution`, tools that open
|
|
240
|
+
* a pull request or a comment and do nothing else. A product's own tool and
|
|
241
|
+
* hook types widen from `readOnly: true` to `readOnly: true` or `forgeWrite:
|
|
242
|
+
* true` for these, and its hook gains `propose?: boolean`. Feature-detect on
|
|
243
|
+
* `PRODUCT_MCP_PROPOSE_FLOOR`: on an older chant the read-only server drops a
|
|
244
|
+
* `forgeWrite` tool, and `--propose` is not a flag it parses.
|
|
245
|
+
*/
|
|
246
|
+
export { PRODUCT_MCP_PROPOSE_FLOOR, PRODUCT_TOOL_PROPOSE_WORDS } from "./cli/mcp/product-tools";
|
|
247
|
+
export type { McpToolContribution } from "./mcp/types";
|
|
218
248
|
export {
|
|
219
249
|
activeOtlp,
|
|
220
250
|
configureOtlp,
|
package/src/cli/commands/init.ts
CHANGED
|
@@ -34,6 +34,8 @@ export interface InitOptions {
|
|
|
34
34
|
skipMcp?: boolean;
|
|
35
35
|
/** Register `chant serve mcp --read-only` in `.mcp.json` (`--mcp-read-only`, chant#4543) */
|
|
36
36
|
mcpReadOnly?: boolean;
|
|
37
|
+
/** With `mcpReadOnly`, register `chant serve mcp --read-only --propose` (`--propose`, chant#4655) */
|
|
38
|
+
mcpPropose?: boolean;
|
|
37
39
|
/** Skip interactive install prompt */
|
|
38
40
|
skipInstall?: boolean;
|
|
39
41
|
/**
|
|
@@ -439,7 +441,7 @@ export async function initCommand(options: InitOptions): Promise<InitResult> {
|
|
|
439
441
|
if (!options.skipMcp) {
|
|
440
442
|
writeIfNotExists(
|
|
441
443
|
mcpConfigPath(targetDir),
|
|
442
|
-
generateMcpConfig(detectPackageManager(targetDir), { readOnly: options.mcpReadOnly }),
|
|
444
|
+
generateMcpConfig(detectPackageManager(targetDir), { readOnly: options.mcpReadOnly, propose: options.mcpPropose }),
|
|
443
445
|
MCP_CONFIG_FILENAME,
|
|
444
446
|
createdFiles,
|
|
445
447
|
warnings,
|
|
@@ -54,7 +54,9 @@ async function engineSetupFor(path: string): Promise<string[]> {
|
|
|
54
54
|
* `--apply-before-merge` (#4301) writes the apply job that applies an open
|
|
55
55
|
* pull request before it merges, beside the record job.
|
|
56
56
|
* `--preview-comment` (#4620) writes the jobs that answer the product's plan
|
|
57
|
-
* comment with a preview of the pull request's head.
|
|
57
|
+
* comment with a preview of the pull request's head. `--action-job` (#4654)
|
|
58
|
+
* writes the job that answers the product's action comment and a dispatch
|
|
59
|
+
* with a member and an action.
|
|
58
60
|
* `--pr-runner`, `--pr-variable`, `--pr-secret` and `--parallelism` (#4625)
|
|
59
61
|
* set each stage's runner, the plan and apply jobs' variables and passed
|
|
60
62
|
* secrets, and how many members the plan plans at once.
|
|
@@ -82,6 +84,8 @@ function prLoopOption(args: CommandContext["args"], reportUrl: string | undefine
|
|
|
82
84
|
...(args.prEnv ? { prEnvironment: true } : {}),
|
|
83
85
|
...(args.applyBeforeMerge ? { applyBeforeMerge: true } : {}),
|
|
84
86
|
...(args.previewComment ? { previewComment: true } : {}),
|
|
87
|
+
// #4654: the job that answers the action comment and the action dispatch.
|
|
88
|
+
...(args.actionJob ? { actionJob: true } : {}),
|
|
85
89
|
// #4628: the note carries its target commit, and a push marks the open notes stale.
|
|
86
90
|
...(args.staleNotes ? { staleNotes: true } : {}),
|
|
87
91
|
...(args.requires ? { applyRequires: args.requires } : {}),
|
package/src/cli/handlers/init.ts
CHANGED
|
@@ -6,6 +6,23 @@ export async function runInit(ctx: CommandContext): Promise<number> {
|
|
|
6
6
|
|
|
7
7
|
if (args.migrateFrom !== undefined) return runInitFrom(ctx);
|
|
8
8
|
|
|
9
|
+
// chant#4655 — --propose registers the read-only server's propose tier, so it needs --mcp-read-only.
|
|
10
|
+
if (args.propose === true && args.mcpReadOnly !== true) {
|
|
11
|
+
console.error(formatError({
|
|
12
|
+
message: "chant init --propose needs --mcp-read-only",
|
|
13
|
+
hint: "Usage: chant init --mcp-read-only --propose (registers chant serve mcp --read-only --propose in .mcp.json)",
|
|
14
|
+
}));
|
|
15
|
+
return 1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// chant#4655 — --dry-run prints the .mcp.json init would register and writes nothing.
|
|
19
|
+
if (args.dryRun === true) {
|
|
20
|
+
const { detectPackageManager, generateMcpConfig } = await import("../mcp-config");
|
|
21
|
+
const target = args.path === "." || args.path === undefined ? process.cwd() : args.path;
|
|
22
|
+
console.log(generateMcpConfig(detectPackageManager(target), { readOnly: args.mcpReadOnly, propose: args.propose }));
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
9
26
|
if (!args.lexicon) {
|
|
10
27
|
console.error(formatError({
|
|
11
28
|
message: "Missing --lexicon flag",
|
|
@@ -23,6 +40,7 @@ export async function runInit(ctx: CommandContext): Promise<number> {
|
|
|
23
40
|
force: args.force,
|
|
24
41
|
skipMcp: args.skipMcp,
|
|
25
42
|
mcpReadOnly: args.mcpReadOnly,
|
|
43
|
+
mcpPropose: args.propose,
|
|
26
44
|
skipInstall: true,
|
|
27
45
|
});
|
|
28
46
|
await printInitResult(result, { skipInstall: false, cwd: args.path });
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
} from "../../observation";
|
|
38
38
|
import { describeIdentities, identityStatusText, type IdentityRow } from "../../identity";
|
|
39
39
|
import { discoverComponents } from "../../components/discover";
|
|
40
|
+
import { changedFilesBetween, lexiconChangedUnits } from "../../components/changed-files";
|
|
40
41
|
import { cfnDeployStacks } from "./components";
|
|
41
42
|
import { affectedStacks } from "../../lifecycle/affected";
|
|
42
43
|
import { rollbackToRevision } from "../../lifecycle/rollback";
|
|
@@ -2131,6 +2132,18 @@ export async function runLifecycleAffected(ctx: CommandContext): Promise<number>
|
|
|
2131
2132
|
headRef: args.head,
|
|
2132
2133
|
includeDependents: args.includeDependents,
|
|
2133
2134
|
});
|
|
2135
|
+
// Units that are not chant source, a Terraform root or a Pulumi stack, never
|
|
2136
|
+
// show in the artifact diff; the lexicon that owns each answers from the
|
|
2137
|
+
// changed paths (#3183), as `components pr-plan` and `fan-out --base` add them.
|
|
2138
|
+
if (plugins.some((p) => p.changedUnits)) {
|
|
2139
|
+
const root = resolve(".");
|
|
2140
|
+
const units = await lexiconChangedUnits(plugins, {
|
|
2141
|
+
projectRoot: root,
|
|
2142
|
+
config: config as Record<string, unknown>,
|
|
2143
|
+
changedFiles: await changedFilesBetween(root, args.base, args.head ?? "HEAD"),
|
|
2144
|
+
});
|
|
2145
|
+
if (units.length > 0) result = { ...result, changed: [...new Set([...result.changed, ...units])].sort() };
|
|
2146
|
+
}
|
|
2134
2147
|
} catch (err) {
|
|
2135
2148
|
console.error(formatError({ message: err instanceof Error ? err.message : String(err) }));
|
|
2136
2149
|
return 1;
|
|
@@ -87,7 +87,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
87
87
|
}));
|
|
88
88
|
vi.mock("../../lifecycle/git", async () => {
|
|
89
89
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
90
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr.test must not push chant/lifecycle"); } };
|
|
90
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr.test must not push chant/lifecycle"); } };
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
vi.mock("./run", () => ({
|
|
@@ -38,7 +38,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
38
38
|
}));
|
|
39
39
|
vi.mock("../../lifecycle/git", async () => {
|
|
40
40
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
41
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-deploy-inputs.test must not push chant/lifecycle"); } };
|
|
41
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-deploy-inputs.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-deploy-inputs.test must not push chant/lifecycle"); } };
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
vi.mock("./run", () => ({
|
|
@@ -53,7 +53,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
53
53
|
}));
|
|
54
54
|
vi.mock("../../lifecycle/git", async () => {
|
|
55
55
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
56
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-endpoint.test must not push chant/lifecycle"); } };
|
|
56
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-endpoint.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-endpoint.test must not push chant/lifecycle"); } };
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
vi.mock("./run", () => ({
|
|
@@ -44,7 +44,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
44
44
|
}));
|
|
45
45
|
vi.mock("../../lifecycle/git", async () => {
|
|
46
46
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
47
|
-
return { ...actual, pushLifecycleReport: async () => ({}) };
|
|
47
|
+
return { ...actual, pushLifecycleReport: async () => ({}), pushLifecycleRebasing: async () => ({}) };
|
|
48
48
|
});
|
|
49
49
|
const applied: GreenApplyRecord[] = [];
|
|
50
50
|
vi.mock("../../lifecycle/green-apply", async () => {
|
|
@@ -44,7 +44,7 @@ vi.mock("./fan-out", () => ({
|
|
|
44
44
|
}));
|
|
45
45
|
vi.mock("../../lifecycle/git", async () => {
|
|
46
46
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
47
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-plan-comment-targets.test must not push chant/lifecycle"); } };
|
|
47
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-plan-comment-targets.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-plan-comment-targets.test must not push chant/lifecycle"); } };
|
|
48
48
|
});
|
|
49
49
|
vi.mock("./run", () => ({
|
|
50
50
|
GATED_EXIT_CODE: 3,
|
|
@@ -45,7 +45,7 @@ vi.mock("./fan-out", () => ({
|
|
|
45
45
|
}));
|
|
46
46
|
vi.mock("../../lifecycle/git", async () => {
|
|
47
47
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
48
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-plan-flags.test must not push chant/lifecycle"); } };
|
|
48
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-plan-flags.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-plan-flags.test must not push chant/lifecycle"); } };
|
|
49
49
|
});
|
|
50
50
|
vi.mock("./run", () => ({
|
|
51
51
|
GATED_EXIT_CODE: 3,
|
|
@@ -44,7 +44,7 @@ vi.mock("./fan-out", () => ({
|
|
|
44
44
|
}));
|
|
45
45
|
vi.mock("../../lifecycle/git", async () => {
|
|
46
46
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
47
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-plan-targets.test must not push chant/lifecycle"); } };
|
|
47
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-plan-targets.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-plan-targets.test must not push chant/lifecycle"); } };
|
|
48
48
|
});
|
|
49
49
|
vi.mock("./run", () => ({
|
|
50
50
|
GATED_EXIT_CODE: 3,
|
|
@@ -44,14 +44,20 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
44
44
|
}));
|
|
45
45
|
vi.mock("../../lifecycle/git", async () => {
|
|
46
46
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
47
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr.test must not push chant/lifecycle"); } };
|
|
47
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => pushRebasing() };
|
|
48
48
|
});
|
|
49
|
+
// The record's push: never the real one. A test that writes the record sets what it answers.
|
|
50
|
+
let pushRebasing: () => Promise<{ pushed: boolean; pushWarning?: string }> = async () => {
|
|
51
|
+
throw new Error("pr.test must not push chant/lifecycle");
|
|
52
|
+
};
|
|
49
53
|
|
|
50
54
|
// #4168: the record job writes the merge record on chant/lifecycle. Captured here, never written.
|
|
55
|
+
// `recordWrites` makes the write say it wrote, so the record job pushes.
|
|
51
56
|
const written: Array<Record<string, unknown>> = [];
|
|
57
|
+
let recordWrites = false;
|
|
52
58
|
vi.mock("../../lifecycle/merge-record", async () => {
|
|
53
59
|
const actual = await vi.importActual<typeof import("../../lifecycle/merge-record")>("../../lifecycle/merge-record");
|
|
54
|
-
return { ...actual, writeMergeRecord: async (r: Record<string, unknown>) => (written.push(r), { commit: null, written: false }) };
|
|
60
|
+
return { ...actual, writeMergeRecord: async (r: Record<string, unknown>) => (written.push(r), recordWrites ? { commit: "c".repeat(40), written: true } : { commit: null, written: false }) };
|
|
55
61
|
});
|
|
56
62
|
|
|
57
63
|
vi.mock("./run", () => ({
|
|
@@ -131,6 +137,10 @@ beforeEach(async () => {
|
|
|
131
137
|
errors = [];
|
|
132
138
|
applied = [];
|
|
133
139
|
written.length = 0;
|
|
140
|
+
recordWrites = false;
|
|
141
|
+
pushRebasing = async () => {
|
|
142
|
+
throw new Error("pr.test must not push chant/lifecycle");
|
|
143
|
+
};
|
|
134
144
|
failing.clear();
|
|
135
145
|
refusal.clear();
|
|
136
146
|
onRun = (r) => applied.push(r);
|
|
@@ -191,6 +201,28 @@ describe("pr-record (#4168)", () => {
|
|
|
191
201
|
expect(written[0]).toMatchObject({ source: { kind: "direct-push" }, op: null, plan: "unapproved" });
|
|
192
202
|
});
|
|
193
203
|
|
|
204
|
+
// #4551: the merge record goes out through the fetch-replay-retry push, and one that never reaches the remote fails the job.
|
|
205
|
+
test("a merge record pushed through the retrying push exits 0", async () => {
|
|
206
|
+
recordWrites = true;
|
|
207
|
+
let pushes = 0;
|
|
208
|
+
pushRebasing = async () => (pushes++, { pushed: true });
|
|
209
|
+
expect(await runComponentsPrRecord(ctx({ pr: 12 }))).toBe(0);
|
|
210
|
+
expect(pushes).toBe(1);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test("a merge record the remote never takes fails the job with LifecyclePushLostError's words, and the report is still written", async () => {
|
|
214
|
+
const { LifecyclePushLostError } = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
215
|
+
recordWrites = true;
|
|
216
|
+
pushRebasing = async () => {
|
|
217
|
+
throw new LifecyclePushLostError("origin", 3, "another writer pushed before each try");
|
|
218
|
+
};
|
|
219
|
+
expect(await runComponentsPrRecord(ctx({ pr: 12 }))).toBe(1);
|
|
220
|
+
expect(report("record")).toMatchObject({ status: "recorded", pr: 12 });
|
|
221
|
+
const said = errors.join("\n");
|
|
222
|
+
expect(said).toContain(`the merge record for ${HEAD} was written but not pushed`);
|
|
223
|
+
expect(said).toContain('chant/lifecycle was not pushed to "origin" after 3 tries');
|
|
224
|
+
});
|
|
225
|
+
|
|
194
226
|
test("a member that fails to plan is recorded as plan-failed and exits 1", async () => {
|
|
195
227
|
const plan = vi.spyOn(await import("../../components/pr-run"), "planPrSet");
|
|
196
228
|
plan.mockImplementationOnce(async (input) => ({ ...(await (await vi.importActual<typeof import("../../components/pr-run")>("../../components/pr-run")).planPrSet(input)), failed: true }));
|
|
@@ -50,7 +50,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
50
50
|
}));
|
|
51
51
|
vi.mock("../../lifecycle/git", async () => {
|
|
52
52
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
53
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-waves.test must not push chant/lifecycle"); } };
|
|
53
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-waves.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-waves.test must not push chant/lifecycle"); } };
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
// The declaration at base sets no hooks, policy, security group or lock, and the change adds no migration (#4502).
|
|
@@ -45,7 +45,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
45
45
|
}));
|
|
46
46
|
vi.mock("../../lifecycle/git", async () => {
|
|
47
47
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
48
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-waves.test must not push chant/lifecycle"); } };
|
|
48
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr-waves.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr-waves.test must not push chant/lifecycle"); } };
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
vi.mock("./run", () => ({
|
|
@@ -78,7 +78,7 @@ vi.mock("../../lifecycle/gate-change-set", () => ({
|
|
|
78
78
|
}));
|
|
79
79
|
vi.mock("../../lifecycle/git", async () => {
|
|
80
80
|
const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
|
|
81
|
-
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr.test must not push chant/lifecycle"); } };
|
|
81
|
+
return { ...actual, pushLifecycleReport: async () => { throw new Error("pr.test must not push chant/lifecycle"); }, pushLifecycleRebasing: async () => { throw new Error("pr.test must not push chant/lifecycle"); } };
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
vi.mock("./run", () => ({
|