@intentius/behold 0.29.43 → 0.29.45
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/AGENTS.md +77 -0
- package/dist/cli.js +4065 -1918
- package/package.json +1 -1
- package/web/app.js +1469 -74
- package/web/carve-narration.js +33 -1
- package/web/chant-live-pace.js +138 -0
- package/web/chant-live-pace.test.js +116 -0
- package/web/chant-pr-marks.js +417 -39
- package/web/chant-pr-marks.test.js +208 -4
- package/web/collision-marks.js +124 -0
- package/web/collision-marks.test.js +89 -0
- package/web/cone.js +269 -0
- package/web/cone.test.js +213 -0
- package/web/dots-live.test.js +151 -1
- package/web/dots-lod.js +20 -0
- package/web/dots-lod.test.js +19 -1
- package/web/dots-scene.js +110 -10
- package/web/dots.js +144 -31
- package/web/embed.js +1 -1
- package/web/event-help-modal.js +98 -3
- package/web/event-help-modal.test.js +85 -1
- package/web/feature-flags.js +143 -0
- package/web/feature-flags.test.js +96 -0
- package/web/index.html +33 -0
- package/web/kiosk-carve.js +59 -6
- package/web/kiosk-demo-frame.test.js +27 -0
- package/web/kiosk-event-help-ui.js +186 -20
- package/web/kiosk-event-help.js +175 -15
- package/web/kiosk-event-help.test.js +58 -1
- package/web/kiosk-highlight.test.js +249 -0
- package/web/kiosk-metrics.js +4 -3
- package/web/kiosk-runs.js +8 -5
- package/web/kiosk-shot.js +157 -3
- package/web/kiosk-shot.test.js +223 -1
- package/web/kiosk-source.js +43 -0
- package/web/kiosk-source.test.js +39 -0
- package/web/kiosk-story-gate.test.js +44 -0
- package/web/kiosk-track.js +312 -0
- package/web/kiosk-track.test.js +148 -0
- package/web/kiosk-unknown-step.test.js +58 -0
- package/web/kiosk-vendor.js +73 -4
- package/web/kiosk-vendor.test.js +103 -3
- package/web/kiosk-watch.js +154 -1
- package/web/kiosk-watch.test.js +53 -1
- package/web/kiosk.html +57 -22
- package/web/kiosk.js +583 -53
- package/web/kiosk.test.js +2 -1
- package/web/small-stage.test.js +150 -0
- package/web/terragucci-blocked.test.js +192 -0
- package/web/terragucci-change.js +197 -17
- package/web/terragucci-components-live.js +189 -13
- package/web/terragucci-live-pace.js +92 -0
- package/web/terragucci-wave-results.test.js +125 -0
- package/web/terralith.html +7 -7
- package/web/tg-outside.js +124 -0
- package/web/tg-outside.test.js +100 -0
- package/web/tg-read-pills.js +145 -0
- package/web/tg-read-pills.test.js +158 -0
- package/web/theme.js +13 -1
- package/web/theme.test.js +21 -1
- package/web/tooltip.js +19 -7
- package/web/tooltip.test.js +15 -0
- package/web/tours/terralith.json +4 -4
- package/web/trunk-lane.test.js +1 -1
- package/web/view-url.js +8 -2
- package/web/why.js +129 -1
- package/web/why.test.js +113 -1
package/web/kiosk.test.js
CHANGED
|
@@ -346,7 +346,8 @@ describe("which view the frame shows (#571)", () => {
|
|
|
346
346
|
});
|
|
347
347
|
|
|
348
348
|
it("knows a tool whose pipeline writes no terragucci reports, and a chant project behold draws itself", () => {
|
|
349
|
-
|
|
349
|
+
// behold#746: chant's fan-out too, whose runs are chant's own.
|
|
350
|
+
expect(Object.entries(VENDORS).filter(([, v]) => reportless(v)).map(([id]) => id)).toEqual(["chant", "chant-fanout"]);
|
|
350
351
|
expect(reportless(null)).toBe(false);
|
|
351
352
|
expect(chantProject({ memberKinds: ["chant"] })).toBe(true);
|
|
352
353
|
expect(chantProject({ memberKinds: ["terraform"] })).toBe(false);
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// A small stage in Watch (the cone scenario's three estates): one card says
|
|
2
|
+
// each thing, a root its wave never started says so, and a read between two
|
|
3
|
+
// choudoufu roots is of the estate's outputs, not a state file.
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
import { modalShownElsewhere, tipsShown } from "./kiosk-event-help.js";
|
|
6
|
+
import { shotFor, stepLine, watchOverlays } from "./kiosk-watch.js";
|
|
7
|
+
import { settleMember } from "./terragucci-components-live.js";
|
|
8
|
+
import { pinWaits, pinnedAnswer, pinnedCaption, readEdges, readLabel, readLine, viewCaption } from "./terragucci-change.js";
|
|
9
|
+
import { wrapWords } from "./cone.js";
|
|
10
|
+
import { framePull } from "./kiosk.js";
|
|
11
|
+
import { settleView } from "./view-url.js";
|
|
12
|
+
import { viewFromMessage } from "./embed.js";
|
|
13
|
+
|
|
14
|
+
// Cycle 107: pull request #22 of 01:04, merged at 3333333; the reports a frame read a cycle ago hold #20 of 01:01.
|
|
15
|
+
const pr = (n, finished, cone = null) => ({ run: { pull_request: String(n), commit: n === 22 ? "2222222" : "1111111", finished }, roots: ["service-b"], waves: [], reads: [], ...(cone ? { cone } : {}) });
|
|
16
|
+
const cone = { roots: [{ root: "service-b", kind: "cone", blocks: 2, of: 8 }] };
|
|
17
|
+
const old = { roots: [], pull_request: pr(20, "2026-10-18T01:01:00Z", cone) };
|
|
18
|
+
const now = { roots: [], pull_request: pr(22, "2026-10-18T01:04:23Z", cone) };
|
|
19
|
+
const ran = { run: { present: true, commit: "3333333aaaa", updated: "2026-10-18T01:06:00Z" }, states: [{ number: 1, state: "applying", roots: ["network"] }], reads: [] };
|
|
20
|
+
const clock = new Date("2026-10-18T01:07:00Z");
|
|
21
|
+
|
|
22
|
+
describe("a frame pinned to this cycle", () => {
|
|
23
|
+
it("at planned reads again while its plan isn't in the reports, and stops once it is", () => {
|
|
24
|
+
expect(pinWaits(old, null, "pull-22-2222222", "22")).toEqual({ plan: true, run: false });
|
|
25
|
+
expect(pinWaits(now, null, "pull-22-2222222", "22")).toEqual({ plan: false, run: false });
|
|
26
|
+
expect(pinnedCaption(old, "pull-22-2222222", "22")).toBe("Pull request #22 is being planned; its plan shows here once the plan job writes it");
|
|
27
|
+
expect(pinnedCaption(now, "pull-22-2222222", "22")).toBeNull();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("at the merge never draws the last cycle's pull request, and reads again for this one's", () => {
|
|
31
|
+
expect(pinnedAnswer(old, "3333333", "22").pull_request).toBeNull();
|
|
32
|
+
expect(pinnedAnswer(now, "3333333", "22").pull_request.run.pull_request).toBe("22");
|
|
33
|
+
expect(pinWaits(old, null, "3333333", "22")).toEqual({ plan: true, run: true });
|
|
34
|
+
expect(pinnedCaption(old, "3333333", "22", null)).toBe("Pull request #22 is merged; the merge's run shows here once it starts");
|
|
35
|
+
// Without the pull named (a page that isn't the kiosk's frame), as before.
|
|
36
|
+
expect(pinnedAnswer(old, "3333333", null).pull_request.run.pull_request).toBe("20");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("names what it shows: this pull request's plan until the merge's run starts, then the merge's run", () => {
|
|
40
|
+
expect(viewCaption(now, null, clock, { merged: true })).toBe("the plan of pull request #22 at 01:04 UTC; the merge's run starts next");
|
|
41
|
+
expect(viewCaption(now, null, clock)).toBe("the plan of pull request #22 at 01:04 UTC, before the merge");
|
|
42
|
+
expect(viewCaption(now, ran, clock, { merged: true })).toBe("the merge's run (3333333a), planning each estate in full, as of 01:06 UTC");
|
|
43
|
+
expect(pinWaits(now, ran, "3333333", "22")).toEqual({ plan: false, run: false });
|
|
44
|
+
// A plan with no cone: the run's words as before.
|
|
45
|
+
expect(viewCaption({ roots: [], pull_request: pr(22, "2026-10-18T01:04:23Z") }, ran, clock)).toBe("the run of merge 3333333a, as of 01:06 UTC");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("tells the frame the cycle's pull request, through the view's own checks", () => {
|
|
49
|
+
expect(framePull({ step: "applying", pull: 22 })).toBe("22");
|
|
50
|
+
expect(framePull({ step: "reset", pull: 22 })).toBeNull();
|
|
51
|
+
expect(framePull({ step: "pull-request", pull: null })).toBeNull();
|
|
52
|
+
expect(settleView({ pull: "22" }, {}).apply).toEqual({ pull: "22" });
|
|
53
|
+
expect(settleView({ pull: "x" }, {}).refused[0]).toMatchObject({ key: "pull" });
|
|
54
|
+
expect(viewFromMessage({ origin: "https://k", data: { type: "behold:view", run: "3333333", pull: "22" } }, "https://k")).toEqual({ run: "3333333", pull: "22" });
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe("a cone's lines on a card", () => {
|
|
59
|
+
// About 6.3 px a character at 11.5 px, on a card with 160 px for words.
|
|
60
|
+
const measure = (t) => t.length * 6.3;
|
|
61
|
+
it("wrap to the card's width, never cut", () => {
|
|
62
|
+
expect(wrapWords("2 of 8 blocks, as a cone", 160, measure)).toEqual(["2 of 8 blocks, as a cone"]);
|
|
63
|
+
expect(wrapWords("iam_role_policy.service · changed", 160, measure)).toEqual(["iam_role_policy.service", "· changed"]);
|
|
64
|
+
expect(wrapWords("iam_role_policy.service_with_a_long_name · read", 160, measure)).toEqual(["iam_role_policy.service_", "with_a_long_name · read"]);
|
|
65
|
+
for (const line of wrapWords("planned in full: a provider block changed and the lock file too", 160, measure)) expect(measure(line)).toBeLessThanOrEqual(160);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe("nothing overlays the graph in Watch, on a held small stage only", () => {
|
|
70
|
+
const STEPS = ["pull-request", "planned", "merged", "applying", "waiting", "approved", "failed", "resumed", "applied", "reset"];
|
|
71
|
+
const demo = (step, scenario = "cone") => ({ cycle: 112, scenario, step, label: "", started_at: "2026-10-18T01:10:00Z", pull: 24, commit: "3333333", next: null });
|
|
72
|
+
const shotOf = (step, scenario) => shotFor(demo(step, scenario), { held: step === "waiting" ? 2 : null, gate: step === "waiting", progress: step === "applying" || step === "failed" || step === "resumed" ? { run: { present: true, commit: "3333333", updated: "2026-10-18T01:12:00Z" }, states: [{ number: 1, state: step === "failed" ? "failed" : "applying", roots: ["network"] }], reads: [] } : null });
|
|
73
|
+
|
|
74
|
+
it("held: at every step, applied included, no result card, no callout, no badges, no drawer the step opens", () => {
|
|
75
|
+
for (const step of STEPS) {
|
|
76
|
+
const shot = shotOf(step);
|
|
77
|
+
expect(watchOverlays({ kind: shot.kind, opened: false, held: true })).toEqual({ result: false, callout: false, badges: false, drawer: false });
|
|
78
|
+
}
|
|
79
|
+
// A drawer the viewer opened on a wave shows until they fold it.
|
|
80
|
+
expect(watchOverlays({ kind: "result", opened: true, held: true }).drawer).toBe(true);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("not held (b-waves, failure, tg-planned-outputs): the callout, the badges, the result card and the step's drawer, as on main", () => {
|
|
84
|
+
for (const scenario of ["b-waves", "failure", "tg-planned-outputs"]) {
|
|
85
|
+
for (const step of STEPS) {
|
|
86
|
+
const shot = shotOf(step, scenario);
|
|
87
|
+
const shows = watchOverlays({ kind: shot.kind, opened: false, held: false });
|
|
88
|
+
expect(shows).toMatchObject({ result: true, callout: true, badges: true });
|
|
89
|
+
// main: `const drawer = shot.kind === "active" || opened`.
|
|
90
|
+
expect(shows.drawer).toBe(shot.kind === "active");
|
|
91
|
+
}
|
|
92
|
+
expect(shotOf("applied", scenario).kind).toBe("result");
|
|
93
|
+
expect(shotOf("waiting", scenario).kind).toBe("held");
|
|
94
|
+
expect(watchOverlays({ kind: "result", opened: true }).drawer).toBe(true);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("held: opens no event-help modal and no Tips bubble in Watch; a stage that isn't held, and Inspect, as before", () => {
|
|
99
|
+
for (const kind of ["applied", "held", "failed", "refused"]) {
|
|
100
|
+
expect(modalShownElsewhere({ kind }, { watch: true, held: true })).toBe(true);
|
|
101
|
+
expect(modalShownElsewhere({ kind }, { watch: true, held: false })).toBe(false);
|
|
102
|
+
expect(modalShownElsewhere({ kind }, { watch: false, held: true })).toBe(false);
|
|
103
|
+
}
|
|
104
|
+
expect(tipsShown({ watch: true, held: true })).toBe(false);
|
|
105
|
+
expect(tipsShown({ watch: true, held: false })).toBe(true);
|
|
106
|
+
expect(tipsShown({ watch: false, held: true })).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("held: says what the cards said in one quiet line of the caption; not held, no such line", () => {
|
|
110
|
+
const result = { head: "Applied", line: "Done in 2 waves.", counts: ["2 waves applied", "1 updated", "3.2 s of job time"], waves: [] };
|
|
111
|
+
expect(stepLine(demo("applied"), { result, held: true })).toBe("2 waves applied · 1 updated · 3.2 s of job time");
|
|
112
|
+
const hold = { kind: "driver", head: "Wave 2 · plan 1a2b3c4d", appr: { approve: "chant approve tf-apply wave-2 --actor <reviewer> --sign <reviewer key>" } };
|
|
113
|
+
expect(stepLine(demo("waiting"), { hold, held: true })).toBe("Wave 2 · plan 1a2b3c4d: chant approve tf-apply wave-2 --actor <reviewer> --sign <reviewer key>");
|
|
114
|
+
expect(stepLine(demo("waiting"), { hold: { kind: "approval", head: "Wave 2 · run #41" }, held: true })).toBe("Wave 2 · run #41 waits for an approval");
|
|
115
|
+
expect(stepLine(demo("planned"), { result, hold, held: true })).toBeNull();
|
|
116
|
+
expect(stepLine(demo("applied", "b-waves"), { result })).toBeNull();
|
|
117
|
+
expect(stepLine(demo("waiting", "b-waves"), { hold, held: false })).toBeNull();
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("a root its wave never started, under a job that succeeded", () => {
|
|
122
|
+
const card = (root) => ({ root, wave: 2, state: "not-started", tone: "idle", words: "queued", short: "queued", facts: [] });
|
|
123
|
+
it("says unchanged when the run view's wave changed nothing in it", () => {
|
|
124
|
+
const progress = { states: [{ number: 2, state: "not-started", roots: ["service-a", "service-b"], changed: ["service-b"] }] };
|
|
125
|
+
expect(settleMember(card("service-a"), progress, 2)).toMatchObject({ state: "unchanged", words: "unchanged", short: "unchanged" });
|
|
126
|
+
expect(settleMember(card("x"), { states: [{ number: 2, totals: { "no-op": 3 } }] }, 2).words).toBe("unchanged");
|
|
127
|
+
});
|
|
128
|
+
it("while the wave's report is not read yet, says so, never skipped", () => {
|
|
129
|
+
expect(settleMember(card("service-b"), { states: [{ number: 2, state: "not-started" }] }, 2)).toMatchObject({ state: "reading", words: "wave done, reading its report", short: "reading its report" });
|
|
130
|
+
});
|
|
131
|
+
it("leaves every other card as it is", () => {
|
|
132
|
+
const c = { root: "a", state: "applied", words: "applied", facts: [] };
|
|
133
|
+
expect(settleMember({ ...c }, { states: [] }, 1)).toEqual(c);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
describe("a read between two choudoufu roots", () => {
|
|
138
|
+
const answer = (binaries) => ({ roots: [], ...(binaries ? { binaries } : {}), pull_request: { run: { finished: "2026-10-17T10:05:00Z" }, roots: ["service-a"], waves: [], reads: [{ root: "service-a", upstream: "network", data: "network", outputs: "applied" }] } });
|
|
139
|
+
it("is of the estate's outputs", () => {
|
|
140
|
+
const [e] = readEdges(answer({ "service-a": "choudoufu", network: "choudoufu" }), null);
|
|
141
|
+
expect(readLabel(e)).toBe("reads network's outputs");
|
|
142
|
+
expect(readLine(e)).toBe("service-a reads network's outputs as they stand (data network)");
|
|
143
|
+
const progress = { run: { present: true, updated: "2026-10-17T11:00:00Z" }, states: [{ number: 1 }], reads: [{ root: "service-a", reads: ["network"], wave: 2 }] };
|
|
144
|
+
expect(readLabel(readEdges(answer({ "service-a": "choudoufu", network: "choudoufu" }), progress)[0])).toBe("reads network's outputs");
|
|
145
|
+
});
|
|
146
|
+
it("of any other binary, or with no binaries named, reads the state as before", () => {
|
|
147
|
+
expect(readLabel(readEdges(answer({ "service-a": "tofu", network: "choudoufu" }), null)[0])).toBe("reads network's applied state");
|
|
148
|
+
expect(readLabel(readEdges(answer(null), null)[0])).toBe("reads network's applied state");
|
|
149
|
+
});
|
|
150
|
+
});
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { blockedHeader, blockedOf, outcomesOf, rootStates, waveRows } from "./terragucci-change.js";
|
|
3
|
+
import { componentMarks, tgReachOf } from "./terragucci-components-live.js";
|
|
4
|
+
import { createProgressPacer, trackWaves } from "./terragucci-live-pace.js";
|
|
5
|
+
|
|
6
|
+
// behold#741 (terragucci#1161): a failed root blocks only its dependents. The
|
|
7
|
+
// wave reports carry `waves[].blocked: [{ root, blocked_by }]` (minor 41),
|
|
8
|
+
// which /api/terragucci answers as `blocked: { commit, roots }`, and the run
|
|
9
|
+
// view a wave state `blocked` for a wave none of whose roots ran. A fan-out:
|
|
10
|
+
// network in wave 1; cluster-a and cluster-b in wave 2; app-01..03 under
|
|
11
|
+
// cluster-a and app-04..06 under cluster-b in wave 3. All of it is a story's
|
|
12
|
+
// alone (a kiosk telling a chapter-carrying scenario): without one, the
|
|
13
|
+
// states read exactly as on main, whatever the reports carry.
|
|
14
|
+
const MERGE = "c0ffee00c0ffee00c0ffee00c0ffee00c0ffee00";
|
|
15
|
+
const apps = ["app-01", "app-02", "app-03", "app-04", "app-05", "app-06"];
|
|
16
|
+
const all = ["network", "cluster-a", "cluster-b", ...apps];
|
|
17
|
+
const facets = {
|
|
18
|
+
jobs: [
|
|
19
|
+
{ component: "network", jobName: "apply-wave-1", wave: 1 },
|
|
20
|
+
{ component: "cluster-a", jobName: "apply-wave-2", wave: 2 },
|
|
21
|
+
{ component: "cluster-b", jobName: "apply-wave-2", wave: 2 },
|
|
22
|
+
...apps.map((a) => ({ component: a, jobName: "apply-wave-3", wave: 3 })),
|
|
23
|
+
],
|
|
24
|
+
roots: Object.fromEntries(all.map((r) => [r, r])),
|
|
25
|
+
};
|
|
26
|
+
const base = { roots: all.map((name) => ({ member: "demo", name, path: name })) };
|
|
27
|
+
const reads = [
|
|
28
|
+
{ root: "cluster-a", wave: 2, reads: ["network"] },
|
|
29
|
+
{ root: "cluster-b", wave: 2, reads: ["network"] },
|
|
30
|
+
...apps.map((a, i) => ({ root: a, wave: 3, reads: [i < 3 ? "cluster-a" : "cluster-b"] })),
|
|
31
|
+
];
|
|
32
|
+
const progress = (w2, w3, w3changed = ["app-04", "app-05", "app-06"]) => ({
|
|
33
|
+
run: { present: true, project: "demo", commit: MERGE, updated: "2026-10-18T10:05:00.000Z" },
|
|
34
|
+
watching: false,
|
|
35
|
+
states: [
|
|
36
|
+
{ number: 1, state: "applied", roots: ["network"], reads: [], changed: ["network"], totals: { update: 1 } },
|
|
37
|
+
{ number: 2, state: w2, roots: ["cluster-a", "cluster-b"], reads: [1], changed: ["cluster-a", "cluster-b"], totals: { update: 2 } },
|
|
38
|
+
{ number: 3, state: w3, roots: apps, reads: [2], ...(w3 === "not-started" ? {} : { changed: w3changed, totals: { update: w3changed.length } }) },
|
|
39
|
+
],
|
|
40
|
+
reads,
|
|
41
|
+
});
|
|
42
|
+
const story = { story: true };
|
|
43
|
+
const blocked = (commit = MERGE) => ({ commit, roots: Object.fromEntries(apps.slice(0, 3).map((a) => [a, { wave: 3, by: "cluster-a" }])) });
|
|
44
|
+
|
|
45
|
+
describe("a blocked root, from the wave reports (behold#741)", () => {
|
|
46
|
+
it("reads blocked and blocked_by when the reports carry them", () => {
|
|
47
|
+
const st = rootStates({ ...base, blocked: blocked() }, progress("failed", "applied"), story);
|
|
48
|
+
expect(st.roots["app-01"]).toMatchObject({ wave: 3, state: "blocked", tone: "wait", words: "wave 3 · blocked by cluster-a", blockedBy: "cluster-a" });
|
|
49
|
+
// The roots its failure did not reach apply.
|
|
50
|
+
expect(st.roots["app-04"]).toMatchObject({ state: "applied" });
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("names the original failure, whatever the report says of the roots between", () => {
|
|
54
|
+
const b = { commit: MERGE, roots: { "app-01": { wave: 3, by: "network" } } };
|
|
55
|
+
expect(blockedOf({ blocked: b }, progress("blocked", "blocked")).get("app-01")).toEqual({ wave: 3, by: "network" });
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("is nothing without a story, even on reports that carry the field (b-waves, failure, tg-planned-outputs)", () => {
|
|
59
|
+
const data = { ...base, blocked: blocked() };
|
|
60
|
+
const p = progress("failed", "applied");
|
|
61
|
+
expect(rootStates(data, p)).toEqual(rootStates(base, p));
|
|
62
|
+
expect(componentMarks(data, p, facets)).toEqual(componentMarks(base, p, facets));
|
|
63
|
+
// The run view's own blocked state reads as main reads it: its word, in the idle tone.
|
|
64
|
+
expect(rootStates(base, progress("failed", "blocked")).roots["app-05"]).toMatchObject({ state: "blocked", tone: "idle", words: "wave 3 · blocked" });
|
|
65
|
+
expect(waveRows(data, p)[2].text).toBe("wave 3 applied: app-01, app-02, app-03, app-04, app-05, app-06");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("is nothing for an older report without the field: the states read exactly as before", () => {
|
|
69
|
+
const before = rootStates(base, progress("failed", "not-started"), story);
|
|
70
|
+
expect(Object.values(before.roots).some((r) => r.state === "blocked")).toBe(false);
|
|
71
|
+
expect(blockedOf(base, progress("failed", "not-started")).size).toBe(0);
|
|
72
|
+
// And the components' marks carry no blocked header.
|
|
73
|
+
const m = componentMarks(base, progress("failed", "not-started"), facets);
|
|
74
|
+
expect(m.waves[3].status).toBe(null);
|
|
75
|
+
expect(m.cards["app-01"].state).not.toBe("blocked");
|
|
76
|
+
expect(m.reach).toBeUndefined();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("ignores another commit's blocked roots, and a wave not yet started", () => {
|
|
80
|
+
expect(blockedOf({ ...base, blocked: blocked("deadbeef") }, progress("failed", "applied")).size).toBe(0);
|
|
81
|
+
expect(blockedOf({ ...base, blocked: blocked() }, progress("failed", "not-started")).size).toBe(0);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("holds every root of a wave the run view says is blocked, by nobody named until its report is read", () => {
|
|
85
|
+
const st = rootStates(base, progress("failed", "blocked"), story);
|
|
86
|
+
expect(st.roots["app-05"]).toMatchObject({ state: "blocked", tone: "wait", words: "wave 3 · blocked" });
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("says the wave's header as N applied, N blocked by X, and a blocked wave as blocked by X", () => {
|
|
90
|
+
const b = blockedOf({ ...base, blocked: blocked() }, progress("failed", "applied"));
|
|
91
|
+
expect(blockedHeader(apps, b, "applied")).toBe("3 applied, 3 blocked by cluster-a");
|
|
92
|
+
expect(blockedHeader(apps.slice(0, 3), b, "blocked")).toBe("3 blocked by cluster-a");
|
|
93
|
+
expect(blockedHeader(["network"], b, "applied")).toBe(null);
|
|
94
|
+
const m = componentMarks({ ...base, blocked: blocked() }, progress("failed", "applied"), facets, { story: {} });
|
|
95
|
+
expect(m.waves[3].status).toMatchObject({ status: "done", words: "3 applied, 3 blocked by cluster-a" });
|
|
96
|
+
expect(m.waves[3].title).toBe("apply-wave-3 · 3 applied, 3 blocked by cluster-a");
|
|
97
|
+
expect(m.cards["app-02"]).toMatchObject({ state: "blocked", words: "blocked by cluster-a", short: "blocked", tone: "wait", blockedBy: "cluster-a" });
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("says a wave none of whose roots ran as blocked by X", () => {
|
|
101
|
+
const b = { commit: MERGE, roots: Object.fromEntries(apps.map((a) => [a, { wave: 3, by: "network" }])) };
|
|
102
|
+
const m = componentMarks({ ...base, blocked: b }, progress("blocked", "blocked"), facets, { story: {} });
|
|
103
|
+
expect(m.waves[3]).toMatchObject({ state: "blocked", tone: "wait", status: { status: "blocked", words: "6 blocked by network" } });
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// behold#741: each root's own outcome in its wave, asked of terragucci#1164 in
|
|
108
|
+
// one of two shapes until its field is named (src/terragucci-reports.ts
|
|
109
|
+
// waveOutcomes), and answered by /api/terragucci as `outcomes`.
|
|
110
|
+
describe("a root's own outcome in a failed wave (behold#741)", () => {
|
|
111
|
+
const outcomes = { commit: MERGE, roots: { "cluster-a": { wave: 2, outcome: "failed", error: "Error: creating EKS cluster cluster-a: InvalidParameterException: subnet is full" }, "cluster-b": { wave: 2, outcome: "applied" } } };
|
|
112
|
+
it("reads cluster-b applied beside a failed cluster-a, and the failure's error as chant's cards say it", () => {
|
|
113
|
+
const m = componentMarks({ ...base, blocked: blocked(), outcomes }, progress("failed", "applied"), facets, { story: { kiosk: true } });
|
|
114
|
+
expect(m.cards["cluster-b"]).toMatchObject({ state: "applied", tone: "ok", words: "applied" });
|
|
115
|
+
expect(m.cards["cluster-a"]).toMatchObject({ state: "failed", tone: "bad" });
|
|
116
|
+
expect(m.cards["cluster-a"].words).toMatch(/^failed: /);
|
|
117
|
+
expect(m.cards["cluster-a"].facts[0]).toBe("failed: Error: creating EKS cluster cluster-a: InvalidParameterException: subnet is full");
|
|
118
|
+
expect(m.waves[2].status).toMatchObject({ status: "failed", words: "1 failed, 1 applied", tone: "bad" });
|
|
119
|
+
expect(m.waves[2].facts[0]).toMatch(/^cluster-a failed: /);
|
|
120
|
+
// The reach now starts at the one root that failed.
|
|
121
|
+
expect(m.reach).toMatchObject({ roots: ["cluster-a"], covered: ["app-01", "app-02", "app-03"] });
|
|
122
|
+
});
|
|
123
|
+
it("waits for the wave to settle, and is nothing without a story or another commit's", () => {
|
|
124
|
+
const p = progress("failed", "applied");
|
|
125
|
+
expect(outcomesOf({ outcomes }, { ...p, states: p.states.map((w) => (w.number === 2 ? { ...w, state: "applying" } : w)) }).size).toBe(2);
|
|
126
|
+
expect(rootStates({ ...base, outcomes }, { ...p, states: p.states.map((w) => (w.number === 2 ? { ...w, state: "applying" } : w)) }, story).roots["cluster-b"].state).toBe("applying");
|
|
127
|
+
expect(rootStates({ ...base, outcomes }, p).roots["cluster-b"].state).toBe("failed");
|
|
128
|
+
expect(outcomesOf({ outcomes: { ...outcomes, commit: "deadbeef" } }, p).size).toBe(0);
|
|
129
|
+
expect(outcomesOf(base, p).size).toBe(0);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe("a terragucci story's marks (behold#741)", () => {
|
|
134
|
+
it("draws the failure's reach over the roots it blocked, from the run view's reads", () => {
|
|
135
|
+
const m = componentMarks({ ...base, blocked: blocked() }, progress("failed", "applied"), facets, { story: { kiosk: true } });
|
|
136
|
+
// cluster-a failed: the wave says failed for both of its roots, as before.
|
|
137
|
+
expect(m.reach).toMatchObject({ tone: "bad", label: "3 blocked", roots: ["cluster-a", "cluster-b"] });
|
|
138
|
+
expect(m.reach.covered).toEqual(["app-01", "app-02", "app-03"]);
|
|
139
|
+
expect(m).toMatchObject({ cardFont: 15, waveFont: 18, statusRight: true });
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it("draws the plan's reach from the changed root, over the planned roots downstream of it", () => {
|
|
143
|
+
const pr = {
|
|
144
|
+
run: { pull_request: "12", commit: "aa", finished: "2026-10-18T10:00:00Z" },
|
|
145
|
+
roots: all,
|
|
146
|
+
reads: [],
|
|
147
|
+
upstreams: Object.fromEntries(reads.map((r) => [r.root, r.reads])),
|
|
148
|
+
counts: { network: { update: 1 } },
|
|
149
|
+
waves: [
|
|
150
|
+
{ number: 1, roots: ["network"], set_digest: "jcs1-sha256:1111" },
|
|
151
|
+
{ number: 2, roots: ["cluster-a", "cluster-b"], set_digest: "jcs1-sha256:2222" },
|
|
152
|
+
{ number: 3, roots: apps, set_digest: "jcs1-sha256:3333" },
|
|
153
|
+
],
|
|
154
|
+
// Every root's plan changes: the network change reaches them all.
|
|
155
|
+
blast: { roots: all, downstream: [] },
|
|
156
|
+
};
|
|
157
|
+
const m = componentMarks({ ...base, pull_request: pr }, null, facets, { story: { kiosk: true } });
|
|
158
|
+
expect(m.reach).toMatchObject({ tone: "plan", roots: ["network"], label: "reaches 9 roots" });
|
|
159
|
+
expect(m.cards.network.facts).toContain("plans 1 update");
|
|
160
|
+
// A later pull request of the cycle (the fix): what landed before reads applied earlier.
|
|
161
|
+
const fix = { ...pr, roots: ["cluster-a", ...apps.slice(0, 3)], waves: [{ number: 2, roots: ["cluster-a"], set_digest: "x" }, { number: 3, roots: apps.slice(0, 3), set_digest: "y" }], blast: { roots: ["cluster-a", ...apps.slice(0, 3)], downstream: [] } };
|
|
162
|
+
const f = componentMarks({ ...base, pull_request: fix }, null, facets, { story: { kiosk: true, earlier: new Set(["network", "cluster-b", "app-04"]) } });
|
|
163
|
+
expect(f.cards.network).toMatchObject({ state: "applied-earlier", words: "applied earlier", tone: "ok" });
|
|
164
|
+
expect(f.reach).toMatchObject({ label: "the fix reaches 4", roots: ["cluster-a"] });
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it("has no reach without a story, and none once the apply runs without a failure", () => {
|
|
168
|
+
expect(tgReachOf({ a: { root: "a", state: "applying" } }, { stage: "apply" })).toBe(null);
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
describe("the paced run view (behold#741)", () => {
|
|
173
|
+
it("shows a run first seen as it stands, then each wave's change at the pace", () => {
|
|
174
|
+
let t = 0;
|
|
175
|
+
const pacer = createProgressPacer({ now: () => t, pace: { apply: 3000, done: 1500, catchApply: 1200, catchDone: 600 } });
|
|
176
|
+
const p0 = { ...progress("not-started", "not-started"), watching: true };
|
|
177
|
+
p0.states[0].state = "applying";
|
|
178
|
+
expect(pacer.progress(p0)).toBe(p0);
|
|
179
|
+
// One read later wave 1 applied and wave 2 failed: wave 1 settles once it showed applying long enough.
|
|
180
|
+
const p1 = { ...progress("failed", "not-started"), watching: true };
|
|
181
|
+
t = 500;
|
|
182
|
+
expect(trackWaves(pacer.progress(p1)).map((w) => w.state)).toEqual(["running", "waiting", "waiting"]);
|
|
183
|
+
expect(pacer.pending).toBe(true);
|
|
184
|
+
t = 3000;
|
|
185
|
+
expect(trackWaves(pacer.progress(p1)).map((w) => w.state)).toEqual(["applied", "waiting", "waiting"]);
|
|
186
|
+
t = 4600;
|
|
187
|
+
expect(trackWaves(pacer.progress(p1)).map((w) => w.state)).toEqual(["applied", "running", "waiting"]);
|
|
188
|
+
t = 7700;
|
|
189
|
+
expect(trackWaves(pacer.progress(p1)).map((w) => w.state)).toEqual(["applied", "failed", "waiting"]);
|
|
190
|
+
expect(pacer.pending).toBe(false);
|
|
191
|
+
});
|
|
192
|
+
});
|