@intentius/chant 0.124.95 → 0.124.97
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/change-set-graph.d.ts +3 -1
- package/dist/change-set-graph.d.ts.map +1 -1
- package/dist/change-set-graph.js +7 -1
- package/dist/change-set.d.ts +5 -2
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -3
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +3 -7
- package/dist/reconcile.d.ts +9 -0
- package/dist/reconcile.d.ts.map +1 -1
- package/dist/release-floors.d.ts +3 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +5 -3
- package/dist/wave-runtime.mjs +253 -253
- package/dist/workspace/drift-cli.d.ts +9 -0
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +54 -5
- package/dist/workspace/drift-reader.d.ts +60 -0
- package/dist/workspace/drift-reader.d.ts.map +1 -0
- package/dist/workspace/drift-reader.js +81 -0
- package/dist/workspace/drift-reader.schema.json +44 -0
- package/dist/workspace/kinds.d.ts +15 -0
- package/dist/workspace/kinds.d.ts.map +1 -1
- package/dist/workspace/kinds.js +17 -0
- package/dist/workspace/workspace-kinds.schema.json +23 -0
- package/package.json +1 -1
- package/src/change-set-graph.test.ts +33 -1
- package/src/change-set-graph.ts +7 -1
- package/src/change-set.ts +6 -3
- package/src/cli/handlers/pr-before-merge.test.ts +18 -0
- package/src/floor-table.data.ts +3 -2
- package/src/reconcile.ts +9 -0
- package/src/release-floors.ts +6 -3
- package/src/workspace/drift-cli.ts +53 -4
- package/src/workspace/drift-reader.schema.json +44 -0
- package/src/workspace/drift-reader.test.ts +192 -0
- package/src/workspace/drift-reader.ts +104 -0
- package/src/workspace/kinds.ts +32 -1
- package/src/workspace/workspace-kinds.schema.json +23 -0
|
@@ -21,6 +21,15 @@
|
|
|
21
21
|
* falls back to another stack's export or the checked-in file. Any other kind
|
|
22
22
|
* answers `read-unsupported`.
|
|
23
23
|
*
|
|
24
|
+
* A member of a package's kind whose kinds file names a drift reader
|
|
25
|
+
* (`drift.reader`, #5068) is read by that module instead (`./drift-reader.ts`):
|
|
26
|
+
* chant imports it in this process, with this process's environment, calls
|
|
27
|
+
* it with the member's directory, the kind's config (placeholders
|
|
28
|
+
* substituted), `--read`, `--resource` and `--stack`, and checks each line
|
|
29
|
+
* it returns with the drift codec. The reader answers for itself, refusals
|
|
30
|
+
* included; chant makes no forge call for it. A declared drift reader comes
|
|
31
|
+
* before the table above.
|
|
32
|
+
*
|
|
24
33
|
* Any other kind has no drift read and answers `no-drift-read`. A member of
|
|
25
34
|
* a package's kind runs in the reader project `workspace graph` writes for it
|
|
26
35
|
* (`./kind-readers.ts`), under the member's own toolchain, so chant core
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drift-cli.d.ts","sourceRoot":"","sources":["../../src/workspace/drift-cli.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"drift-cli.d.ts","sourceRoot":"","sources":["../../src/workspace/drift-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAeL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EAGf,MAAM,iBAAiB,CAAC;AAWzB,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,yUAcY,CAAC;AAC3C,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,oGAAoG;AACpG,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAKpE,CAAC;AAEF,8EAA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any other kind
|
|
22
22
|
* answers `read-unsupported`.
|
|
23
23
|
*
|
|
24
|
+
* A member of a package's kind whose kinds file names a drift reader
|
|
25
|
+
* (`drift.reader`, #5068) is read by that module instead (`./drift-reader.ts`):
|
|
26
|
+
* chant imports it in this process, with this process's environment, calls
|
|
27
|
+
* it with the member's directory, the kind's config (placeholders
|
|
28
|
+
* substituted), `--read`, `--resource` and `--stack`, and checks each line
|
|
29
|
+
* it returns with the drift codec. The reader answers for itself, refusals
|
|
30
|
+
* included; chant makes no forge call for it. A declared drift reader comes
|
|
31
|
+
* before the table above.
|
|
32
|
+
*
|
|
24
33
|
* Any other kind has no drift read and answers `no-drift-read`. A member of
|
|
25
34
|
* a package's kind runs in the reader project `workspace graph` writes for it
|
|
26
35
|
* (`./kind-readers.ts`), under the member's own toolchain, so chant core
|
|
@@ -41,13 +50,15 @@
|
|
|
41
50
|
* prints nothing on stdout in stream mode and says why on stderr.
|
|
42
51
|
*/
|
|
43
52
|
import { existsSync } from "node:fs";
|
|
44
|
-
import { resolve } from "node:path";
|
|
53
|
+
import { join, resolve } from "node:path";
|
|
45
54
|
import { formatError } from "../cli/format.js";
|
|
46
55
|
import { graphNodeFor } from "../change-set-graph.js";
|
|
47
56
|
import { componentStatusDriftRecords, countDriftStatuses, decodeDriftLines, DRIFT_READS, DRIFT_SCHEMA_ID, DRIFT_VERSION, driftExpected, driftPlanner, driftRecordLine, driftSettle, driftStart, encodeDriftLines, foldDriftLines, lexiconDriftRecords, } from "../drift-record.js";
|
|
48
57
|
import { readDeclaration, readerVersion, WORKSPACE_ERROR_CODES, WorkspaceReadError } from "./declaration.js";
|
|
58
|
+
import { readDriftWithModule } from "./drift-reader.js";
|
|
49
59
|
import { prepareKindReaders } from "./kind-readers.js";
|
|
50
|
-
import { loadKindRegistry } from "./kinds.js";
|
|
60
|
+
import { loadKindRegistry, substituteGraphConfig } from "./kinds.js";
|
|
61
|
+
import { memberReason } from "./ls.js";
|
|
51
62
|
import { emitDocument, executePlan, planMembers } from "./member-commands.js";
|
|
52
63
|
import { handToRootChant, locateWorkspace } from "./which-chant.js";
|
|
53
64
|
/** The version of the read contract the document is written under. */
|
|
@@ -96,6 +107,33 @@ class DriftReadFailure extends Error {
|
|
|
96
107
|
function tail(text) {
|
|
97
108
|
return text.trim().split("\n").slice(-5).join("\n");
|
|
98
109
|
}
|
|
110
|
+
/** Read a member through its kind's drift reader module (#5068): the lines it returns, checked, or a failure. */
|
|
111
|
+
async function kindReaderLines(query, entry, drift, root) {
|
|
112
|
+
if (query.read !== undefined && !DRIFT_READS.includes(query.read)) {
|
|
113
|
+
throw new DriftReadFailure("read-unsupported", `--read ${query.read} is not a drift read; the reads are ${DRIFT_READS.join(", ")}`);
|
|
114
|
+
}
|
|
115
|
+
const abs = entry.dir === "." ? root : join(root, entry.dir);
|
|
116
|
+
const config = substituteGraphConfig(drift.config, { member: entry.name, dir: abs, workspace: root });
|
|
117
|
+
const answer = await readDriftWithModule(drift.readerFile, {
|
|
118
|
+
dir: typeof config.dir === "string" ? config.dir : abs,
|
|
119
|
+
config,
|
|
120
|
+
member: entry.name,
|
|
121
|
+
observedAt: new Date().toISOString(),
|
|
122
|
+
...(query.read !== undefined ? { read: query.read } : {}),
|
|
123
|
+
...(query.resource !== undefined ? { resource: query.resource } : {}),
|
|
124
|
+
...(query.stack !== undefined ? { stack: query.stack } : {}),
|
|
125
|
+
});
|
|
126
|
+
if ("error" in answer)
|
|
127
|
+
throw new DriftReadFailure("command-failed", `${query.member}: ${answer.error}`);
|
|
128
|
+
if ("refused" in answer)
|
|
129
|
+
throw new DriftReadFailure(answer.refused.code, `${query.member}: ${answer.refused.message}`);
|
|
130
|
+
return answer.lines;
|
|
131
|
+
}
|
|
132
|
+
/** The kinds `workspace drift` reads, for the no-drift-read message: the table's, and each loaded kind with a drift reader. */
|
|
133
|
+
function driftKinds(kinds) {
|
|
134
|
+
const readers = kinds.names().filter((k) => kinds.get(k)?.drift?.readerFile && !DRIFT_READS_BY_KIND[k]);
|
|
135
|
+
return [...Object.keys(DRIFT_READS_BY_KIND), ...readers].join(", ");
|
|
136
|
+
}
|
|
99
137
|
/** The member's node ids, without the member in front, from its source graph; null when it can't be read. */
|
|
100
138
|
async function memberGraph(cwd, member) {
|
|
101
139
|
try {
|
|
@@ -189,9 +227,21 @@ export async function readWorkspaceDrift(query) {
|
|
|
189
227
|
if (!entry) {
|
|
190
228
|
throw new DriftReadFailure("member-required", `--member ${query.member} is not a member of ${declaration.name}; it declares ${declaration.members.map((m) => m.name).join(", ")}`);
|
|
191
229
|
}
|
|
230
|
+
const { registry: kinds, problems } = loadKindRegistry(declaration.pins, located.rootOnDisk);
|
|
231
|
+
const drift = kinds.get(entry.kind)?.drift;
|
|
232
|
+
if (drift?.readerFile) {
|
|
233
|
+
// A kind's own drift reader (#5068), imported here: no reader project, and the member's graph places its records as for any member.
|
|
234
|
+
const reason = memberReason(entry, located.tree, kinds);
|
|
235
|
+
if (reason)
|
|
236
|
+
throw new DriftReadFailure("command-failed", `${query.member}: ${reason.code}: ${reason.message}`);
|
|
237
|
+
const [graph, lines] = await Promise.all([memberGraph(query.cwd, query.member), kindReaderLines(query, entry, drift, located.rootOnDisk)]);
|
|
238
|
+
return { lines: placeLines(lines, query.member, graph) };
|
|
239
|
+
}
|
|
192
240
|
const reads = DRIFT_READS_BY_KIND[entry.kind];
|
|
193
|
-
if (!reads)
|
|
194
|
-
|
|
241
|
+
if (!reads) {
|
|
242
|
+
const problem = problems.find((p) => p.message.includes(`kind ${entry.kind} names drift reader`));
|
|
243
|
+
throw new DriftReadFailure("no-drift-read", `${query.member} is kind ${entry.kind}, and chant workspace drift reads members of kind ${driftKinds(kinds)}${problem ? `; ${problem.message}` : ""}`);
|
|
244
|
+
}
|
|
195
245
|
if (query.read !== undefined && !DRIFT_READS.includes(query.read)) {
|
|
196
246
|
throw new DriftReadFailure("read-unsupported", `--read ${query.read} is not a drift read; the reads are ${DRIFT_READS.join(", ")}`);
|
|
197
247
|
}
|
|
@@ -208,7 +258,6 @@ export async function readWorkspaceDrift(query) {
|
|
|
208
258
|
throw new DriftReadFailure("read-unsupported", "--stack needs a stack name");
|
|
209
259
|
if (entry.kind === "chant" && !query.env)
|
|
210
260
|
throw new DriftReadFailure("env-required", `${query.member} is a chant member, read live through chant lifecycle diff <env> --live: add --env <env>`);
|
|
211
|
-
const { registry: kinds, problems } = loadKindRegistry(declaration.pins, located.rootOnDisk);
|
|
212
261
|
const plan = planMembers("graph", located.rootOnDisk, { only: [query.member], tree: located.tree, kinds, kindProblems: problems.map((p) => p.message) });
|
|
213
262
|
const notRun = [...plan.unreadable, ...plan.skipped].find((s) => s.name === query.member);
|
|
214
263
|
if (notRun)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A kind's drift reader (#5068).
|
|
3
|
+
*
|
|
4
|
+
* A kinds file can name a drift reader module beside its graph reader:
|
|
5
|
+
*
|
|
6
|
+
* ```json
|
|
7
|
+
* "drift": { "reader": "dist/drift-reader.mjs", "config": { "dir": "{dir}", "file": "governance.yml" } }
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* `chant workspace drift --member <name>` imports the module for a member of
|
|
11
|
+
* that kind and calls its default export with {@link DriftReaderInput}. It
|
|
12
|
+
* answers as a lexicon's `readDrift` answers `chant lifecycle drift`
|
|
13
|
+
* ({@link DriftReaderOutput}, `ReadDriftResult` in `../drift-record.ts`):
|
|
14
|
+
* the drift stream lines of each read it ran, or a refusal. Its schema is
|
|
15
|
+
* `./drift-reader.schema.json`, `$id` {@link DRIFT_READER_SCHEMA_ID}.
|
|
16
|
+
*
|
|
17
|
+
* The module runs in the process of the chant that reads the workspace, with
|
|
18
|
+
* that process's environment, so a reader that asks a forge brings its own
|
|
19
|
+
* credentials from there. chant makes no call to the forge for it. Each line
|
|
20
|
+
* the module returns is checked with the drift record's codec
|
|
21
|
+
* (`decodeDriftLine`), so a state read that says in-sync, or a not-observed
|
|
22
|
+
* record with no reason, fails the read rather than reaching a renderer.
|
|
23
|
+
*/
|
|
24
|
+
import { type DriftRead, type ReadDriftResult } from "../drift-record.js";
|
|
25
|
+
/** The schema a drift reader's output holds to. */
|
|
26
|
+
export declare const DRIFT_READER_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/drift-reader/v1/drift-reader.schema.json";
|
|
27
|
+
/** What a drift reader module's default export is called with. */
|
|
28
|
+
export interface DriftReaderInput {
|
|
29
|
+
/** The member's directory, absolute: the kind config's `dir` when it sets one as a string, else the member's own directory. */
|
|
30
|
+
dir: string;
|
|
31
|
+
/** The kind's `drift.config`, with `{member}`, `{dir}` and `{workspace}` substituted. */
|
|
32
|
+
config: Record<string, unknown>;
|
|
33
|
+
/** The workspace member the records are for. chant puts this name on every line whatever the reader writes. */
|
|
34
|
+
member: string;
|
|
35
|
+
/** RFC 3339, the `observedAt` to give every record the reader builds. */
|
|
36
|
+
observedAt: string;
|
|
37
|
+
/** `--read`, when given. Unset, the reader's default read. */
|
|
38
|
+
read?: DriftRead;
|
|
39
|
+
/** `--resource`, when given: one address to read. */
|
|
40
|
+
resource?: string;
|
|
41
|
+
/** `--stack`, when given. */
|
|
42
|
+
stack?: string;
|
|
43
|
+
}
|
|
44
|
+
/** What a drift reader module returns: the same answer as a lexicon's `readDrift`. */
|
|
45
|
+
export type DriftReaderOutput = ReadDriftResult;
|
|
46
|
+
/** A drift reader module's default export. */
|
|
47
|
+
export type DriftReader = (input: DriftReaderInput) => DriftReaderOutput | Promise<DriftReaderOutput>;
|
|
48
|
+
/**
|
|
49
|
+
* Check what a reader returned: each line through the drift codec, a
|
|
50
|
+
* refusal's code against the closed list. `error` says why it is not an
|
|
51
|
+
* answer.
|
|
52
|
+
*/
|
|
53
|
+
export declare function checkDriftReaderOutput(out: unknown): DriftReaderOutput | {
|
|
54
|
+
error: string;
|
|
55
|
+
};
|
|
56
|
+
/** Import the module and call it, or say why not. Never throws. */
|
|
57
|
+
export declare function readDriftWithModule(module: string, input: DriftReaderInput): Promise<DriftReaderOutput | {
|
|
58
|
+
error: string;
|
|
59
|
+
}>;
|
|
60
|
+
//# sourceMappingURL=drift-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift-reader.d.ts","sourceRoot":"","sources":["../../src/workspace/drift-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAmC,KAAK,SAAS,EAA6B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEnI,mDAAmD;AACnD,eAAO,MAAM,sBAAsB,0FAA0F,CAAC;AAE9H,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,+HAA+H;IAC/H,GAAG,EAAE,MAAM,CAAC;IACZ,yFAAyF;IACzF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,+GAA+G;IAC/G,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,sFAAsF;AACtF,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEhD,8CAA8C;AAC9C,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,gBAAgB,KAAK,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAMtG;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAmB1F;AAED,mEAAmE;AACnE,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAiBjI"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A kind's drift reader (#5068).
|
|
3
|
+
*
|
|
4
|
+
* A kinds file can name a drift reader module beside its graph reader:
|
|
5
|
+
*
|
|
6
|
+
* ```json
|
|
7
|
+
* "drift": { "reader": "dist/drift-reader.mjs", "config": { "dir": "{dir}", "file": "governance.yml" } }
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* `chant workspace drift --member <name>` imports the module for a member of
|
|
11
|
+
* that kind and calls its default export with {@link DriftReaderInput}. It
|
|
12
|
+
* answers as a lexicon's `readDrift` answers `chant lifecycle drift`
|
|
13
|
+
* ({@link DriftReaderOutput}, `ReadDriftResult` in `../drift-record.ts`):
|
|
14
|
+
* the drift stream lines of each read it ran, or a refusal. Its schema is
|
|
15
|
+
* `./drift-reader.schema.json`, `$id` {@link DRIFT_READER_SCHEMA_ID}.
|
|
16
|
+
*
|
|
17
|
+
* The module runs in the process of the chant that reads the workspace, with
|
|
18
|
+
* that process's environment, so a reader that asks a forge brings its own
|
|
19
|
+
* credentials from there. chant makes no call to the forge for it. Each line
|
|
20
|
+
* the module returns is checked with the drift record's codec
|
|
21
|
+
* (`decodeDriftLine`), so a state read that says in-sync, or a not-observed
|
|
22
|
+
* record with no reason, fails the read rather than reaching a renderer.
|
|
23
|
+
*/
|
|
24
|
+
import { isAbsolute } from "node:path";
|
|
25
|
+
import { pathToFileURL } from "node:url";
|
|
26
|
+
import { decodeDriftLine } from "../drift-record.js";
|
|
27
|
+
/** The schema a drift reader's output holds to. */
|
|
28
|
+
export const DRIFT_READER_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/drift-reader/v1/drift-reader.schema.json";
|
|
29
|
+
const REFUSAL_CODES = ["read-unsupported", "resource-unsupported", "no-drift-read"];
|
|
30
|
+
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
31
|
+
/**
|
|
32
|
+
* Check what a reader returned: each line through the drift codec, a
|
|
33
|
+
* refusal's code against the closed list. `error` says why it is not an
|
|
34
|
+
* answer.
|
|
35
|
+
*/
|
|
36
|
+
export function checkDriftReaderOutput(out) {
|
|
37
|
+
if (!isObject(out))
|
|
38
|
+
return { error: "returned something that is not an object with lines or refused" };
|
|
39
|
+
if ("refused" in out) {
|
|
40
|
+
const refused = out.refused;
|
|
41
|
+
if (!isObject(refused) || !REFUSAL_CODES.includes(refused.code) || typeof refused.message !== "string" || refused.message === "") {
|
|
42
|
+
return { error: `returned a refusal that is not { code: ${REFUSAL_CODES.join(" | ")}, message }` };
|
|
43
|
+
}
|
|
44
|
+
return { refused: { code: refused.code, message: refused.message } };
|
|
45
|
+
}
|
|
46
|
+
if (!Array.isArray(out.lines))
|
|
47
|
+
return { error: "returned something with no lines array and no refusal" };
|
|
48
|
+
const lines = [];
|
|
49
|
+
for (const [i, line] of out.lines.entries()) {
|
|
50
|
+
try {
|
|
51
|
+
lines.push(decodeDriftLine(JSON.stringify(line)));
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
return { error: `returned a line ${i} that is not drift: ${err instanceof Error ? err.message : String(err)}` };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { lines };
|
|
58
|
+
}
|
|
59
|
+
/** Import the module and call it, or say why not. Never throws. */
|
|
60
|
+
export async function readDriftWithModule(module, input) {
|
|
61
|
+
if (!isAbsolute(module))
|
|
62
|
+
return { error: `drift reader ${module} must be an absolute path` };
|
|
63
|
+
let read;
|
|
64
|
+
try {
|
|
65
|
+
read = (await import(pathToFileURL(module).href)).default;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
return { error: `drift reader ${module} could not be loaded: ${err instanceof Error ? err.message : String(err)}` };
|
|
69
|
+
}
|
|
70
|
+
if (typeof read !== "function")
|
|
71
|
+
return { error: `drift reader ${module} has no default export function` };
|
|
72
|
+
let out;
|
|
73
|
+
try {
|
|
74
|
+
out = await read(input);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
return { error: `drift reader ${module} failed: ${err instanceof Error ? err.message : String(err)}` };
|
|
78
|
+
}
|
|
79
|
+
const checked = checkDriftReaderOutput(out);
|
|
80
|
+
return "error" in checked ? { error: `drift reader ${module} ${checked.error}` } : checked;
|
|
81
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://intentius.io/chant/schemas/workspace/drift-reader/v1/drift-reader.schema.json",
|
|
4
|
+
"title": "drift reader output",
|
|
5
|
+
"description": "What a kind's drift reader module returns (#5068), the same answer a lexicon's readDrift gives chant lifecycle drift (ReadDriftResult in @intentius/chant/drift-record, DriftReaderOutput in @intentius/chant/workspace/drift-reader). Either the lines of each read the reader ran, in order, as the drift record's NDJSON stream has them (a drift-start, its drift-record lines and a drift-settle per read, each line one of drift.schema.json's $defs/line), or a refusal with a code chant workspace drift prints. A read that ran and failed is not a refusal: its addresses are records with status not-observed. chant workspace drift renames every line's member to the workspace member and places each record on the member's graph. First read by chant 0.124.96.",
|
|
6
|
+
"oneOf": [
|
|
7
|
+
{
|
|
8
|
+
"type": "object",
|
|
9
|
+
"required": ["lines"],
|
|
10
|
+
"properties": {
|
|
11
|
+
"lines": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": {
|
|
14
|
+
"$ref": "https://intentius.io/chant/schemas/workspace/drift/v1/drift.schema.json#/$defs/line"
|
|
15
|
+
},
|
|
16
|
+
"description": "The stream lines, in order. An empty list is a read that found nothing to report."
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "object",
|
|
23
|
+
"required": ["refused"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"refused": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"required": ["code", "message"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"code": {
|
|
30
|
+
"enum": ["read-unsupported", "resource-unsupported", "no-drift-read"],
|
|
31
|
+
"description": "read-unsupported for a --read or --stack the reader has not got, resource-unsupported for --resource on a reader that cannot read one resource on its own, no-drift-read when there is nothing to read (ReadDriftRefusalCode)."
|
|
32
|
+
},
|
|
33
|
+
"message": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"minLength": 1
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"additionalProperties": false
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -144,6 +144,19 @@ export interface KindGraph {
|
|
|
144
144
|
readerFile?: string;
|
|
145
145
|
config: Record<string, unknown>;
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* How `chant workspace drift --member` reads a member of a package's kind
|
|
149
|
+
* (#5068): a drift reader module the package ships, and the config it is
|
|
150
|
+
* called with. See `./drift-reader.ts` for the contract and
|
|
151
|
+
* {@link substituteGraphConfig} for the placeholders.
|
|
152
|
+
*/
|
|
153
|
+
export interface KindDrift {
|
|
154
|
+
/** The drift reader module, as the kinds file names it: a path inside the supplying package. */
|
|
155
|
+
reader: string;
|
|
156
|
+
/** The reader module, absolute; set once the package directory is known. */
|
|
157
|
+
readerFile?: string;
|
|
158
|
+
config: Record<string, unknown>;
|
|
159
|
+
}
|
|
147
160
|
export interface MemberKind {
|
|
148
161
|
name: string;
|
|
149
162
|
/** One line for listings and error messages. */
|
|
@@ -165,6 +178,8 @@ export interface MemberKind {
|
|
|
165
178
|
packageDir?: string;
|
|
166
179
|
/** How `workspace graph` reads a member of this kind (#2874); unset, the member is `kind-not-run`. */
|
|
167
180
|
graph?: KindGraph;
|
|
181
|
+
/** How `workspace drift` reads a member of this kind (#5068); unset, the member answers `no-drift-read` unless chant reads its kind itself. */
|
|
182
|
+
drift?: KindDrift;
|
|
168
183
|
/** The fields a member entry of this kind may set, with their defaults (#3151); unset, the kind declares none. */
|
|
169
184
|
fields?: Record<string, KindField>;
|
|
170
185
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../../src/workspace/kinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG5C,OAAO,EAAmC,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAIrF,eAAO,MAAM,eAAe,QAAa,CAAC;AAE1C,oDAAoD;AACpD,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC9C;;;;;OAKG;IACH,UAAU,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAClD;;;;;OAKG;IACH,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC7C;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAA;KAAE,CAAC;CACnE;AAED,kFAAkF;AAClF,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,yFAAyF;IACzF,OAAO,CAAC,EAAE,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CA4B7F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAcxE;AAID,6EAA6E;AAC7E,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAyCnD,sGAAsG;AACtG,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,uIAAuI;IACvI,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IACrF,QAAQ,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,YAAY,CAsCrH"}
|
package/dist/workspace/kinds.js
CHANGED
|
@@ -351,6 +351,7 @@ export function parseKindData(text, source) {
|
|
|
351
351
|
...(k.graph
|
|
352
352
|
? { graph: { ...(k.graph.lexicon ? { lexicon: k.graph.lexicon } : {}), ...(k.graph.reader ? { reader: k.graph.reader } : {}), config: structuredClone(k.graph.config ?? {}) } }
|
|
353
353
|
: {}),
|
|
354
|
+
...(k.drift ? { drift: { reader: k.drift.reader, config: structuredClone(k.drift.config ?? {}) } } : {}),
|
|
354
355
|
...(k.fields ? { fields: structuredClone(k.fields) } : {}),
|
|
355
356
|
...(k.reader && KIND_LINK_READERS.includes(k.reader) ? { reader: k.reader } : {}),
|
|
356
357
|
...(k.memberFile ? { memberFile: { path: k.memberFile.path, schema: k.memberFile.schema } } : {}),
|
|
@@ -430,6 +431,22 @@ export function readPackageKinds(packageDir, source) {
|
|
|
430
431
|
`and this package is ${packageName ?? "unnamed"}; the kind is kept, and workspace graph lists its members with kind-not-run`);
|
|
431
432
|
delete k.graph;
|
|
432
433
|
}
|
|
434
|
+
if (k.drift) {
|
|
435
|
+
// A drift reader module (#5068) is the package's own file, like a graph reader: inside the package and present. Nothing is imported here.
|
|
436
|
+
const file = resolve(packageDir, ...k.drift.reader.split("/"));
|
|
437
|
+
const inside = relative(packageDir, file);
|
|
438
|
+
if (inside.startsWith("..") || isAbsolute(inside)) {
|
|
439
|
+
data.problems.push(`${name}: kind ${k.name} names drift reader ${k.drift.reader}, which is outside the package; the kind is kept, and workspace drift answers no-drift-read for its members`);
|
|
440
|
+
delete k.drift;
|
|
441
|
+
}
|
|
442
|
+
else if (!existsSync(file)) {
|
|
443
|
+
data.problems.push(`${name}: kind ${k.name} names drift reader ${k.drift.reader}, which does not exist in the package; the kind is kept, and workspace drift answers no-drift-read for its members`);
|
|
444
|
+
delete k.drift;
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
k.drift.readerFile = file;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
433
450
|
}
|
|
434
451
|
return { ...data, file };
|
|
435
452
|
}
|
|
@@ -76,6 +76,9 @@
|
|
|
76
76
|
"graph": {
|
|
77
77
|
"$ref": "#/$defs/graph"
|
|
78
78
|
},
|
|
79
|
+
"drift": {
|
|
80
|
+
"$ref": "#/$defs/drift"
|
|
81
|
+
},
|
|
79
82
|
"fields": {
|
|
80
83
|
"$ref": "#/$defs/fields"
|
|
81
84
|
},
|
|
@@ -265,6 +268,26 @@
|
|
|
265
268
|
},
|
|
266
269
|
"additionalProperties": false
|
|
267
270
|
},
|
|
271
|
+
"drift": {
|
|
272
|
+
"type": "object",
|
|
273
|
+
"description": "How chant workspace drift --member reads a member of this kind (#5068): a drift reader module the supplying package ships, called with the member's directory and config. In every string key and value of config, {member} becomes the member's name, {dir} its absolute directory and {workspace} the absolute workspace root, as in graph. Without this field a member of the kind answers no-drift-read. A chant older than this field can't read a kinds file that uses it.",
|
|
274
|
+
"required": ["reader"],
|
|
275
|
+
"properties": {
|
|
276
|
+
"reader": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"pattern": "^(?!/)(?!.*\\.\\.)(?!.*\\\\)[^\\u0000-\\u001f]+$",
|
|
279
|
+
"description": "A drift reader module, as a path inside the supplying package: an ES module whose default export is (input: { dir, config, member, observedAt, read?, resource?, stack? }) => DriftReaderOutput, sync or async, the lines of each read it ran or a refusal (drift-reader.schema.json). chant workspace drift imports it in its own process, with the process's environment, so the reader brings its own credentials; chant makes no call of its own for it."
|
|
280
|
+
},
|
|
281
|
+
"config": {
|
|
282
|
+
"type": "object",
|
|
283
|
+
"description": "The config object the module is called with (optional). Placeholders are substituted; nothing else is interpreted."
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"patternProperties": {
|
|
287
|
+
"^x-": true
|
|
288
|
+
},
|
|
289
|
+
"additionalProperties": false
|
|
290
|
+
},
|
|
268
291
|
"fields": {
|
|
269
292
|
"type": "object",
|
|
270
293
|
"description": "The fields a member entry of this kind may set under its own fields block, each with a type and, optionally, a default (#3151). chant workspace check fails a member whose fields name one the kind doesn't declare or give a value of the wrong type (WSP005), and chant workspace status --json prints every declared field with the defaults filled in. Added by chant 0.103.0; an older chant can't read a kinds file that uses it.",
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { readFileSync } from "node:fs";
|
|
10
10
|
import { join } from "node:path";
|
|
11
11
|
import { describe, expect, test } from "vitest";
|
|
12
|
-
import { composeChangeSet, lifecyclePlanPart, verifyChangeSetDigest, type ChangeSetEntry } from "./change-set";
|
|
12
|
+
import { composeChangeSet, lifecyclePlanPart, reconcilePlanPart, verifyChangeSetDigest, type ChangeSetEntry } from "./change-set";
|
|
13
13
|
import { changeSetNodeCandidates, mapChangeSetToGraph, terraformBlockKey } from "./change-set-graph";
|
|
14
14
|
import type { ChangeSet as LifecycleChangeSet } from "./lifecycle/change-set";
|
|
15
15
|
|
|
@@ -32,6 +32,38 @@ describe("terraformBlockKey", () => {
|
|
|
32
32
|
expect(changeSetNodeCandidates({ member: "delivery", planner: "chant", address: "jobs" })).toEqual(["jobs"]);
|
|
33
33
|
expect(changeSetNodeCandidates({ member: "org", planner: "warden", address: "team.platform" })).toEqual(["team.platform"]);
|
|
34
34
|
});
|
|
35
|
+
|
|
36
|
+
test("a warden change under a node tries its address, then the node id before the # (#5089)", () => {
|
|
37
|
+
expect(changeSetNodeCandidates({ member: "forge", planner: "warden", address: "repo/acme/api#approval-rule[#review]" })).toEqual([
|
|
38
|
+
"repo/acme/api#approval-rule[#review]",
|
|
39
|
+
"repo/acme/api",
|
|
40
|
+
]);
|
|
41
|
+
expect(changeSetNodeCandidates({ member: "forge", planner: "warden", address: "repo/acme/api" })).toEqual(["repo/acme/api"]);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe("a warden's plan on its forge-governance graph (#5089)", () => {
|
|
46
|
+
test("entries with graph-node addresses sit on the nodes, and two orgs' same-named repos stay apart", () => {
|
|
47
|
+
const part = reconcilePlanPart({
|
|
48
|
+
member: "forge",
|
|
49
|
+
plan: [
|
|
50
|
+
{ org: "acme", entries: [
|
|
51
|
+
{ kind: "update", resourceType: "repo", key: "api", address: "repo/acme/api", fields: [{ field: "hasWiki", before: true, after: false }] },
|
|
52
|
+
{ kind: "create", resourceType: "repo-secret", key: "api/TOKEN", address: "repo/acme/api#repo-secret[#api/TOKEN]", after: { name: "TOKEN" } },
|
|
53
|
+
] },
|
|
54
|
+
{ org: "beta", entries: [{ kind: "update", resourceType: "repo", key: "api", address: "repo/beta/api", fields: [{ field: "hasWiki", before: true, after: false }] }] },
|
|
55
|
+
{ org: "beta", entries: [{ kind: "delete", resourceType: "team", key: "old", before: { slug: "old" } }] },
|
|
56
|
+
],
|
|
57
|
+
});
|
|
58
|
+
expect(part.entries.map((e) => e.address)).toEqual(["repo/acme/api", "repo/acme/api#repo-secret[#api/TOKEN]", "repo/beta/api", "team.old"]);
|
|
59
|
+
const mapped = mapChangeSetToGraph(composeChangeSet([part]), { member: "forge", at: null, ids: ["org/acme", "repo/acme/api", "org/beta", "repo/beta/api"] });
|
|
60
|
+
expect(mapped.entries.map((e) => [e.address, e.node])).toEqual([
|
|
61
|
+
["repo/acme/api", "forge/repo/acme/api"],
|
|
62
|
+
["repo/acme/api#repo-secret[#api/TOKEN]", "forge/repo/acme/api"],
|
|
63
|
+
["repo/beta/api", "forge/repo/beta/api"],
|
|
64
|
+
["team.old", null],
|
|
65
|
+
]);
|
|
66
|
+
});
|
|
35
67
|
});
|
|
36
68
|
|
|
37
69
|
describe("mapChangeSetToGraph", () => {
|
package/src/change-set-graph.ts
CHANGED
|
@@ -117,7 +117,9 @@ export function terraformBlockKey(address: string): string | undefined {
|
|
|
117
117
|
* - `chant`: the address, which is the entity name the IR uses as its id.
|
|
118
118
|
* - `terraform`, `tofu`, `choudoufu`: `<root>/<block key>`, the root being
|
|
119
119
|
* the change-set member (`terraformBlockKey`), then the address.
|
|
120
|
-
* - `warden
|
|
120
|
+
* - `warden`: the address, then, for `<node id>#<resourceType>[<key>]` (a
|
|
121
|
+
* change under a node, #5089), the node id before the first `#`.
|
|
122
|
+
* - `sql`: the address.
|
|
121
123
|
* - `pulumi`: the address is a URN, and the id is `<member>/<key>` by the
|
|
122
124
|
* one URN rule (`pulumiNodeCandidates`, `./pulumi-urn.ts`, #4456); none
|
|
123
125
|
* for a provider or the root stack.
|
|
@@ -132,6 +134,10 @@ export function changeSetNodeCandidates(entry: Pick<ChangeSetEntry, "member" | "
|
|
|
132
134
|
const key = terraformBlockKey(entry.address);
|
|
133
135
|
return key === undefined ? [entry.address] : [`${entry.member}/${key}`, entry.address];
|
|
134
136
|
}
|
|
137
|
+
case "warden": {
|
|
138
|
+
const hash = entry.address.indexOf("#");
|
|
139
|
+
return hash > 0 ? [entry.address, entry.address.slice(0, hash)] : [entry.address];
|
|
140
|
+
}
|
|
135
141
|
default:
|
|
136
142
|
return [entry.address];
|
|
137
143
|
}
|
package/src/change-set.ts
CHANGED
|
@@ -596,8 +596,11 @@ function topLevelKeys(value: unknown): string[] {
|
|
|
596
596
|
|
|
597
597
|
/**
|
|
598
598
|
* A warden member's part, from the reconcile `ChangeSet`s it planned
|
|
599
|
-
* (`./reconcile.ts`). The address is
|
|
600
|
-
*
|
|
599
|
+
* (`./reconcile.ts`). The address is the entry's own `address` when the
|
|
600
|
+
* warden set one (#5089): its graph node id, or `<node id>#<resourceType>[<key>]`
|
|
601
|
+
* for a change under that node, which places it on the node
|
|
602
|
+
* (`./change-set-graph.ts`). Otherwise it is `<resourceType>.<key>`, unique
|
|
603
|
+
* within one org. The scope is the org. An update's disruption is `unknown`:
|
|
601
604
|
* the reconcile model says nothing about it.
|
|
602
605
|
*
|
|
603
606
|
* The plan digest covers each change set's org and entries, and leaves out
|
|
@@ -621,7 +624,7 @@ export function reconcilePlanPart(input: ReconcilePlanPartInput): ChangeSetPart
|
|
|
621
624
|
member: input.member,
|
|
622
625
|
lexicon,
|
|
623
626
|
planner: "warden",
|
|
624
|
-
address: `${e.resourceType}.${e.key}`,
|
|
627
|
+
address: e.address ?? `${e.resourceType}.${e.key}`,
|
|
625
628
|
type: e.resourceType,
|
|
626
629
|
name: e.key,
|
|
627
630
|
action: e.kind,
|
|
@@ -47,6 +47,20 @@ vi.mock("../../lifecycle/target-lock", async (original) => ({
|
|
|
47
47
|
/** The ci.workflow pr-apply --before-merge reads at base (#4301). */
|
|
48
48
|
let workflowAtBase: string | null = "apply-before-merge";
|
|
49
49
|
vi.mock("../../workspace/ci-workflow-at", () => ({ ciWorkflowAt: () => workflowAtBase }));
|
|
50
|
+
/**
|
|
51
|
+
* The ref gate's rules pr-apply --before-merge reads at base (#4966): no rule
|
|
52
|
+
* for the target branch. #5088: unmocked, this read resolved --base main in
|
|
53
|
+
* the chant checkout itself, which a pull_request run's detached merge
|
|
54
|
+
* checkout has no `main` in, so the apply refused there and passed elsewhere.
|
|
55
|
+
*/
|
|
56
|
+
let refGateReads: Array<{ ref: string; base?: string }> = [];
|
|
57
|
+
vi.mock("../../ref-gate-rules", async (original) => ({
|
|
58
|
+
...(await original<typeof import("../../ref-gate-rules")>()),
|
|
59
|
+
refGateRulesAt: (_repo: string, opts: { ref: string; base?: string }) => {
|
|
60
|
+
refGateReads.push(opts);
|
|
61
|
+
return { ref: opts.ref, base: BASE, matched: false, status: null, checks: [], problems: [] };
|
|
62
|
+
},
|
|
63
|
+
}));
|
|
50
64
|
/** Whether the head's code was loaded: the config read and the derivation. */
|
|
51
65
|
let loaded: string[] = [];
|
|
52
66
|
|
|
@@ -164,6 +178,7 @@ const ctx = (a: Partial<ParsedArgs>) =>
|
|
|
164
178
|
beforeEach(async () => {
|
|
165
179
|
dir = await mkdtemp(join(tmpdir(), "pr-before-merge-"));
|
|
166
180
|
taken = [];
|
|
181
|
+
refGateReads = [];
|
|
167
182
|
workflowAtBase = "apply-before-merge";
|
|
168
183
|
loaded = [];
|
|
169
184
|
out = [];
|
|
@@ -202,6 +217,8 @@ function serveGithub(over: { head?: string; reviews?: unknown[]; mergeable?: boo
|
|
|
202
217
|
vi.stubEnv("GITHUB_TOKEN", "t0k");
|
|
203
218
|
vi.stubEnv("GITHUB_API_URL", "https://api.github.test");
|
|
204
219
|
vi.stubEnv("GITHUB_SERVER_URL", "https://github.com");
|
|
220
|
+
// #5088: the target branch a pull_request run names, set here so the ref gate is read on every runner, not only in CI.
|
|
221
|
+
vi.stubEnv("GITHUB_BASE_REF", "main");
|
|
205
222
|
vi.stubGlobal("fetch", async (url: string, init: { method: string }) => {
|
|
206
223
|
const { pathname } = new URL(url);
|
|
207
224
|
if (init.method !== "GET") return ok({ id: 1 });
|
|
@@ -255,6 +272,7 @@ describe("pr-apply --before-merge (#4301)", () => {
|
|
|
255
272
|
const report = await applyReport();
|
|
256
273
|
expect(report).toMatchObject({ status: "refused", refusal: "not-approved", op: "pr-12" });
|
|
257
274
|
expect(report.beforeMerge!.requires.every((r) => r.passed)).toBe(true);
|
|
275
|
+
expect(refGateReads).toEqual([{ ref: "refs/heads/main", base: "main" }]);
|
|
258
276
|
});
|
|
259
277
|
|
|
260
278
|
test("approved: it applies at the head, and under ci.locks holds apply locks on what it reaches", async () => {
|
package/src/floor-table.data.ts
CHANGED
|
@@ -241,8 +241,9 @@ export const FLOOR_ROWS: readonly FloorRow[] = [
|
|
|
241
241
|
{ name: "OP_WAVES_REMAINDER_FLOOR", version: "0.124.94", gates: "The first chant whose Op waves keep the record of an apply under an approval themselves (#5047): with `approvals.spend`, `approvals.remainder` writes each change the approved plans make, the commit and the run on the applied line (a split wave's gate job writes it), the job that applies the whole wave or the record job writes how the apply ended, and a wave run again at that commit applies the rest under the same approval when its plans make only changes the stopped apply did not finish; a wave that plans no change closes a stopped apply, and `approvals.spendStanding` spends an approval of the digest a wave its gate let through applies.", issue: "#5047", file: "release-floors.ts", modules: ["@intentius/chant/ci-product","@intentius/chant/op","@intentius/chant/op/index","@intentius/chant/op/op-waves-remainder","@intentius/chant/release-floors"] },
|
|
242
242
|
{ name: "OP_WAVES_SPLIT_RESUME_FLOOR", version: "0.124.94", gates: "The first chant whose `chant run resume` starts a killed split apply again on GitLab and Forgejo (#5052): under `approvals.remainder` the gate job's applied line names its run there too, GitLab's with the wave's applying and record jobs by name (`retry`), which the resume retries, and Forgejo's with the run's dispatch inputs (`inputs`), which the resume dispatches with, so the new run applies the rest at the same decided head or commit.", issue: "#5052", file: "release-floors.ts", modules: ["@intentius/chant/ci-product","@intentius/chant/op/op-waves-split-resume","@intentius/chant/release-floors"] },
|
|
243
243
|
{ name: "OP_WAVES_REMAINDER_PARITY_FLOOR", version: "0.124.94", gates: "The first chant whose `approvals.remainder` resumes the waves terragucci's own records resume (#5056): the terraform step gives a live choudoufu root's plan (`live-plan-set`) its `resourceDigests`, so its applied line names the changes, and the cover leaves out the cost member `(monthly cost)`, whose digest follows from the plans, on both sides.", issue: "#5056", file: "release-floors.ts", modules: ["@intentius/chant/ci-product","@intentius/chant/op/op-waves-remainder","@intentius/chant/release-floors"] },
|
|
244
|
-
{ name: "OP_WAVES_CONTROL_BEFORE_MERGE_FLOOR", version:
|
|
245
|
-
{ name: "WAVES_BEFORE_MERGE_LOCKS_FLOOR", version:
|
|
244
|
+
{ name: "OP_WAVES_CONTROL_BEFORE_MERGE_FLOOR", version: "0.124.95", gates: "The first chant whose Op waves generators, in a product's workflow (`runIf`) with `beforeMerge` and a spec `control`, run the control job on the default branch's push, outside the product's `runIf` and after its `firstWaveNeeds` jobs, and tell the control repo the waves applied at the pushed commit without adding up outcomes, on GitHub, Forgejo and GitLab (#5060).", issue: "#5060", file: "release-floors.ts", modules: ["@intentius/chant/release-floors"] },
|
|
245
|
+
{ name: "WAVES_BEFORE_MERGE_LOCKS_FLOOR", version: "0.124.95", gates: "The first chant whose waves before merge lock and unlock on a comment by the product plan's reach line (#5061): with `wavesBeforeMerge` and `productPlan.reach`, and no `locks: \"plan\"`, the comment job (GitHub, Forgejo) and the note poll (GitLab, `chantNoteRuns`) answer `/<product> lock` on an open pull request by taking the locks of what the reach line prints at stage `apply` in `_locks/<reach.gate>.json` without applying (`decideLocksBeforeMerge`), refused with the holder named, and `/<product> unlock` by releasing the pull request's locks; and the product plan takes `reach` without `locks: \"plan\"` under `wavesBeforeMerge`, writing no reach lock job.", issue: "#5061", file: "release-floors.ts", modules: ["@intentius/chant/ci-product","@intentius/chant/release-floors"] },
|
|
246
|
+
{ name: "KIND_DRIFT_READER_FLOOR", version: "0.124.96", gates: "The first chant whose kinds file takes `drift: { reader, config }` beside `graph` and whose `chant workspace drift --member` reads a member of such a kind with that module, `(input: { dir, config, member, observedAt, read?, resource?, stack? }) => DriftReaderOutput` from `@intentius/chant/workspace/drift-reader`, checked against `drift-reader.schema.json` (#5068).", issue: "#5068", file: "release-floors.ts", modules: ["@intentius/chant/release-floors"] },
|
|
246
247
|
{ name: "GITLAB_WAVE_EVIDENCE_RETRY_FLOOR", version: "0.124.89", gates: "The first chant whose `chant run resume` (`resumeGateRun`) on GitLab retries a wave job's `<wave job>-evidence` with the wave job when the evidence job already ran, and whose `ci evidence sign --from-job` waits for a job it reads to finish, so a resumed wave's evidence job signs from the new try (#4978).", issue: "#4978", file: "release-floors.ts", modules: ["@intentius/chant/ci-evidence-jobs","@intentius/chant/release-floors"] },
|
|
247
248
|
{ name: "TERRAFORM_COMMAND_TRACE_FLOOR", version: "0.124.91", gates: "The first chant whose terraform lexicon's engine runs carry what a product's own command tracing read: `runBinary` and the engine runner's `exec` and `execSync` answer stderr apart (`Ran.stderr`) and a spawn failure's message (`Ran.error`), a hook's `after` gets a binary that could not be started as a null code with `error`, `commandTrace` ends that span with the message, and `composeCommandHooks` runs a product's own hook and `commandTrace` as one `onCommand` (#5007).", issue: "#5007", file: "release-floors.ts", modules: ["@intentius/chant/release-floors"] },
|
|
248
249
|
{ name: "RUN_EVENT_FLOOR", version: "0.124.28", gates: "The first chant that writes contract version 1 of the run-event stream.", file: "run-event.ts", modules: ["@intentius/chant","@intentius/chant/index","@intentius/chant/run-event"] },
|