@intentius/chant 0.124.57 → 0.124.59
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-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 +25 -2
- 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-drift.d.ts +2 -1
- package/dist/cli/handlers/lifecycle-drift.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle-drift.js +4 -2
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +45 -2
- 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 +11 -3
- 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 +58 -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 +27 -0
- package/dist/cli/registry.d.ts +14 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/pr-pipeline.d.ts +56 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +55 -2
- 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/drift-record.d.ts +5 -0
- package/dist/drift-record.d.ts.map +1 -1
- 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 +10 -1
- 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/lifecycle/lock-beat.d.ts +27 -0
- package/dist/lifecycle/lock-beat.d.ts.map +1 -0
- package/dist/lifecycle/lock-beat.js +84 -0
- package/dist/lifecycle/resource-lock.d.ts +54 -1
- package/dist/lifecycle/resource-lock.d.ts.map +1 -1
- package/dist/lifecycle/resource-lock.js +128 -7
- package/dist/mcp/types.d.ts +9 -0
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/op/activities/activity-contracts.d.ts +4 -4
- package/dist/op/index.d.ts +1 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/op-waves-notify.d.ts.map +1 -1
- package/dist/op/op-waves-notify.js +11 -0
- package/dist/op/op-waves-run.d.ts +28 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +92 -7
- package/dist/op/op-waves.d.ts +12 -1
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +9 -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 +149 -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 +298 -298
- package/dist/workspace/drift-cli.d.ts +13 -1
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +19 -3
- package/package.json +8 -1
- package/src/ci-product-words.test.ts +23 -0
- package/src/ci-product-words.ts +68 -3
- package/src/ci-product.ts +31 -1
- 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-drift.test.ts +52 -0
- package/src/cli/handlers/lifecycle-drift.ts +4 -2
- package/src/cli/handlers/lock.ts +41 -2
- package/src/cli/handlers/serve.ts +9 -0
- package/src/cli/main.ts +11 -3
- package/src/cli/mcp/product-tools.test.ts +56 -1
- package/src/cli/mcp/product-tools.ts +66 -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 +19 -0
- package/src/cli/registry.ts +14 -0
- package/src/components/pr-pipeline.ts +87 -2
- package/src/components/product-actions.test.ts +76 -0
- package/src/components/product-pipeline.ts +21 -2
- package/src/drift-record.ts +5 -0
- 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 +11 -1
- 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/lifecycle/lock-beat.ts +99 -0
- package/src/lifecycle/resource-lock-liveness.test.ts +289 -0
- package/src/lifecycle/resource-lock.ts +143 -8
- package/src/mcp/types.ts +9 -0
- package/src/op/index.ts +1 -0
- package/src/op/op-waves-notify.ts +11 -0
- package/src/op/op-waves-preview.test.ts +167 -0
- package/src/op/op-waves-run.ts +116 -8
- package/src/op/op-waves.ts +20 -3
- 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 +315 -0
- package/src/template-request/template-request.ts +234 -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/src/workspace/drift-cli.test.ts +35 -1
- package/src/workspace/drift-cli.ts +21 -3
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* chant's reports land, chant run outside the pipeline, the ledger, and time.
|
|
5
5
|
* The real ones are ./forgejo.ts and ./bucket.ts; tests pass fakes.
|
|
6
6
|
*/
|
|
7
|
+
import type { GatedRequestRead } from "../lifecycle/gated-request.js";
|
|
7
8
|
import type { OpRunRecord } from "../op/runtime.js";
|
|
8
9
|
/** A forge repository as the author, the reviewer and the admin: the pull request loop. */
|
|
9
10
|
export interface PullForge {
|
|
@@ -44,6 +45,17 @@ export interface ForgeIssue {
|
|
|
44
45
|
body: string;
|
|
45
46
|
open: boolean;
|
|
46
47
|
}
|
|
48
|
+
/** An open pull request as the forge reads it. */
|
|
49
|
+
export interface ForgePull {
|
|
50
|
+
number: number;
|
|
51
|
+
title: string;
|
|
52
|
+
/** Its head branch. */
|
|
53
|
+
branch: string;
|
|
54
|
+
/** Its head commit's sha. */
|
|
55
|
+
head: string;
|
|
56
|
+
}
|
|
57
|
+
/** Who on the forge a comment comes from. */
|
|
58
|
+
export type ForgePerson = "author" | "reviewer" | "admin";
|
|
47
59
|
/**
|
|
48
60
|
* sql-yodeler's Forge verbs (scenarios/forges/forge.ts:26-61) that the pull
|
|
49
61
|
* request loop lacks. `openPr` and `merge` there are `openPull` and
|
|
@@ -55,6 +67,18 @@ export interface ForgeReads {
|
|
|
55
67
|
comments(pull: number): Promise<string[]>;
|
|
56
68
|
/** The repository's issues, open and closed, without pull requests. */
|
|
57
69
|
issues(): Promise<ForgeIssue[]>;
|
|
70
|
+
/**
|
|
71
|
+
* The OPEN pull request from `branch` in this repository (a fork's branch
|
|
72
|
+
* of the same name is not it), or undefined. The oldest when there are
|
|
73
|
+
* several. A product opens it, and the await-pull step finds it.
|
|
74
|
+
*/
|
|
75
|
+
findPull(branch: string): Promise<ForgePull | undefined>;
|
|
76
|
+
/** Pull request `pull`, open or not, or undefined when the forge does not know it. */
|
|
77
|
+
pullInfo(pull: number): Promise<ForgePull | undefined>;
|
|
78
|
+
/** The repo-relative paths pull request `pull` changes, a renamed file under its new path. */
|
|
79
|
+
changedFiles(pull: number): Promise<string[]>;
|
|
80
|
+
/** Post `body` as a comment on pull request `pull`, as `as`. */
|
|
81
|
+
postComment(pull: number, body: string, as: ForgePerson): Promise<void>;
|
|
58
82
|
}
|
|
59
83
|
export interface ForgeRuns {
|
|
60
84
|
/** The apply again, started by hand on main at `sha` (workflow dispatch of `workflow`). */
|
|
@@ -96,6 +120,13 @@ export interface Chant {
|
|
|
96
120
|
/** The run ledger of the scenario's repo (`chant/lifecycle`), read. */
|
|
97
121
|
export interface Ledger {
|
|
98
122
|
runs(env: string, op: string): Promise<OpRunRecord[]>;
|
|
123
|
+
/**
|
|
124
|
+
* The gated requests of `op`, oldest first, for the gated outcome. A gated
|
|
125
|
+
* request writes no op-run record, so `runs` never sees it. The real one
|
|
126
|
+
* is `readGatedRequests(op, location)` from the lifecycle module, on the
|
|
127
|
+
* scenario repo's ledger.
|
|
128
|
+
*/
|
|
129
|
+
gatedRequests?(op: string): Promise<GatedRequestRead[]>;
|
|
99
130
|
}
|
|
100
131
|
/** Work outside the forge and chant: a change made out of band. */
|
|
101
132
|
export interface OutOfBand {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/ports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,2FAA2F;AAC3F,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5F,sFAAsF;IACtF,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvE,+DAA+D;IAC/D,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,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AAE,CAAC,CAAC;IACtD;;;;;OAKG;IACH,aAAa,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;CACzD;AAED,mEAAmE;AACnE,MAAM,WAAW,SAAS;IACxB,qFAAqF;IACrF,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAED,uDAAuD;AACvD,MAAM,WAAW,KAAK;IACpB,GAAG,IAAI,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,eAAO,MAAM,SAAS,EAAE,KAGvB,CAAC;AAEF,oDAAoD;AACpD,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/scenario.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/scenario.ts"],"names":[],"mappings":"AASA,OAAO,EAAoB,KAAK,QAAQ,EAAqB,MAAM,iBAAiB,CAAC;AAErF,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,EAAE,CAgE7D;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAKnD"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* a repo tree, an ordered list of pull request steps, and the outcomes each
|
|
4
4
|
* step must show. The lint refuses one that cannot record a row: no claim
|
|
5
5
|
* id, no BREAK arm, nothing to check, or a step that names a pull request or
|
|
6
|
-
* a merge no earlier step made.
|
|
6
|
+
* a merge no earlier step made. An await-pull step makes a pull request as
|
|
7
|
+
* an open step does.
|
|
7
8
|
*/
|
|
8
9
|
import { readFileSync } from "node:fs";
|
|
9
10
|
import { validateScenario } from "./schemas/index.js";
|
|
@@ -37,7 +38,7 @@ export function lintScenario(data) {
|
|
|
37
38
|
out.push({ at: `${at}/id`, message: `step id ${step.id} is used twice` });
|
|
38
39
|
const opened = (id) => {
|
|
39
40
|
const o = seen.get(id);
|
|
40
|
-
return o !== undefined && (o.do === "open" || o.do === "open-concurrent");
|
|
41
|
+
return o !== undefined && (o.do === "open" || o.do === "open-concurrent" || o.do === "await-pull");
|
|
41
42
|
};
|
|
42
43
|
switch (step.do) {
|
|
43
44
|
case "open-concurrent": {
|
|
@@ -50,8 +51,9 @@ export function lintScenario(data) {
|
|
|
50
51
|
case "plan":
|
|
51
52
|
case "approve":
|
|
52
53
|
case "merge":
|
|
54
|
+
case "comment":
|
|
53
55
|
if (!opened(step.pull))
|
|
54
|
-
out.push({ at: `${at}/pull`, message: `${step.do} names ${step.pull}, which is not an earlier open step` });
|
|
56
|
+
out.push({ at: `${at}/pull`, message: `${step.do} names ${step.pull}, which is not an earlier open or await-pull step` });
|
|
55
57
|
break;
|
|
56
58
|
case "apply": {
|
|
57
59
|
const m = seen.get(step.merge);
|
|
@@ -67,9 +69,11 @@ export function lintScenario(data) {
|
|
|
67
69
|
if ("report" in e && step.do !== "plan" && step.do !== "apply") {
|
|
68
70
|
out.push({ at: `${at}/expect/${j}`, message: `a report outcome belongs on a plan or apply step, not ${step.do}` });
|
|
69
71
|
}
|
|
70
|
-
|
|
72
|
+
const hasPull = "pull" in step || step.do === "open" || step.do === "open-concurrent" || step.do === "await-pull";
|
|
73
|
+
if ("comment" in e && !hasPull)
|
|
71
74
|
out.push({ at: `${at}/expect/${j}`, message: "a comment outcome belongs on a step with a pull request" });
|
|
72
|
-
|
|
75
|
+
if ("pull" in e && !hasPull)
|
|
76
|
+
out.push({ at: `${at}/expect/${j}`, message: "a pull outcome belongs on a step with a pull request" });
|
|
73
77
|
if ("exit" in e && step.do !== "out-of-band")
|
|
74
78
|
out.push({ at: `${at}/expect/${j}`, message: "an exit outcome belongs on an out-of-band step" });
|
|
75
79
|
}
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"$defs": {
|
|
57
57
|
"name": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
|
|
58
|
-
"do": { "enum": ["open", "open-concurrent", "plan", "approve", "merge", "apply", "out-of-band", "kill-job"] },
|
|
58
|
+
"do": { "enum": ["open", "open-concurrent", "await-pull", "plan", "approve", "merge", "comment", "apply", "out-of-band", "kill-job"] },
|
|
59
59
|
"step": {
|
|
60
60
|
"type": "object",
|
|
61
61
|
"required": ["id", "do"],
|
|
@@ -81,10 +81,29 @@
|
|
|
81
81
|
"type": "object",
|
|
82
82
|
"properties": {
|
|
83
83
|
"do": { "enum": ["plan", "approve", "merge"] },
|
|
84
|
-
"pull": { "$ref": "#/$defs/name", "description": "The id of the open step whose pull request this is." }
|
|
84
|
+
"pull": { "$ref": "#/$defs/name", "description": "The id of the open or await-pull step whose pull request this is." }
|
|
85
85
|
},
|
|
86
86
|
"required": ["pull"]
|
|
87
87
|
},
|
|
88
|
+
{
|
|
89
|
+
"type": "object",
|
|
90
|
+
"properties": {
|
|
91
|
+
"do": { "const": "await-pull" },
|
|
92
|
+
"branch": { "type": "string", "minLength": 1, "description": "The exact head branch of the pull request a product opens. Both runs wait for this same branch: the BREAK run does not add -break to it." },
|
|
93
|
+
"title": { "type": "string", "minLength": 1, "description": "Text the pull request's title must hold, when given." }
|
|
94
|
+
},
|
|
95
|
+
"required": ["branch"]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"type": "object",
|
|
99
|
+
"properties": {
|
|
100
|
+
"do": { "const": "comment" },
|
|
101
|
+
"pull": { "$ref": "#/$defs/name", "description": "The id of the open or await-pull step whose pull request the comment goes on." },
|
|
102
|
+
"body": { "type": "string", "minLength": 1 },
|
|
103
|
+
"as": { "enum": ["author", "reviewer", "admin"], "description": "Who posts it. Default author." }
|
|
104
|
+
},
|
|
105
|
+
"required": ["pull", "body"]
|
|
106
|
+
},
|
|
88
107
|
{
|
|
89
108
|
"type": "object",
|
|
90
109
|
"properties": {
|
|
@@ -112,7 +131,7 @@
|
|
|
112
131
|
},
|
|
113
132
|
"outcome": {
|
|
114
133
|
"type": "object",
|
|
115
|
-
"description": "One thing a step must show. report reads the step's pr-plan.json or pr-apply.json; ledger reads the run records the scenario added; comment and
|
|
134
|
+
"description": "One thing a step must show. report reads the step's pr-plan.json or pr-apply.json; ledger reads the run records the scenario added; gated reads the gated requests the scenario added; comment, issue and pull read the forge; exit is an out-of-band command's exit code.",
|
|
116
135
|
"minProperties": 1,
|
|
117
136
|
"maxProperties": 1,
|
|
118
137
|
"additionalProperties": false,
|
|
@@ -136,7 +155,28 @@
|
|
|
136
155
|
"count": { "type": "integer", "minimum": 0 }
|
|
137
156
|
}
|
|
138
157
|
},
|
|
158
|
+
"gated": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"required": ["op"],
|
|
161
|
+
"additionalProperties": false,
|
|
162
|
+
"description": "Gated requests of op on the ledger, asked since the run started. A request is gated until a finished line names it, then ok when it applied and failed when it did not.",
|
|
163
|
+
"properties": {
|
|
164
|
+
"op": { "type": "string" },
|
|
165
|
+
"status": { "enum": ["gated", "ok", "failed"] },
|
|
166
|
+
"count": { "type": "integer", "minimum": 0 }
|
|
167
|
+
}
|
|
168
|
+
},
|
|
139
169
|
"comment": { "type": "string", "minLength": 1, "description": "Text one of the step's pull request comments holds." },
|
|
170
|
+
"pull": {
|
|
171
|
+
"type": "object",
|
|
172
|
+
"additionalProperties": false,
|
|
173
|
+
"description": "The step's pull request: its title holds title, it changes every path in files, and with only it changes no other path.",
|
|
174
|
+
"properties": {
|
|
175
|
+
"title": { "type": "string", "minLength": 1 },
|
|
176
|
+
"files": { "type": "array", "items": { "type": "string", "minLength": 1 } },
|
|
177
|
+
"only": { "type": "boolean", "description": "files names every path the pull request changes." }
|
|
178
|
+
}
|
|
179
|
+
},
|
|
140
180
|
"issue": {
|
|
141
181
|
"type": "object",
|
|
142
182
|
"required": ["title"],
|
|
@@ -76,7 +76,7 @@ export interface DemoCycle {
|
|
|
76
76
|
steps: DemoCycleStep[];
|
|
77
77
|
reports?: DemoCycleReport[];
|
|
78
78
|
}
|
|
79
|
-
export declare const SCENARIO_STEP_KINDS: readonly ["open", "open-concurrent", "plan", "approve", "merge", "apply", "out-of-band", "kill-job"];
|
|
79
|
+
export declare const SCENARIO_STEP_KINDS: readonly ["open", "open-concurrent", "await-pull", "plan", "approve", "merge", "comment", "apply", "out-of-band", "kill-job"];
|
|
80
80
|
export type ScenarioStepKind = (typeof SCENARIO_STEP_KINDS)[number];
|
|
81
81
|
/** One thing a step must show. Exactly one key is set. */
|
|
82
82
|
export type ScenarioOutcome = {
|
|
@@ -91,8 +91,20 @@ export type ScenarioOutcome = {
|
|
|
91
91
|
status?: "ok" | "fail" | "gated" | "waiting";
|
|
92
92
|
count?: number;
|
|
93
93
|
};
|
|
94
|
+
} | {
|
|
95
|
+
gated: {
|
|
96
|
+
op: string;
|
|
97
|
+
status?: "gated" | "ok" | "failed";
|
|
98
|
+
count?: number;
|
|
99
|
+
};
|
|
94
100
|
} | {
|
|
95
101
|
comment: string;
|
|
102
|
+
} | {
|
|
103
|
+
pull: {
|
|
104
|
+
title?: string;
|
|
105
|
+
files?: string[];
|
|
106
|
+
only?: boolean;
|
|
107
|
+
};
|
|
96
108
|
} | {
|
|
97
109
|
issue: {
|
|
98
110
|
title: string;
|
|
@@ -112,9 +124,18 @@ export type ScenarioStep = (StepBase & {
|
|
|
112
124
|
overlay: string;
|
|
113
125
|
title: string;
|
|
114
126
|
body?: string;
|
|
127
|
+
}) | (StepBase & {
|
|
128
|
+
do: "await-pull";
|
|
129
|
+
branch: string;
|
|
130
|
+
title?: string;
|
|
115
131
|
}) | (StepBase & {
|
|
116
132
|
do: "plan" | "approve" | "merge";
|
|
117
133
|
pull: string;
|
|
134
|
+
}) | (StepBase & {
|
|
135
|
+
do: "comment";
|
|
136
|
+
pull: string;
|
|
137
|
+
body: string;
|
|
138
|
+
as?: "author" | "reviewer" | "admin";
|
|
118
139
|
}) | (StepBase & {
|
|
119
140
|
do: "apply";
|
|
120
141
|
merge: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/e2e-harness/schemas/index.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,gBAAgB,+EAA+E,CAAC;AAC7G,eAAO,MAAM,iBAAiB,iFAAiF,CAAC;AAChH,eAAO,MAAM,mBAAmB,4FAA4F,CAAC;AAC7H,eAAO,MAAM,oBAAoB,8FAA8F,CAAC;AAChI,eAAO,MAAM,iBAAiB,wFAAwF,CAAC;AAIvH,eAAO,MAAM,UAAU,YACrB,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,SAAS,CACD,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACv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AC,QAAQ,CAAkC,CAAC;AACvG,eAAO,MAAM,iBAAiB,SAAU,OAAO,KAAG,UAAU,CAAC,SAAS,CAAmC,CAAC;AAC1G,eAAO,MAAM,gBAAgB,SAAU,OAAO,KAAG,UAAU,CAAC,QAAQ,CAAqC,CAAC;AAC1G,eAAO,MAAM,gBAAgB,SAAU,OAAO,KAAG,UAAU,CAAC,QAAQ,CAAsC,CAAC;AAC3G,eAAO,MAAM,cAAc,SAAU,OAAO,KAAG,UAAU,CAAC,SAAS,CAAmC,CAAC"}
|
|
@@ -33,7 +33,7 @@ export const DEMO_STEPS = [
|
|
|
33
33
|
"stalled",
|
|
34
34
|
];
|
|
35
35
|
// ── e2e-scenario/v1 ───────────────────────────────────────────────────
|
|
36
|
-
export const SCENARIO_STEP_KINDS = ["open", "open-concurrent", "plan", "approve", "merge", "apply", "out-of-band", "kill-job"];
|
|
36
|
+
export const SCENARIO_STEP_KINDS = ["open", "open-concurrent", "await-pull", "plan", "approve", "merge", "comment", "apply", "out-of-band", "kill-job"];
|
|
37
37
|
let ajv;
|
|
38
38
|
function validatorFor(id) {
|
|
39
39
|
if (!ajv) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/steps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/steps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,qDAAqD;AACrD,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAoB3D,CAAC;AAEF,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,IAAI,GAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAM,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAEhH"}
|
|
@@ -3,12 +3,16 @@ export const HARNESS_LIMITS = {
|
|
|
3
3
|
/** The branch push and the pull request open. */
|
|
4
4
|
open: 60,
|
|
5
5
|
"open-concurrent": 60,
|
|
6
|
+
/** An open pull request from the branch, which a product opens. */
|
|
7
|
+
"await-pull": 300,
|
|
6
8
|
/** pr-plan.json at the head, from the push. */
|
|
7
9
|
plan: 600,
|
|
8
10
|
/** The forge review and chant approve. */
|
|
9
11
|
approve: 120,
|
|
10
12
|
/** The merge and its merge commit. */
|
|
11
13
|
merge: 60,
|
|
14
|
+
/** Posting a comment on the pull request. */
|
|
15
|
+
comment: 60,
|
|
12
16
|
/** pr-apply.json at the merge commit, from the merge. */
|
|
13
17
|
apply: 900,
|
|
14
18
|
/** A command run out of band. */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { LockBeatStarter } from "./resource-lock.js";
|
|
2
|
+
/** Record how to run this chant again; called by the CLI entry point. */
|
|
3
|
+
export declare function setOwnChantCommand(command: readonly string[] | undefined): void;
|
|
4
|
+
/** The starter of the heartbeat side process, or undefined outside the chant CLI or when `CHANT_LOCK_BEAT=off`. */
|
|
5
|
+
export declare function ownBeatStarter(env?: Record<string, string | undefined>): LockBeatStarter | undefined;
|
|
6
|
+
export interface BeatLoop {
|
|
7
|
+
gate: string;
|
|
8
|
+
run: string;
|
|
9
|
+
/** The process whose end ends the loop. */
|
|
10
|
+
parent: number;
|
|
11
|
+
intervalMs: number;
|
|
12
|
+
/** Touch the hold: `gone` ends the loop. */
|
|
13
|
+
beat(at: string): Promise<"held" | "gone">;
|
|
14
|
+
parentAlive?(pid: number): boolean;
|
|
15
|
+
sleep?(ms: number): Promise<void>;
|
|
16
|
+
now?(): number;
|
|
17
|
+
/** Where a failed touch is said. */
|
|
18
|
+
log?(line: string): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Touch the hold now and every interval until it is released or taken over
|
|
22
|
+
* (`released`) or the parent process ends (`parent-gone`). A touch that fails
|
|
23
|
+
* is tried again at the next interval; the hold goes stale only after
|
|
24
|
+
* `CHANT_LOCK_BEAT_STALE` seconds of failures.
|
|
25
|
+
*/
|
|
26
|
+
export declare function runBeatLoop(loop: BeatLoop): Promise<"released" | "parent-gone">;
|
|
27
|
+
//# sourceMappingURL=lock-beat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock-beat.d.ts","sourceRoot":"","sources":["../../src/lifecycle/lock-beat.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIvD,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CAE/E;AAED,mHAAmH;AACnH,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,eAAe,GAAG,SAAS,CAuBjH;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC3C,WAAW,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,KAAK,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,GAAG,CAAC,IAAI,MAAM,CAAC;IACf,oCAAoC;IACpC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAWD;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,GAAG,aAAa,CAAC,CAarF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The heartbeat of a row hold (#4660). A job that is cancelled or killed
|
|
3
|
+
* never runs its cleanup, so the hold it took stays on `chant/lifecycle`
|
|
4
|
+
* and later waves on the stack wait on it. The hold carries a liveness
|
|
5
|
+
* token, `beat`, that a side process of the apply refreshes every
|
|
6
|
+
* `CHANT_LOCK_BEAT` seconds. The next waiter reads a hold whose beat is
|
|
7
|
+
* older than `CHANT_LOCK_BEAT_STALE` seconds as gone and takes it over
|
|
8
|
+
* (./resource-lock.ts `forgeLockLiveness`).
|
|
9
|
+
*
|
|
10
|
+
* The beat runs in its own process because an apply waits on its tool with
|
|
11
|
+
* `spawnSync`, which stops every timer of the job's process. The side
|
|
12
|
+
* process is `chant lock --beat <run> --parent <pid>`: it touches the hold,
|
|
13
|
+
* and ends when the hold is gone or when the job's process is. A job that is
|
|
14
|
+
* killed takes it along, and one that is not leaves a beat that goes stale.
|
|
15
|
+
*
|
|
16
|
+
* Only the chant CLI starts one ({@link setOwnChantCommand}); library
|
|
17
|
+
* callers and tests start none, and a hold without a beat keeps the forge
|
|
18
|
+
* and lease rules.
|
|
19
|
+
*/
|
|
20
|
+
import { spawn } from "node:child_process";
|
|
21
|
+
let own;
|
|
22
|
+
/** Record how to run this chant again; called by the CLI entry point. */
|
|
23
|
+
export function setOwnChantCommand(command) {
|
|
24
|
+
own = command && command.length > 0 && command.every((c) => typeof c === "string" && c !== "") ? [...command] : undefined;
|
|
25
|
+
}
|
|
26
|
+
/** The starter of the heartbeat side process, or undefined outside the chant CLI or when `CHANT_LOCK_BEAT=off`. */
|
|
27
|
+
export function ownBeatStarter(env = process.env) {
|
|
28
|
+
if (!own || env.CHANT_LOCK_BEAT === "off")
|
|
29
|
+
return undefined;
|
|
30
|
+
const command = own;
|
|
31
|
+
return ({ gate, holder, cwd }) => {
|
|
32
|
+
const [bin, ...lead] = command;
|
|
33
|
+
const child = spawn(bin, [...lead, "lock", "--beat", holder.run, "--gate", gate, "--parent", String(process.pid)], {
|
|
34
|
+
...(cwd ? { cwd } : {}),
|
|
35
|
+
detached: true,
|
|
36
|
+
stdio: "ignore",
|
|
37
|
+
env,
|
|
38
|
+
});
|
|
39
|
+
child.on("error", () => {
|
|
40
|
+
// No side process: the hold keeps the forge and lease rules.
|
|
41
|
+
});
|
|
42
|
+
child.unref();
|
|
43
|
+
return () => {
|
|
44
|
+
try {
|
|
45
|
+
child.kill("SIGTERM");
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// Already gone.
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function processAlive(pid) {
|
|
54
|
+
try {
|
|
55
|
+
process.kill(pid, 0);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
return e.code === "EPERM";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Touch the hold now and every interval until it is released or taken over
|
|
64
|
+
* (`released`) or the parent process ends (`parent-gone`). A touch that fails
|
|
65
|
+
* is tried again at the next interval; the hold goes stale only after
|
|
66
|
+
* `CHANT_LOCK_BEAT_STALE` seconds of failures.
|
|
67
|
+
*/
|
|
68
|
+
export async function runBeatLoop(loop) {
|
|
69
|
+
const alive = loop.parentAlive ?? processAlive;
|
|
70
|
+
const sleep = loop.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
71
|
+
const now = loop.now ?? Date.now;
|
|
72
|
+
for (;;) {
|
|
73
|
+
if (!alive(loop.parent))
|
|
74
|
+
return "parent-gone";
|
|
75
|
+
try {
|
|
76
|
+
if ((await loop.beat(new Date(now()).toISOString())) === "gone")
|
|
77
|
+
return "released";
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
loop.log?.(`could not touch the hold of run ${loop.run} on ${loop.gate}: ${err instanceof Error ? err.message : String(err)}`);
|
|
81
|
+
}
|
|
82
|
+
await sleep(loop.intervalMs);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -3,6 +3,12 @@ import { type LockRow } from "./lock-rows.js";
|
|
|
3
3
|
export declare const LOCK_ROWS_DIR = "_locks/rows";
|
|
4
4
|
/** A lease older than this many seconds is taken over (`CHANT_LOCK_STALE`). */
|
|
5
5
|
export declare const DEFAULT_LOCK_STALE_SECONDS = 7200;
|
|
6
|
+
/** A hold whose beat is older than this many seconds is gone (`CHANT_LOCK_BEAT_STALE`, #4660). */
|
|
7
|
+
export declare const DEFAULT_LOCK_BEAT_STALE_SECONDS = 600;
|
|
8
|
+
/** How often a live apply touches its hold, in seconds (`CHANT_LOCK_BEAT`, #4660). */
|
|
9
|
+
export declare const DEFAULT_LOCK_BEAT_SECONDS = 60;
|
|
10
|
+
/** A queued run that has not refreshed its entry for this many seconds is gone (`CHANT_LOCK_WAITER_STALE`, #4660). */
|
|
11
|
+
export declare const DEFAULT_LOCK_WAITER_STALE_SECONDS = 300;
|
|
6
12
|
/** The run holding rows: the forge's run id, or this host and process outside CI. */
|
|
7
13
|
export interface LockRowHolder {
|
|
8
14
|
run: string;
|
|
@@ -10,6 +16,15 @@ export interface LockRowHolder {
|
|
|
10
16
|
/** The run's page, for a refusal that names it. */
|
|
11
17
|
url?: string;
|
|
12
18
|
sha?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The liveness token (#4660): the last time a heartbeat of the run's own
|
|
21
|
+
* process touched its hold. A holder with a beat is judged by the beat
|
|
22
|
+
* alone, so a job that is cancelled or killed without running its cleanup
|
|
23
|
+
* frees its rows once the beat is {@link lockBeatStaleSeconds} old, while a
|
|
24
|
+
* job that still beats keeps them however long its apply runs. A holder
|
|
25
|
+
* without one (an older chant, terragucci) keeps the rules below.
|
|
26
|
+
*/
|
|
27
|
+
beat?: string;
|
|
13
28
|
}
|
|
14
29
|
/** A run waiting for rows: who it is, the rows it waits for, and the commit time that orders it. */
|
|
15
30
|
export interface LockRowWaiter extends LockRowHolder {
|
|
@@ -40,6 +55,12 @@ export type LockLiveness = (holder: LockRowHolder) => Promise<"alive" | "dead">;
|
|
|
40
55
|
export declare function lockRowsPath(gate: string): string;
|
|
41
56
|
/** The lease length in seconds: `CHANT_LOCK_STALE`, else `TG_LOCK_STALE`, else {@link DEFAULT_LOCK_STALE_SECONDS}. */
|
|
42
57
|
export declare function lockStaleSeconds(env: Record<string, string | undefined>): number;
|
|
58
|
+
/** How old a hold's beat may be before the hold is gone, in seconds: `CHANT_LOCK_BEAT_STALE`, else {@link DEFAULT_LOCK_BEAT_STALE_SECONDS}. */
|
|
59
|
+
export declare function lockBeatStaleSeconds(env: Record<string, string | undefined>): number;
|
|
60
|
+
/** Seconds between beats: `CHANT_LOCK_BEAT`, else {@link DEFAULT_LOCK_BEAT_SECONDS}. */
|
|
61
|
+
export declare function lockBeatSeconds(env: Record<string, string | undefined>): number;
|
|
62
|
+
/** How old a queued run's entry may be before it is gone, in seconds: `CHANT_LOCK_WAITER_STALE`, else {@link DEFAULT_LOCK_WAITER_STALE_SECONDS}. */
|
|
63
|
+
export declare function lockWaiterStaleSeconds(env: Record<string, string | undefined>): number;
|
|
43
64
|
/** Who this apply is, as the rows name it: the forge's run, or this host and process outside CI. */
|
|
44
65
|
export declare function lockRowHolder(env: Record<string, string | undefined>, now?: Date): LockRowHolder;
|
|
45
66
|
type Fetch = (url: string, init?: {
|
|
@@ -135,7 +156,7 @@ export declare function lockPollMs(env: Record<string, string | undefined>): num
|
|
|
135
156
|
/** The commit time of `rev` in `cwd` (ISO 8601), or undefined when git cannot say. */
|
|
136
157
|
export declare function commitTimeOf(rev: string, cwd?: string): Promise<string | undefined>;
|
|
137
158
|
/** The live waiters for a row that meets one of `keys` who go before `me`, and the waiters that are gone. */
|
|
138
|
-
export declare function waitersAhead(file: LockRowsFile, keys: readonly string[], me: LockRowWaiter, alive: LockLiveness): Promise<{
|
|
159
|
+
export declare function waitersAhead(file: LockRowsFile, keys: readonly string[], me: LockRowWaiter, alive: LockLiveness, now?: () => number): Promise<{
|
|
139
160
|
ahead: LockRowWaiter[];
|
|
140
161
|
gone: string[];
|
|
141
162
|
}>;
|
|
@@ -156,6 +177,31 @@ export declare function waitLockRows(gate: string, rows: readonly LockRow[], me:
|
|
|
156
177
|
export declare function releaseLockRows(gate: string, keys: readonly string[], me: string, opts?: {
|
|
157
178
|
cwd?: string;
|
|
158
179
|
}): Promise<boolean>;
|
|
180
|
+
/** The rows file after run `run`'s beat is set to `at`. Unchanged when the run holds no row. */
|
|
181
|
+
export declare function withRowsBeat(file: LockRowsFile, run: string, at: string): LockRowsFile;
|
|
182
|
+
/**
|
|
183
|
+
* Touch run `run`'s hold (#4660): the heartbeat of a live apply. `held` while
|
|
184
|
+
* the run still holds a row, `gone` once it holds none (released, or taken
|
|
185
|
+
* over after its beat went stale), so the heartbeat stops.
|
|
186
|
+
*/
|
|
187
|
+
export declare function beatLockRows(gate: string, run: string, at: string, opts?: {
|
|
188
|
+
cwd?: string;
|
|
189
|
+
}): Promise<"held" | "gone">;
|
|
190
|
+
/** The rows file after every hold and queue entry of `run` is dropped, whether or not the run is gone. */
|
|
191
|
+
export declare function withRunCleared(file: LockRowsFile, run: string): LockRowsFile;
|
|
192
|
+
/**
|
|
193
|
+
* Let go of everything run `run` holds or waits for on `gate`, by hand
|
|
194
|
+
* (#4660, `chant unlock --run`). It does not ask whether the run is alive:
|
|
195
|
+
* the person who runs it says so. Throws when the branch cannot be read or
|
|
196
|
+
* pushed, so a hold that is still there is never reported as cleared.
|
|
197
|
+
*/
|
|
198
|
+
export declare function clearRunLockRows(gate: string, run: string, opts?: {
|
|
199
|
+
cwd?: string;
|
|
200
|
+
}): Promise<{
|
|
201
|
+
released: string[];
|
|
202
|
+
waited: boolean;
|
|
203
|
+
pushed: boolean;
|
|
204
|
+
}>;
|
|
159
205
|
/** One line naming the runs that hold rows, and what of this apply they hold, for a log line and a refusal. */
|
|
160
206
|
export declare function describeHeldLockRows(held: readonly HeldLockRow[], rows: readonly LockRow[]): string;
|
|
161
207
|
/** A lease an apply holds: its rows and holder, and how to let go of it. */
|
|
@@ -165,6 +211,12 @@ export interface LockRowsLease {
|
|
|
165
211
|
keys: string[];
|
|
166
212
|
release(): Promise<boolean>;
|
|
167
213
|
}
|
|
214
|
+
/** Starts the heartbeat of a hold (#4660) and returns how to stop it. */
|
|
215
|
+
export type LockBeatStarter = (hold: {
|
|
216
|
+
gate: string;
|
|
217
|
+
holder: LockRowHolder;
|
|
218
|
+
cwd?: string;
|
|
219
|
+
}) => () => void;
|
|
168
220
|
/**
|
|
169
221
|
* Lease `rows` for the apply about to run (#4552): take them, or say who
|
|
170
222
|
* holds them. With no rows, a lease that holds nothing. Throws when the
|
|
@@ -174,6 +226,7 @@ export interface LockRowsLease {
|
|
|
174
226
|
export declare function leaseLockRows(gate: string, rows: readonly LockRow[], opts?: LockRowsOptions & {
|
|
175
227
|
holder?: LockRowHolder;
|
|
176
228
|
wait?: LockRowsWait;
|
|
229
|
+
beat?: LockBeatStarter;
|
|
177
230
|
}): Promise<{
|
|
178
231
|
ok: true;
|
|
179
232
|
lease: LockRowsLease;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-lock.d.ts","sourceRoot":"","sources":["../../src/lifecycle/resource-lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resource-lock.d.ts","sourceRoot":"","sources":["../../src/lifecycle/resource-lock.ts"],"names":[],"mappings":"AAqDA,OAAO,EAAoC,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAG7E,mFAAmF;AACnF,eAAO,MAAM,aAAa,gBAAsB,CAAC;AAEjD,+EAA+E;AAC/E,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,kGAAkG;AAClG,eAAO,MAAM,+BA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