@intentius/chant 0.124.4 → 0.124.6
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/cli/handlers/gate-resume.d.ts +32 -1
- package/dist/cli/handlers/gate-resume.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +7 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/op/gate-point-run.d.ts +1 -1
- package/dist/op/gate-point-run.d.ts.map +1 -1
- package/dist/op/gate-point.d.ts +6 -0
- package/dist/op/gate-point.d.ts.map +1 -1
- package/dist/op/gate-resume.d.ts +2 -31
- package/dist/op/gate-resume.d.ts.map +1 -1
- package/dist/op/gate-run-locator.d.ts +40 -0
- package/dist/op/gate-run-locator.d.ts.map +1 -0
- package/dist/op/index.d.ts +2 -2
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/op-waves-notify.d.ts +3 -1
- package/dist/op/op-waves-notify.d.ts.map +1 -1
- package/dist/op/op-waves-run.d.ts +58 -3
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves.d.ts +16 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/point-decision.d.ts +63 -1
- package/dist/point-decision.d.ts.map +1 -1
- package/dist/workspace/points-cli.d.ts.map +1 -1
- package/dist/workspace/records-cli.d.ts +15 -0
- package/dist/workspace/records-cli.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cli/handlers/gate-resume.ts +84 -11
- package/src/cli/main.ts +4 -2
- package/src/lifecycle/gate-ledger.ts +7 -0
- package/src/op/gate-point-ci.e2e.test.ts +39 -2
- package/src/op/gate-point-resume.e2e.test.ts +203 -0
- package/src/op/gate-point-run.ts +3 -0
- package/src/op/gate-point.ts +11 -0
- package/src/op/gate-resume.ts +5 -95
- package/src/op/gate-run-locator.ts +105 -0
- package/src/op/index.ts +3 -0
- package/src/op/op-waves-notify.ts +16 -1
- package/src/op/op-waves-run.ts +221 -23
- package/src/op/op-waves.test.ts +135 -0
- package/src/op/op-waves.ts +33 -1
- package/src/point-decision-bundle.test.ts +1 -0
- package/src/point-decision.ts +97 -1
- package/src/workspace/points-cli.ts +7 -2
- package/src/workspace/records-cli.ts +38 -7
- package/src/workspace/records.schema.json +4 -0
package/dist/point-decision.d.ts
CHANGED
|
@@ -20,14 +20,21 @@
|
|
|
20
20
|
* TypeScript, zod or git code, which `point-decision-bundle.test.ts` holds
|
|
21
21
|
* it to. `./op/gate-point-run.ts` re-exports it, and chant's own runs decide
|
|
22
22
|
* by it.
|
|
23
|
+
*
|
|
24
|
+
* A gate's resolution is written only when its run asks again, so a resume
|
|
25
|
+
* job asks {@link pointGateResumable} whether a waiting job's question now
|
|
26
|
+
* has an answer that passes the gate (#3835), with the questions
|
|
27
|
+
* {@link chantPointQuestions} reads. `chant run resume` makes the same check.
|
|
23
28
|
*/
|
|
24
29
|
import type { GateAnswerRef, GateResolutionRecord, PendingGateRecord } from "./lifecycle/gate-ledger.js";
|
|
25
30
|
import type { GateLedgerPort } from "./op/gate.js";
|
|
26
31
|
import { type GatePoint, type GatePointFacts, type GatePointStore } from "./op/gate-point.js";
|
|
27
32
|
import type { WaitingPoint } from "./op/steward-points.js";
|
|
28
|
-
|
|
33
|
+
import { type GateRunLocator } from "./op/gate-run-locator.js";
|
|
34
|
+
export { DEFAULT_GATE_POINT_PASS, GATE_POINT_INPUTS, defaultGatePointStore, gatePointInputs, gatePointOf, gatePointProblems, gateSubject, parseGateSubject, type GatePoint, type GatePointFacts, type GatePointStore, } from "./op/gate-point.js";
|
|
29
35
|
export type { GateAnswerRef, GateResolutionRecord, GateResolutionInput, PendingGateInput, PendingGateRecord } from "./lifecycle/gate-ledger.js";
|
|
30
36
|
export type { WaitingPoint } from "./op/steward-points.js";
|
|
37
|
+
export { isGateRunLocator, resolveGateRunLocator, type GateRunLocator } from "./op/gate-run-locator.js";
|
|
31
38
|
/**
|
|
32
39
|
* The gate ledger as {@link evaluatePointGate} uses it: read an op's facts,
|
|
33
40
|
* append a pending fact, append a resolution. chant's own is
|
|
@@ -84,6 +91,12 @@ export interface PointGateInput {
|
|
|
84
91
|
/** The environment the run was started for: the `gate.env` input. Op gate facts on the ledger record none. */
|
|
85
92
|
env?: string;
|
|
86
93
|
now?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Where this job runs, for `chant run resume` to start it again once the
|
|
96
|
+
* question is answered (#3835). Default: read from the CI environment
|
|
97
|
+
* ({@link resolveGateRunLocator}); false records none.
|
|
98
|
+
*/
|
|
99
|
+
resume?: GateRunLocator | false;
|
|
87
100
|
}
|
|
88
101
|
/** What reaching a gate that asks a point decided. */
|
|
89
102
|
export type PointGateCheck = {
|
|
@@ -112,6 +125,47 @@ export type PointGateCheck = {
|
|
|
112
125
|
};
|
|
113
126
|
/** Decide a gate that asks a point: ask it, then record the pending fact or the resolution that cites the answer. */
|
|
114
127
|
export declare function evaluatePointGate(port: PointGateLedgerPort, asker: GatePointAsker, input: PointGateInput): Promise<PointGateCheck>;
|
|
128
|
+
/**
|
|
129
|
+
* A question's state as a resume reads it: what `chant workspace points
|
|
130
|
+
* --json` lists for it. {@link chantPointQuestions} reads them through the
|
|
131
|
+
* chant bin; chant's own resume reads the workspace.
|
|
132
|
+
*/
|
|
133
|
+
export interface PointQuestionState {
|
|
134
|
+
id: string;
|
|
135
|
+
state: "escalated" | "proposed" | "answered";
|
|
136
|
+
/** The answer, or null while the question is open. */
|
|
137
|
+
answer: string | boolean | null;
|
|
138
|
+
answeredBy: string[];
|
|
139
|
+
/** When it was answered, as the record says, or null. */
|
|
140
|
+
answeredOn: string | null;
|
|
141
|
+
}
|
|
142
|
+
/** Whether a waiting point-asking gate can be resumed, and why not. */
|
|
143
|
+
export type PointResumeCheck = {
|
|
144
|
+
resumable: true;
|
|
145
|
+
/** The answer that passes the gate, as the resumed run will cite it. */
|
|
146
|
+
answer: GateAnswerRef;
|
|
147
|
+
/** Who answered: the people, joined, or `quorum` when the record names none. */
|
|
148
|
+
answeredBy: string;
|
|
149
|
+
/** When it was answered, or null. A resume reads a run started after it as already resumed. */
|
|
150
|
+
answeredOn: string | null;
|
|
151
|
+
} | {
|
|
152
|
+
resumable: false;
|
|
153
|
+
/** `open`: nobody has answered; `refused`: the answer does not pass the gate; `unknown`: no question with the id was read; `not-a-point`: the pending fact cites no question. */
|
|
154
|
+
why: "open" | "refused" | "unknown" | "not-a-point";
|
|
155
|
+
message: string;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Whether the job behind `standing`, a pending fact a gate that asks a
|
|
159
|
+
* decision point recorded, can be started again (#3835): its question is
|
|
160
|
+
* answered with an answer the gate passes on (the pending fact's
|
|
161
|
+
* `answer.pass`, default a noul point's yes). A gate only writes its
|
|
162
|
+
* resolution when its run asks the point again, so nothing on the gate
|
|
163
|
+
* ledger says an answered question passes; this is the check
|
|
164
|
+
* `chant run resume` makes, and a product's own resume job makes the same
|
|
165
|
+
* call with the questions it read (`chantPointQuestions`). It approves
|
|
166
|
+
* nothing: the resumed run asks again and decides.
|
|
167
|
+
*/
|
|
168
|
+
export declare function pointGateResumable(standing: Pick<PendingGateRecord, "answer">, question: PointQuestionState | undefined): PointResumeCheck;
|
|
115
169
|
/** How {@link chantGatePointAsker} runs chant. */
|
|
116
170
|
export interface ChantGatePointAskerOptions {
|
|
117
171
|
/** The chant command and its leading arguments, such as `["npx", "chant"]` or `[process.execPath, "/path/to/chant"]`. */
|
|
@@ -131,4 +185,12 @@ export interface ChantGatePointAskerOptions {
|
|
|
131
185
|
* quorum decide as in chant's own runs.
|
|
132
186
|
*/
|
|
133
187
|
export declare function chantGatePointAsker(opts: ChantGatePointAskerOptions): GatePointAsker;
|
|
188
|
+
/**
|
|
189
|
+
* Every question the workspace lists, by id, read through the chant bin with
|
|
190
|
+
* `chant workspace points --json` (the questions held on `chant/lifecycle`
|
|
191
|
+
* included), for {@link pointGateResumable} in a tool that bundles this
|
|
192
|
+
* module (#3835). Fetch `chant/lifecycle` first, as reading the gate ledger
|
|
193
|
+
* does, so an answer given from another clone is seen.
|
|
194
|
+
*/
|
|
195
|
+
export declare function chantPointQuestions(opts: ChantGatePointAskerOptions): Promise<Map<string, PointQuestionState>>;
|
|
134
196
|
//# sourceMappingURL=point-decision.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point-decision.d.ts","sourceRoot":"","sources":["../src/point-decision.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"point-decision.d.ts","sourceRoot":"","sources":["../src/point-decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEtG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAgF,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACzK,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnF,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC7I,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErG;;;;GAIG;A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,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,MAAM,CAatF;AAED,8GAA8G;AAC9G,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,CASvD;AA+BD,6EAA6E;AAC7E,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAwD7E"}
|
|
@@ -55,6 +55,13 @@ export interface RecordsQuery {
|
|
|
55
55
|
workGaps?: boolean;
|
|
56
56
|
/** List only the records that are modified or new against `HEAD` (#3160). Needs git and a working-tree read. */
|
|
57
57
|
uncommitted?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* For an answer kind read in the working tree (#3833): fetch `chant/lifecycle`
|
|
60
|
+
* first, best effort, as `points answer` does, so an answer held there by
|
|
61
|
+
* another clone or a CI job is listed. The command sets it; other readers
|
|
62
|
+
* read the local ledger as it is.
|
|
63
|
+
*/
|
|
64
|
+
fetchLedger?: boolean;
|
|
58
65
|
}
|
|
59
66
|
/**
|
|
60
67
|
* A record as the output carries it: the entry plus its provenance (#2547),
|
|
@@ -106,6 +113,14 @@ export type RecordView = RecordEntry & {
|
|
|
106
113
|
* steward keeps on the lifecycle ledger (#2786) laid over it.
|
|
107
114
|
*/
|
|
108
115
|
answers?: WorkAnswer[];
|
|
116
|
+
/**
|
|
117
|
+
* For a record of an answer kind (one with an `answers` block) read in the
|
|
118
|
+
* working tree (#3833): where the record is held on the lifecycle ledger,
|
|
119
|
+
* `chant/lifecycle:<path>`, as `points` names it for a question, or null
|
|
120
|
+
* when it is the working tree's file. A record held on the ledger has no
|
|
121
|
+
* `worktree` or `lastWrite`, since the checkout doesn't hold it.
|
|
122
|
+
*/
|
|
123
|
+
ledger?: string | null;
|
|
109
124
|
};
|
|
110
125
|
/** The role in the trust policy whose holders' verdicts the quorum does not count (#2671). */
|
|
111
126
|
export declare const AGENT_ROLE = "agent";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"records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Q,EAAE,eAAe,GAAG,UAAU,EAAE,CAE5F;AA0DD,yCAAyC;AACzC,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAS9E"}
|
package/package.json
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* the CI job that waits at a gate again once its approval has arrived. See
|
|
4
4
|
* `../../op/gate-resume.ts` for what each forge is asked and the token it
|
|
5
5
|
* needs. Neither approves anything.
|
|
6
|
+
*
|
|
7
|
+
* A gate that asks a decision point (#3170) waits on a question, not on an
|
|
8
|
+
* approval: its pending fact cites the question, and the gate's resolution is
|
|
9
|
+
* only written when the run asks again. So such a fact is resumable once the
|
|
10
|
+
* question has an answer that passes the gate (`pointGateResumable`, #3835),
|
|
11
|
+
* and `chant workspace points answer --resume` resumes the job right after
|
|
12
|
+
* the answer.
|
|
6
13
|
*/
|
|
7
14
|
|
|
8
15
|
import {
|
|
@@ -12,7 +19,8 @@ import {
|
|
|
12
19
|
type GateResolutionRecord,
|
|
13
20
|
type PendingGateRecord,
|
|
14
21
|
} from "../../lifecycle/gate-ledger";
|
|
15
|
-
import { listFilesInDir, requireLifecycleLedger } from "../../lifecycle/git";
|
|
22
|
+
import { listFilesInDir, pushLifecycleStatus, requireLifecycleLedger } from "../../lifecycle/git";
|
|
23
|
+
import { parseGateSubject } from "../../op/gate-point";
|
|
16
24
|
import {
|
|
17
25
|
isGateRunLocator,
|
|
18
26
|
resolutionAnswering,
|
|
@@ -20,6 +28,7 @@ import {
|
|
|
20
28
|
resumeTokenFromEnv,
|
|
21
29
|
type GateResumeOutcome,
|
|
22
30
|
} from "../../op/gate-resume";
|
|
31
|
+
import { pointGateResumable, type PointQuestionState } from "../../point-decision";
|
|
23
32
|
import type { ForgeFetch } from "../../pr-forge";
|
|
24
33
|
import { formatError, formatInfo, formatSuccess, formatWarning } from "../format";
|
|
25
34
|
import type { CommandContext } from "../registry";
|
|
@@ -53,6 +62,20 @@ export interface ResumeGateOptions {
|
|
|
53
62
|
fetch?: ForgeFetch;
|
|
54
63
|
now?: string;
|
|
55
64
|
dryRun?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The workspace's questions by id, for a fact a gate that asks a decision
|
|
67
|
+
* point recorded (#3835). Read from the workspace at the working directory
|
|
68
|
+
* when a fact needs them and none are given.
|
|
69
|
+
*/
|
|
70
|
+
questions?: ReadonlyMap<string, PointQuestionState>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Every question the workspace at `cwd` lists, by id, the lifecycle ledger's included. Empty when the workspace can't be read. */
|
|
74
|
+
export async function workspaceQuestions(cwd: string): Promise<Map<string, PointQuestionState>> {
|
|
75
|
+
const { workspacePoints } = await import("../../workspace/points-cli");
|
|
76
|
+
const doc = await workspacePoints({ cwd }).catch(() => undefined);
|
|
77
|
+
if (!doc || !("questions" in doc)) return new Map();
|
|
78
|
+
return new Map(doc.questions.map((q) => [q.id, { id: q.id, state: q.state, answer: q.answer, answeredBy: q.answeredBy, answeredOn: q.answeredOn }]));
|
|
56
79
|
}
|
|
57
80
|
|
|
58
81
|
/** Resume the job behind one standing pending fact, when an approval answers it. */
|
|
@@ -68,9 +91,20 @@ export async function resumeStanding(
|
|
|
68
91
|
...(standing.environment !== undefined ? { environment: standing.environment } : {}),
|
|
69
92
|
...(standing.resume?.url ? { url: standing.resume.url } : {}),
|
|
70
93
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
let approvedBy: { approvedBy: string };
|
|
95
|
+
let since: string | undefined;
|
|
96
|
+
if (standing.answer) {
|
|
97
|
+
// A gate that asks a decision point waits on its question (#3835).
|
|
98
|
+
const check = pointGateResumable(standing, opts.questions?.get(standing.answer.id));
|
|
99
|
+
if (!check.resumable) return { ...base, status: "not-approved", message: check.message };
|
|
100
|
+
approvedBy = { approvedBy: check.answeredBy };
|
|
101
|
+
since = check.answeredOn ?? undefined;
|
|
102
|
+
} else {
|
|
103
|
+
const answer = resolutionAnswering(resolutions, standing, pending);
|
|
104
|
+
if (!answer) return { ...base, status: "not-approved", message: "no approval answers it yet" };
|
|
105
|
+
approvedBy = { approvedBy: answer.resolvedBy };
|
|
106
|
+
since = answer.timestamp;
|
|
107
|
+
}
|
|
74
108
|
if (!isGateRunLocator(standing.resume)) {
|
|
75
109
|
return { ...base, ...approvedBy, status: "no-job", message: "its pending fact names no CI job (it was recorded outside CI); run it again by hand" };
|
|
76
110
|
}
|
|
@@ -86,7 +120,7 @@ export async function resumeStanding(
|
|
|
86
120
|
};
|
|
87
121
|
}
|
|
88
122
|
try {
|
|
89
|
-
const outcome = await resumeGateRun(loc, { token, since:
|
|
123
|
+
const outcome = await resumeGateRun(loc, { token, ...(since ? { since } : {}), ...(opts.fetch ? { fetch: opts.fetch } : {}) });
|
|
90
124
|
return { ...base, ...approvedBy, status: outcome.status, message: outcome.status === "resumed" ? outcome.how : outcome.reason };
|
|
91
125
|
} catch (err) {
|
|
92
126
|
return { ...base, ...approvedBy, status: "failed", message: err instanceof Error ? err.message : String(err) };
|
|
@@ -98,10 +132,10 @@ export async function resumeOpGates(op: string, gate: string | undefined, opts:
|
|
|
98
132
|
const ledger = await readGateLedger(op);
|
|
99
133
|
const now = opts.now ?? new Date().toISOString();
|
|
100
134
|
const reports: GateResumeReport[] = [];
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
135
|
+
const standing = standingFacts(ledger.pending, gate).filter((p) => !isPendingGateExpired(p, now));
|
|
136
|
+
// Read the workspace's questions once, and only when a fact waits on one (#3835).
|
|
137
|
+
const questions = opts.questions ?? (standing.some((p) => p.answer) ? await workspaceQuestions(process.cwd()) : undefined);
|
|
138
|
+
for (const p of standing) reports.push(await resumeStanding(p, ledger.resolutions, { ...opts, ...(questions ? { questions } : {}) }, ledger.pending));
|
|
105
139
|
return reports;
|
|
106
140
|
}
|
|
107
141
|
|
|
@@ -140,10 +174,49 @@ export async function resumeAfterApproval(op: string, gate: string, environment:
|
|
|
140
174
|
return reports.some((r) => r.status === "failed" || r.status === "no-token") ? 1 : 0;
|
|
141
175
|
}
|
|
142
176
|
|
|
177
|
+
/**
|
|
178
|
+
* What `chant workspace points answer --resume` runs once the answer is
|
|
179
|
+
* written (#3835): resume the job waiting at the gate the question names in
|
|
180
|
+
* its subject (`gate:<op>/<gate>`), when the answer passes it. The answer has
|
|
181
|
+
* to be on the remote for the resumed job to see it: one held on
|
|
182
|
+
* `chant/lifecycle` is pushed again here, and one in the working tree is
|
|
183
|
+
* not resumed on, since the job reads it only once it is committed and pushed.
|
|
184
|
+
* Returns the exit code, as {@link resumeAfterApproval} does.
|
|
185
|
+
*/
|
|
186
|
+
export async function resumeAfterAnswer(question: { id: string; subject: string | null; ledger: string | null }, cwd: string = process.cwd()): Promise<number> {
|
|
187
|
+
const named = parseGateSubject(question.subject);
|
|
188
|
+
if (!named) {
|
|
189
|
+
console.error(formatInfo(`Question ${question.id} names no gate in its subject, so there is nothing to resume.`));
|
|
190
|
+
return 0;
|
|
191
|
+
}
|
|
192
|
+
if (question.ledger === null) {
|
|
193
|
+
console.error(formatWarning({
|
|
194
|
+
message: `Not resuming: the answer to ${question.id} is in the working tree, and the resumed job would not see it.`,
|
|
195
|
+
hint: `Commit and push it, then run \`chant run resume --op ${named.op}\`.`,
|
|
196
|
+
}));
|
|
197
|
+
return 1;
|
|
198
|
+
}
|
|
199
|
+
if ((await pushLifecycleStatus({ cwd })).status !== "pushed") {
|
|
200
|
+
console.error(formatWarning({
|
|
201
|
+
message: "Not resuming: the answer did not reach the remote, so the resumed job would not see it.",
|
|
202
|
+
hint: `Push chant/lifecycle, then run \`chant run resume --op ${named.op}\`.`,
|
|
203
|
+
}));
|
|
204
|
+
return 1;
|
|
205
|
+
}
|
|
206
|
+
const reports = (await resumeOpGates(named.op, named.gate)).filter((r) => r.environment === undefined);
|
|
207
|
+
if (reports.length === 0) {
|
|
208
|
+
console.error(formatInfo(`No pending fact for ${named.op} / ${named.gate} is waiting, so there is nothing to resume.`));
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
211
|
+
for (const r of reports) printReport(r);
|
|
212
|
+
return reports.some((r) => r.status === "failed" || r.status === "no-token") ? 1 : 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
143
215
|
/**
|
|
144
216
|
* `chant run resume [--op <op>] [--dry-run] [--json]`: the scheduled job.
|
|
145
217
|
* Reads every gate ledger on `chant/lifecycle` (or `--op`'s), and starts
|
|
146
|
-
* again each CI job that waits at a gate an approval now answers
|
|
218
|
+
* again each CI job that waits at a gate an approval now answers, or at a
|
|
219
|
+
* gate whose decision point now has an answer that passes it (#3835).
|
|
147
220
|
*/
|
|
148
221
|
export async function runResumeCommand(ctx: CommandContext): Promise<number> {
|
|
149
222
|
try {
|
|
@@ -161,7 +234,7 @@ export async function runResumeCommand(ctx: CommandContext): Promise<number> {
|
|
|
161
234
|
else {
|
|
162
235
|
for (const r of reports.filter((r) => r.status !== "not-approved")) printReport(r);
|
|
163
236
|
const waiting = reports.filter((r) => r.status === "not-approved").length;
|
|
164
|
-
console.error(formatInfo(`${reports.filter((r) => r.status === "resumed").length} resumed, ${waiting} still waiting for an approval.`));
|
|
237
|
+
console.error(formatInfo(`${reports.filter((r) => r.status === "resumed").length} resumed, ${waiting} still waiting for an approval or a passing answer.`));
|
|
165
238
|
}
|
|
166
239
|
return reports.some((r) => r.status === "failed" || r.status === "no-token") ? 1 : 0;
|
|
167
240
|
}
|
package/src/cli/main.ts
CHANGED
|
@@ -1226,10 +1226,12 @@ Workspace (level 1, #2524):
|
|
|
1226
1226
|
candidates, { question, criteria }. --store ledger
|
|
1227
1227
|
holds the question on chant/lifecycle and pushes it,
|
|
1228
1228
|
for a checkout that does not outlive the run (CI)
|
|
1229
|
-
workspace points answer <id> --answer <value> --by <name>... [--note <text>] [--relayed-by <principal>] [--kind <kind file>] [--dry-run]
|
|
1229
|
+
workspace points answer <id> --answer <value> --by <name>... [--note <text>] [--relayed-by <principal>] [--kind <kind file>] [--resume] [--dry-run]
|
|
1230
1230
|
Record people's answer to an open question, or confirm
|
|
1231
1231
|
a model's proposal, once the point's quorum is met,
|
|
1232
|
-
with their note and who relayed it
|
|
1232
|
+
with their note and who relayed it. --resume then
|
|
1233
|
+
starts again the CI job waiting at the gate the
|
|
1234
|
+
question names, when the answer passes it
|
|
1233
1235
|
workspace points retract <id> --by <name>... [--note <text>] [--kind <kind file>] [--dry-run]
|
|
1234
1236
|
Take an answer back: the question is open for people
|
|
1235
1237
|
again, and the answer stays in its retractions
|
|
@@ -82,6 +82,13 @@ export interface GateAnswerRef {
|
|
|
82
82
|
/** `table`, `model` or `quorum`. */
|
|
83
83
|
decider?: string;
|
|
84
84
|
answeredBy?: string[];
|
|
85
|
+
/**
|
|
86
|
+
* On a pending fact: the answers the gate passes on, when the gate names
|
|
87
|
+
* them (`point.pass`); absent means a noul point's yes. `chant run resume`
|
|
88
|
+
* reads it to tell an answer that passes the gate from one that does not,
|
|
89
|
+
* without the Op's config (#3835).
|
|
90
|
+
*/
|
|
91
|
+
pass?: Array<string | boolean>;
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
/** One immutable gate-resolution record. */
|
|
@@ -20,6 +20,7 @@ import { join } from "node:path";
|
|
|
20
20
|
import { afterAll, afterEach, beforeAll, describe, expect, test, vi } from "vitest";
|
|
21
21
|
import { cleanScratch, git, workspace } from "../workspace/__fixtures__/decide-workspace";
|
|
22
22
|
import { runWorkspacePoints } from "../workspace/points-cli";
|
|
23
|
+
import { runWorkspaceRecords } from "../workspace/records-cli";
|
|
23
24
|
import type { CommandContext } from "../cli/registry";
|
|
24
25
|
import { ApplyOp } from "./composites/apply-op";
|
|
25
26
|
import { memoryGateLedgerPort } from "./gate";
|
|
@@ -71,7 +72,7 @@ function clone(name: string): string {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
/** `chant workspace points <argv>` through the command's handler, in `cwd`. Returns the document it prints. */
|
|
74
|
-
async function points(cwd: string, args: Record<string, unknown
|
|
75
|
+
async function points(cwd: string, args: Record<string, unknown>, handler = runWorkspacePoints): Promise<Record<string, unknown> & { error?: { code: string } }> {
|
|
75
76
|
const printed: string[] = [];
|
|
76
77
|
const log = vi.spyOn(console, "log").mockImplementation((line: unknown) => {
|
|
77
78
|
printed.push(String(line));
|
|
@@ -79,7 +80,7 @@ async function points(cwd: string, args: Record<string, unknown>): Promise<Recor
|
|
|
79
80
|
const was = process.cwd();
|
|
80
81
|
process.chdir(cwd);
|
|
81
82
|
try {
|
|
82
|
-
await
|
|
83
|
+
await handler({ args, plugins: [], serializers: [] } as unknown as CommandContext);
|
|
83
84
|
} finally {
|
|
84
85
|
process.chdir(was);
|
|
85
86
|
log.mockRestore();
|
|
@@ -169,3 +170,39 @@ describe("a gate's question outlives the CI job that asked it (#3815)", () => {
|
|
|
169
170
|
expect(answersIn(tree)).toHaveLength(1);
|
|
170
171
|
});
|
|
171
172
|
});
|
|
173
|
+
|
|
174
|
+
describe("chant workspace records lists the answers held on chant/lifecycle (#3833)", () => {
|
|
175
|
+
type Rec = { id: string; path: string; state: string; data: { answer?: unknown }; ledger?: string | null; worktree?: string };
|
|
176
|
+
const answerRecords = (set: Record<string, unknown>): Rec[] => {
|
|
177
|
+
const kinds = set.kinds as { kind: { name: string }; records: Rec[] }[];
|
|
178
|
+
return kinds.find((k) => k.kind.name === "answer")!.records;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
test("an answer asked and answered on the ledger is listed with the id, state and answer points shows", async () => {
|
|
182
|
+
vi.stubEnv("CI", "");
|
|
183
|
+
const op = config("records-apply", { name: "prod-apply", store: "ledger" });
|
|
184
|
+
const first = await run(op, clone("records-job"));
|
|
185
|
+
expect(first.status).toBe("waiting");
|
|
186
|
+
const id = first.point!.id;
|
|
187
|
+
expect(await points(clone("records-person"), { extraPositional: "answer", extraPositional2: id, answer: "yes", bys: ["alice"] })).toMatchObject({ written: true });
|
|
188
|
+
|
|
189
|
+
// A clone that never held chant/lifecycle: records fetches it, as points answer does.
|
|
190
|
+
const reader = clone("records-reader");
|
|
191
|
+
const listed = answerRecords(await points(reader, { json: true }, runWorkspaceRecords)).find((r) => r.id === id);
|
|
192
|
+
expect(listed).toMatchObject({ id, state: "answered", data: { answer: true }, ledger: expect.stringContaining("chant/lifecycle:") });
|
|
193
|
+
expect(listed!.worktree).toBeUndefined();
|
|
194
|
+
|
|
195
|
+
const doc = (await points(reader, { json: true })) as { questions: { id: string; state: string; answer: unknown; ledger: string | null; path: string }[] };
|
|
196
|
+
const question = doc.questions.find((q) => q.id === id)!;
|
|
197
|
+
expect({ id: listed!.id, state: listed!.state, answer: listed!.data.answer, ledger: listed!.ledger, path: listed!.path }).toEqual({
|
|
198
|
+
id: question.id,
|
|
199
|
+
state: question.state,
|
|
200
|
+
answer: question.answer,
|
|
201
|
+
ledger: question.ledger,
|
|
202
|
+
path: question.path,
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// The checkout doesn't hold it: --uncommitted leaves it out, and the text output says where it is.
|
|
206
|
+
expect(answerRecords(await points(reader, { json: true, uncommitted: true }, runWorkspaceRecords)).map((r) => r.id)).not.toContain(id);
|
|
207
|
+
});
|
|
208
|
+
});
|