@intentius/behold 0.29.46 → 0.29.48
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.js +13 -10
- package/package.json +1 -1
- package/web/app.js +22 -0
- package/web/event-help-modal.js +13 -3
- package/web/kiosk-annotations.js +2 -2
- package/web/kiosk-event-help-ui.js +46 -9
- package/web/kiosk-event-help.js +6 -3
- package/web/kiosk-metrics.js +39 -8
- package/web/kiosk-metrics.test.js +36 -1
- package/web/kiosk-modal-sticky.test.js +27 -3
- package/web/kiosk-result.test.js +36 -0
- package/web/kiosk-runs.js +12 -0
- package/web/kiosk-story-gate.test.js +22 -1
- package/web/kiosk-trace.js +84 -21
- package/web/kiosk-trace.test.js +56 -10
- package/web/kiosk-track.js +58 -8
- package/web/kiosk-track.test.js +46 -1
- package/web/kiosk-watch.js +3 -1
- package/web/kiosk-watch.test.js +2 -0
- package/web/kiosk-wave-list.js +130 -0
- package/web/kiosk-wave-list.test.js +103 -0
- package/web/kiosk.html +82 -10
- package/web/kiosk.js +202 -46
- package/web/kiosk.test.js +112 -2
- package/web/small-stage.test.js +8 -0
- package/web/terragucci-change.js +32 -1
- package/web/terragucci-wave-results.test.js +56 -1
package/web/kiosk.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { linkState, linkWords, noteBack, noteRead, readFailed, shareLink } from "./kiosk-link.js";
|
|
17
17
|
import { CHANT_PANEL_STEPS, chantApprovalModel, chantResultModel } from "./chant-pr-marks.js";
|
|
18
18
|
import { createLivePacer } from "./chant-live-pace.js";
|
|
19
|
-
import { cycleTrack, drawTrack, trackModel, waitingSpec } from "./kiosk-track.js";
|
|
19
|
+
import { applyJobs, cycleTrack, drawTrack, trackModel, waitingSpec } from "./kiosk-track.js";
|
|
20
20
|
import { FORGES, iconSvg } from "./forge-mark.js";
|
|
21
21
|
import { TOOLS } from "./tool-mark.js";
|
|
22
22
|
import { graphWaves } from "./chant-pr-marks.js";
|
|
@@ -33,6 +33,7 @@ import { cssString, hoverCss, hoverFromMessage, hoverLinks, hoverMessage, isLigh
|
|
|
33
33
|
import { creditLines, filterIndex, keepRun, kioskVendorOf, liveEstimate, liveFor, namesOther, notRunRepo, notRunWords, replayAt, replayBanner, replayIndex, rootNoun, rootWord, runAsOf, scrubDemo, servesRepo, vendorOf } from "./kiosk-vendor.js";
|
|
34
34
|
import { repoParam, repoUrl, stepCheckout } from "./kiosk-repo.js";
|
|
35
35
|
import { startKioskCarve } from "./kiosk-carve.js";
|
|
36
|
+
import { drawWaveList, waveListKey } from "./kiosk-wave-list.js";
|
|
36
37
|
import { readsFor } from "./kiosk-source.js";
|
|
37
38
|
import { STATE_WORDS, changingRoots, costLine, pinsCommit, planFitsPin, pullPin, readEdges, rootsCount, totalsLine, waveRows, blastRows } from "./terragucci-change.js";
|
|
38
39
|
|
|
@@ -759,10 +760,11 @@ export function viewZoom(view) {
|
|
|
759
760
|
|
|
760
761
|
/**
|
|
761
762
|
* The toggle, "Resources | Components", over the frame: the view shown
|
|
762
|
-
* pressed, and a line saying whether the step leads or a click holds it
|
|
763
|
-
* Not drawn at all when the repo
|
|
763
|
+
* pressed, and a line saying whether the step leads or a click holds it
|
|
764
|
+
* (behold#779: a tap, on a touch screen). Not drawn at all when the repo
|
|
765
|
+
* offers no components zoom.
|
|
764
766
|
*/
|
|
765
|
-
export function renderViewToggle(host, shown, { components = false, onPick = () => {} } = {}) {
|
|
767
|
+
export function renderViewToggle(host, shown, { components = false, onPick = () => {}, touch = touchScreen() } = {}) {
|
|
766
768
|
if (!host) return;
|
|
767
769
|
host.replaceChildren();
|
|
768
770
|
host.hidden = !components;
|
|
@@ -780,7 +782,7 @@ export function renderViewToggle(host, shown, { components = false, onPick = ()
|
|
|
780
782
|
}
|
|
781
783
|
host.appendChild(group);
|
|
782
784
|
const on = VIEWS.find((v) => v.id === shown.view);
|
|
783
|
-
const lead = shown.pinned ? `held by a click; the step leads again in ${shown.secs} s` : "follows the step";
|
|
785
|
+
const lead = shown.pinned ? `held by a ${touch ? "tap" : "click"}; the step leads again in ${shown.secs} s` : "follows the step";
|
|
784
786
|
host.appendChild(el("span", "k-view-note", on ? `${on.shows} · ${lead}` : lead));
|
|
785
787
|
}
|
|
786
788
|
|
|
@@ -935,6 +937,9 @@ function drawBar(bar, s, now) {
|
|
|
935
937
|
title.appendChild(el("span", "k-title-text", head.title));
|
|
936
938
|
if (title.setAttribute) title.setAttribute("title", `${head.kicker} · ${head.title || ""}`);
|
|
937
939
|
titleBox.append(over, title);
|
|
940
|
+
// behold#777: a phone's line on what this is, under the title (hidden wider, so the title's box keeps its height).
|
|
941
|
+
const introWords = introFor(s);
|
|
942
|
+
if (introWords) titleBox.appendChild(el("p", "k-w-intro", introWords));
|
|
938
943
|
left.appendChild(titleBox);
|
|
939
944
|
|
|
940
945
|
// The first beat: what changes; between scenarios, what the demo is about.
|
|
@@ -1001,6 +1006,10 @@ function drawBar(bar, s, now) {
|
|
|
1001
1006
|
holdBox.appendChild(a);
|
|
1002
1007
|
} else for (const l of hold.lines) holdBox.appendChild(elRoots("p", l.cls, l.text, s));
|
|
1003
1008
|
}
|
|
1009
|
+
// behold#801: each finished wave's trace, as Watch's result card shows them, under the hold (or in its place).
|
|
1010
|
+
const traces = el("section", "k-i-traces");
|
|
1011
|
+
drawWaveTraces(traces, s);
|
|
1012
|
+
if (!traces.hidden) holdBox.appendChild(traces);
|
|
1004
1013
|
// behold#571: render what's present: an empty hold keeps its place (nothing moves when one comes) but draws no box.
|
|
1005
1014
|
if (!holdBox.children.length) holdBox.className += " k-box-empty";
|
|
1006
1015
|
right.appendChild(holdBox);
|
|
@@ -1047,11 +1056,22 @@ export function renderModeToggle(host, mode, onPick) {
|
|
|
1047
1056
|
}
|
|
1048
1057
|
}
|
|
1049
1058
|
|
|
1050
|
-
/** behold#
|
|
1051
|
-
export function
|
|
1052
|
-
return
|
|
1059
|
+
/** behold#779: a touch screen (a phone), where the viewer taps rather than clicks. */
|
|
1060
|
+
export function touchScreen() {
|
|
1061
|
+
return typeof matchMedia === "function" && matchMedia("(pointer: coarse)").matches;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* behold#571: the words over a held shot, and the button that follows the step again.
|
|
1066
|
+
* behold#779: on a touch screen a tap held it, often a stray one, so the words say so and the button is a big one.
|
|
1067
|
+
*/
|
|
1068
|
+
export function heldWords(secs, touch = false) {
|
|
1069
|
+
return touch ? `Paused where you tapped · the steps go on in ${secs} s` : `Held where you left it · the steps lead again in ${secs} s`;
|
|
1053
1070
|
}
|
|
1054
1071
|
export const FOLLOW_WORDS = "Follow the steps";
|
|
1072
|
+
export const RESUME_WORDS = "Resume now";
|
|
1073
|
+
/** behold#779: how long a tap on a touch screen holds Watch's shot (a click holds it PICK_HOLD_MS). */
|
|
1074
|
+
export const TAP_HOLD_MS = 20_000;
|
|
1055
1075
|
|
|
1056
1076
|
/** Watch's header: the scenario's place and the strip on the left, the delivery numbers on the right. */
|
|
1057
1077
|
function drawWatchHead(bar, s, now) {
|
|
@@ -1074,6 +1094,8 @@ function drawWatchHead(bar, s, now) {
|
|
|
1074
1094
|
// behold#746: a tool's page says in Watch too that it replays an earlier run.
|
|
1075
1095
|
if (vendor && s.mode === "replay" && s.replay && s.replay.banner) place.appendChild(el("span", "k-cycle k-w-replay", s.replay.banner));
|
|
1076
1096
|
bar.appendChild(place);
|
|
1097
|
+
const intro = introFor(s);
|
|
1098
|
+
if (intro) bar.appendChild(el("p", "k-w-intro", intro));
|
|
1077
1099
|
const strip = el("ol", "k-strip");
|
|
1078
1100
|
// behold#631: a chant pull request's wait for its approval comes before its merge. Without a stop of its own on the
|
|
1079
1101
|
// strip it shows as "planned", for the fix's pull request as for the first.
|
|
@@ -1081,8 +1103,9 @@ function drawWatchHead(bar, s, now) {
|
|
|
1081
1103
|
// behold#631: a chant kiosk's projected track says where the cycle is; the rail goes.
|
|
1082
1104
|
if (!s.trackOn) bar.appendChild(strip);
|
|
1083
1105
|
if (s.watchHeld) {
|
|
1084
|
-
const
|
|
1085
|
-
const
|
|
1106
|
+
const touch = touchScreen();
|
|
1107
|
+
const p = el("span", "k-w-held", heldWords(s.watchHeld.secs, touch));
|
|
1108
|
+
const b = el("button", "k-w-resume", touch ? RESUME_WORDS : FOLLOW_WORDS);
|
|
1086
1109
|
b.type = "button";
|
|
1087
1110
|
b.addEventListener("click", () => s.followSteps && s.followSteps());
|
|
1088
1111
|
p.appendChild(b);
|
|
@@ -1091,7 +1114,7 @@ function drawWatchHead(bar, s, now) {
|
|
|
1091
1114
|
const dora = doraLine(s.metrics);
|
|
1092
1115
|
if (dora) {
|
|
1093
1116
|
const p = el("p", "k-w-dora", dora);
|
|
1094
|
-
if (p.setAttribute) p.setAttribute("title", s.metrics && s.metrics.
|
|
1117
|
+
if (p.setAttribute) p.setAttribute("title", [dora, s.metrics && s.metrics.windowNote, s.metrics && s.metrics.note].filter(Boolean).join(". "));
|
|
1095
1118
|
bar.appendChild(p);
|
|
1096
1119
|
}
|
|
1097
1120
|
}
|
|
@@ -1184,6 +1207,25 @@ function drawCaption(host, s, now) {
|
|
|
1184
1207
|
}
|
|
1185
1208
|
}
|
|
1186
1209
|
|
|
1210
|
+
/**
|
|
1211
|
+
* behold#781: Inspect's "The change" block (factLines: the pull request's
|
|
1212
|
+
* totals, its blast radius, what it leaves unchanged), for a phone's Watch,
|
|
1213
|
+
* where the graph's colours were its only telling. CSS shows it on a phone.
|
|
1214
|
+
*/
|
|
1215
|
+
function drawChange(host, s) {
|
|
1216
|
+
const demo = s.demo && s.demo.demo;
|
|
1217
|
+
const parts = demo && !s.noReports ? factLines(demo, s.answer, nounTool(s)) : [];
|
|
1218
|
+
host.hidden = !parts.length;
|
|
1219
|
+
const key = JSON.stringify([parts, s.light, s.rootNames]);
|
|
1220
|
+
if (host.dataset.key === key) return;
|
|
1221
|
+
host.dataset.key = key;
|
|
1222
|
+
host.replaceChildren();
|
|
1223
|
+
if (!parts.length) return;
|
|
1224
|
+
const p = el("p", "k-facts");
|
|
1225
|
+
for (const part of parts) p.appendChild(elRoots("span", "k-fact", part, s));
|
|
1226
|
+
host.append(el("p", "k-change-label", FACTS_LABEL), p);
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1187
1229
|
/** The cone plan's line (kiosk-watch.js coneCaption): the plan's words, then the backend's, quieter. */
|
|
1188
1230
|
export function coneEl(cls, c) {
|
|
1189
1231
|
const p = el("p", `${cls} k-cone`);
|
|
@@ -1253,14 +1295,19 @@ export const DRAWER_EMPTY = "The job's lines show here as it writes them.";
|
|
|
1253
1295
|
export const DRAWER_MORE = "Open the log";
|
|
1254
1296
|
export const DRAWER_LESS = "Close";
|
|
1255
1297
|
|
|
1256
|
-
/**
|
|
1257
|
-
|
|
1298
|
+
/**
|
|
1299
|
+
* The result card at the end of the run: the counts, and each wave's numbers.
|
|
1300
|
+
* behold#782: the caption under the graph already says "Applied" and the
|
|
1301
|
+
* step's line, so the card leads with its first count ("3 waves applied") and
|
|
1302
|
+
* leaves the line to the caption.
|
|
1303
|
+
*/
|
|
1304
|
+
export function drawResult(host, model, s) {
|
|
1258
1305
|
host.replaceChildren();
|
|
1259
|
-
|
|
1260
|
-
|
|
1306
|
+
const [lead, ...rest] = model.counts.length ? model.counts : [model.head];
|
|
1307
|
+
host.appendChild(el("p", "k-result-head", lead));
|
|
1261
1308
|
const counts = el("ul", "k-result-counts");
|
|
1262
|
-
for (const c of
|
|
1263
|
-
host.appendChild(counts);
|
|
1309
|
+
for (const c of rest) counts.appendChild(el("li", null, c));
|
|
1310
|
+
if (rest.length) host.appendChild(counts);
|
|
1264
1311
|
// behold#571: a row for every wave, in wave order: its trace as one bar of its phases (a click opens the whole trace),
|
|
1265
1312
|
// else its numbers, else a quiet line until they land. Never fewer rows than the count says.
|
|
1266
1313
|
const bars = new Map(miniWaterfall(s.waveTraces || {}).map((r) => [r.wave, r]));
|
|
@@ -1276,34 +1323,66 @@ function drawResult(host, model, s) {
|
|
|
1276
1323
|
wf.appendChild(row);
|
|
1277
1324
|
continue;
|
|
1278
1325
|
}
|
|
1279
|
-
|
|
1280
|
-
row.type = "button";
|
|
1281
|
-
const held = r.bars.find((b) => b.phase === "held");
|
|
1282
|
-
row.title = `${TRACE_OPEN_WORDS} · ${r.bars.map(phaseWords).join(" · ")}`;
|
|
1283
|
-
const track = el("span", "k-wf-track");
|
|
1284
|
-
for (const b of r.bars) {
|
|
1285
|
-
const seg = el("i", `k-wf-seg k-wf-${b.phase}`);
|
|
1286
|
-
seg.style.left = `${(b.at * 100).toFixed(2)}%`;
|
|
1287
|
-
seg.style.width = `${Math.max(0.6, b.width * 100).toFixed(2)}%`;
|
|
1288
|
-
seg.title = phaseWords(b);
|
|
1289
|
-
track.appendChild(seg);
|
|
1290
|
-
}
|
|
1291
|
-
row.append(el("span", "k-wf-wave", `Wave ${r.wave}`), track, el("span", "k-wf-ms", held ? phaseWords(held) : r.words), el("span", "k-wf-go", TRACE_LINK_WORDS));
|
|
1292
|
-
row.addEventListener("click", () => s.openWave && s.openWave(r.wave, "trace"));
|
|
1293
|
-
wf.appendChild(row);
|
|
1294
|
-
}
|
|
1295
|
-
if (bars.size) {
|
|
1296
|
-
const key = el("p", "k-wf-key");
|
|
1297
|
-
for (const [cls, words] of PHASE_KEY) {
|
|
1298
|
-
const k = el("span");
|
|
1299
|
-
k.append(el("i", `k-wf-sw k-wf-${cls}`), words);
|
|
1300
|
-
key.appendChild(k);
|
|
1301
|
-
}
|
|
1302
|
-
wf.appendChild(key);
|
|
1326
|
+
wf.appendChild(traceRow(r, s));
|
|
1303
1327
|
}
|
|
1328
|
+
if (bars.size) wf.appendChild(phaseKey());
|
|
1304
1329
|
host.appendChild(wf);
|
|
1305
1330
|
}
|
|
1306
1331
|
}
|
|
1332
|
+
|
|
1333
|
+
/** behold#571: a wave's trace as one bar of its phases, a button that opens the whole trace. */
|
|
1334
|
+
function traceRow(r, s) {
|
|
1335
|
+
const row = el("button", "k-wf-row");
|
|
1336
|
+
row.type = "button";
|
|
1337
|
+
const held = r.bars.find((b) => b.phase === "held");
|
|
1338
|
+
row.title = `${TRACE_OPEN_WORDS} · ${r.bars.map(phaseWords).join(" · ")}`;
|
|
1339
|
+
const track = el("span", "k-wf-track");
|
|
1340
|
+
for (const b of r.bars) {
|
|
1341
|
+
const seg = el("i", `k-wf-seg k-wf-${b.phase}`);
|
|
1342
|
+
seg.style.left = `${(b.at * 100).toFixed(2)}%`;
|
|
1343
|
+
seg.style.width = `${Math.max(0.6, b.width * 100).toFixed(2)}%`;
|
|
1344
|
+
seg.title = phaseWords(b);
|
|
1345
|
+
track.appendChild(seg);
|
|
1346
|
+
}
|
|
1347
|
+
row.append(el("span", "k-wf-wave", `Wave ${r.wave}`), track, el("span", "k-wf-ms", held ? phaseWords(held) : r.words), el("span", "k-wf-go", TRACE_LINK_WORDS));
|
|
1348
|
+
row.addEventListener("click", () => s.openWave && s.openWave(r.wave, "trace"));
|
|
1349
|
+
return row;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
/** The phases' key under the trace rows. */
|
|
1353
|
+
function phaseKey() {
|
|
1354
|
+
const key = el("p", "k-wf-key");
|
|
1355
|
+
for (const [cls, words] of PHASE_KEY) {
|
|
1356
|
+
const k = el("span");
|
|
1357
|
+
k.append(el("i", `k-wf-sw k-wf-${cls}`), words);
|
|
1358
|
+
key.appendChild(k);
|
|
1359
|
+
}
|
|
1360
|
+
return key;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* behold#775: on a phone, each wave's trace as soon as the wave has one, under
|
|
1365
|
+
* the step: the badges that open a trace on a wider screen have no room
|
|
1366
|
+
* there. The result card carries the same rows at the end, so this goes then.
|
|
1367
|
+
*/
|
|
1368
|
+
export function drawWaveTraces(host, s, { shown = true } = {}) {
|
|
1369
|
+
const rows = shown ? miniWaterfall(s.waveTraces || {}) : [];
|
|
1370
|
+
host.hidden = !rows.length;
|
|
1371
|
+
const key = rows.map((r) => `${r.wave}|${r.run}|${r.ms}`).join(",");
|
|
1372
|
+
// A host built fresh each draw (Inspect's header) may have no dataset to remember its key by.
|
|
1373
|
+
const ds = host.dataset || {};
|
|
1374
|
+
if (ds.key === key) return;
|
|
1375
|
+
ds.key = key;
|
|
1376
|
+
host.replaceChildren();
|
|
1377
|
+
if (!rows.length) return;
|
|
1378
|
+
host.appendChild(el("p", "k-w-traces-head", WAVE_TRACES_WORDS));
|
|
1379
|
+
const wf = el("div", "k-wf");
|
|
1380
|
+
for (const r of rows) wf.appendChild(traceRow(r, s));
|
|
1381
|
+
wf.appendChild(phaseKey());
|
|
1382
|
+
host.appendChild(wf);
|
|
1383
|
+
}
|
|
1384
|
+
/** behold#775: the head over the phone's trace rows. */
|
|
1385
|
+
export const WAVE_TRACES_WORDS = "Each wave's trace, as it finishes";
|
|
1307
1386
|
/** behold#571: a wave's row on the result card before its numbers land. */
|
|
1308
1387
|
export const NUMBERS_SOON = "its numbers land in a moment";
|
|
1309
1388
|
/** behold#571: the words of a trace's links, and the phases' key. */
|
|
@@ -1418,6 +1497,24 @@ export const DRIVER_SIGNS = "Next the driver plays a reviewer outside the change
|
|
|
1418
1497
|
export const WHAT_TEXT = "This is behold, a live view of infrastructure. It draws the setup as a graph and shows its pipeline runs, their logs and the approvals they wait for, as they happen. Here it watches a demo pipeline that runs one change through several Terraform states in a loop.";
|
|
1419
1498
|
/** behold#752: the same, for chant's fan-out demo, whose stacks are CloudFormation's. */
|
|
1420
1499
|
export const WHAT_TEXT_CHANT = "This is behold, a live view of infrastructure. It draws the setup as a graph and shows its pipeline runs, their logs and the approvals they wait for, as they happen. Here it watches chant's pull-request pipeline run one change across fifteen stacks in a loop.";
|
|
1500
|
+
/** behold#777: the same, for a terragucci repo's demo, so the popover names what the phone's intro line names. */
|
|
1501
|
+
export const WHAT_TEXT_TG = "This is behold, a live view of infrastructure. It draws the setup as a graph and shows its pipeline runs, their logs and the approvals they wait for, as they happen. Here it watches terragucci, which applies one change to many Terraform or OpenTofu states in waves, run its demo pipeline in a loop.";
|
|
1502
|
+
/** behold#777: "What is this?"'s words for the page: chant's pipeline, a terragucci repo's, or any other. */
|
|
1503
|
+
export function whatTextFor({ chant = false, tg = false } = {}) {
|
|
1504
|
+
return chant ? WHAT_TEXT_CHANT : tg ? WHAT_TEXT_TG : WHAT_TEXT;
|
|
1505
|
+
}
|
|
1506
|
+
/**
|
|
1507
|
+
* behold#777: the phone's one line under the title, the popover's first two
|
|
1508
|
+
* sentences cut to one: what behold is, and whose pipeline it watches. None on
|
|
1509
|
+
* a tool's page, which may not name the others.
|
|
1510
|
+
*/
|
|
1511
|
+
export function introLine({ chant = false, tg = false, vendor = false } = {}) {
|
|
1512
|
+
if (vendor) return null;
|
|
1513
|
+
if (tg) return "behold, a live view of infrastructure, watching terragucci apply one change to many states, wave by wave.";
|
|
1514
|
+
if (chant) return "behold, a live view of infrastructure, watching chant's pull-request pipeline apply one change across many stacks.";
|
|
1515
|
+
return "behold, a live view of infrastructure, watching a demo pipeline run one change in a loop.";
|
|
1516
|
+
}
|
|
1517
|
+
const introFor = (s) => introLine({ chant: !!(s.chantLoop || s.source === "chant-demo"), tg: !!s.tgRepo, vendor: !!vendorOf(s.vendor) });
|
|
1421
1518
|
export const WHAT_DOCS = { text: "behold's documentation", url: "https://intentius.io/behold/" };
|
|
1422
1519
|
|
|
1423
1520
|
/** behold#571: a fade at a box's edge where its text goes on past it. */
|
|
@@ -1789,7 +1886,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1789
1886
|
};
|
|
1790
1887
|
function holdTick() {
|
|
1791
1888
|
if (watchHoldAt === null) return void (s.watchHeld = null);
|
|
1792
|
-
|
|
1889
|
+
// behold#779: on a touch screen most holds are a stray tap or a scroll over the graph: they hold a shorter time.
|
|
1890
|
+
const left = watchHoldAt + (touchScreen() ? TAP_HOLD_MS : PICK_HOLD_MS) - now().getTime();
|
|
1793
1891
|
if (left <= 0) {
|
|
1794
1892
|
watchHoldAt = null;
|
|
1795
1893
|
s.watchHeld = null;
|
|
@@ -1894,7 +1992,9 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1894
1992
|
trackState.key = key;
|
|
1895
1993
|
trackState.since = Number.isFinite(from) && from <= t && t - from < 600_000 ? from : t;
|
|
1896
1994
|
}
|
|
1897
|
-
|
|
1995
|
+
// behold#774: the run's own jobs say the apply started before its run view does.
|
|
1996
|
+
const jobs = applyJobs(runsApi && runsApi.run ? runsApi.run.doc : null, d);
|
|
1997
|
+
const model = trackModel(track, { demo: d, pulls: trackState.pulls, since: trackState.since, now: t, waves: live ? live.waves : null, jobs });
|
|
1898
1998
|
s.trackModel = model;
|
|
1899
1999
|
drawTrack(trackHost, model);
|
|
1900
2000
|
// In the trail's place: over the caption.
|
|
@@ -1945,6 +2045,17 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1945
2045
|
watch.layer.appendChild(foot);
|
|
1946
2046
|
}
|
|
1947
2047
|
foot.textContent = doraLine(s.metrics) || "";
|
|
2048
|
+
// behold#781, behold#776: a phone's Watch says the change in words by the story, and lists the graph's marks.
|
|
2049
|
+
if (watch.change) drawChange(watch.change, s);
|
|
2050
|
+
drawWaves();
|
|
2051
|
+
// behold#775: on a phone, each finished wave's trace under the step (hidden on a wider screen, where the badges open them).
|
|
2052
|
+
let traces = watch.layer.querySelector(":scope > .k-w-traces");
|
|
2053
|
+
if (!traces) {
|
|
2054
|
+
traces = el("section", "k-w-traces");
|
|
2055
|
+
if (traces.setAttribute) traces.setAttribute("aria-label", WAVE_TRACES_WORDS);
|
|
2056
|
+
watch.caption.after ? watch.caption.after(traces) : watch.layer.appendChild(traces);
|
|
2057
|
+
}
|
|
2058
|
+
drawWaveTraces(traces, s, { shown: !result });
|
|
1948
2059
|
watch.badges.replaceChildren();
|
|
1949
2060
|
const skip = call ? hold.wave : drawer ? drawerOn : null;
|
|
1950
2061
|
// At applied the result card lists every wave's numbers, so the boxes carry none; a held small stage carries none at all.
|
|
@@ -1964,6 +2075,40 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1964
2075
|
}
|
|
1965
2076
|
placeWatch();
|
|
1966
2077
|
}
|
|
2078
|
+
/**
|
|
2079
|
+
* behold#776: the frame's marks as a list (web/kiosk-wave-list.js), drawn
|
|
2080
|
+
* again only when they or the roots opened change, so a tap's row keeps its
|
|
2081
|
+
* place. A tap on a root opens its resources under it and lights its card.
|
|
2082
|
+
*/
|
|
2083
|
+
// Its state lives on `s`, made on first use: drawWatch may run before this part of startKiosk has. Each frame's last
|
|
2084
|
+
// marks are kept by its window, since the next frame posts its own while it loads out of sight, before it swaps in.
|
|
2085
|
+
function waveState() {
|
|
2086
|
+
return s.wl || (s.wl = { by: new WeakMap(), open: new Set(), drawn: null });
|
|
2087
|
+
}
|
|
2088
|
+
if (watch && watch.waves && typeof window !== "undefined" && window.addEventListener) {
|
|
2089
|
+
window.addEventListener("message", (e) => {
|
|
2090
|
+
if (e.origin !== origin || !e.source || !e.data || e.data.type !== "behold:marks") return;
|
|
2091
|
+
waveState().by.set(e.source, e.data.list && Array.isArray(e.data.list.waves) ? e.data.list : null);
|
|
2092
|
+
drawWaves();
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
function drawWaves() {
|
|
2096
|
+
if (!watch || !watch.waves) return;
|
|
2097
|
+
const wl = waveState();
|
|
2098
|
+
s.waveList = (frame && frame.contentWindow && wl.by.get(frame.contentWindow)) || null;
|
|
2099
|
+
const key = `${waveListKey(s.waveList)}|${[...wl.open].join(",")}|${s.light}`;
|
|
2100
|
+
if (key === wl.drawn) return;
|
|
2101
|
+
wl.drawn = key;
|
|
2102
|
+
drawWaveList(watch.waves, s.waveList, {
|
|
2103
|
+
open: wl.open,
|
|
2104
|
+
paint: (_doc, root) => elRoots("span", null, root, s),
|
|
2105
|
+
onToggle: (root) => {
|
|
2106
|
+
if (wl.open.has(root)) wl.open.delete(root);
|
|
2107
|
+
else wl.open.add(root);
|
|
2108
|
+
drawWaves();
|
|
2109
|
+
},
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
1967
2112
|
/**
|
|
1968
2113
|
* behold#571: the active wave's job's trace waterfall (web/kiosk-trace.js),
|
|
1969
2114
|
* in the drawer's mount point: the job that applies the wave, in the run
|
|
@@ -2202,7 +2347,14 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2202
2347
|
const v = view === "trace" && tr ? "trace" : "log";
|
|
2203
2348
|
const w = (s.waves || []).find((x) => x.wave === n);
|
|
2204
2349
|
if (!s.watchMode) {
|
|
2205
|
-
if (runsApi
|
|
2350
|
+
if (!runsApi || !runsApi.showJob || !(tr || w)) return;
|
|
2351
|
+
// behold#775: on a phone the runs fold under "Runs and logs": it opens, and the job's trace comes into view.
|
|
2352
|
+
if (tools && tools.runsToggle) setRunsOpen(true);
|
|
2353
|
+
runsApi.showJob(tr && v === "trace" ? tr.run : runsApi.run && runsApi.run.doc ? runsApi.run.doc.id : null, tr && v === "trace" ? tr.job : w.job, v === "trace" ? "trace" : "steps");
|
|
2354
|
+
if (isPhone() && main && main.querySelector) setTimeout(() => {
|
|
2355
|
+
const at = main.querySelector(".t-tabs") || main.querySelector(".r-steps");
|
|
2356
|
+
if (at && at.scrollIntoView) at.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
2357
|
+
}, 400);
|
|
2206
2358
|
return;
|
|
2207
2359
|
}
|
|
2208
2360
|
drawerWave = n;
|
|
@@ -2493,14 +2645,18 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2493
2645
|
|
|
2494
2646
|
// behold#571: "What is this?" opens what behold is over the page (no layout moves); a click elsewhere or Escape closes it.
|
|
2495
2647
|
const whatText = () => {
|
|
2496
|
-
if (!tools || !tools.pop
|
|
2648
|
+
if (!tools || !tools.pop) return;
|
|
2649
|
+
// behold#777: written again once the repo turns out to be terragucci's, so it names what the intro line names.
|
|
2650
|
+
const words = whatTextFor({ chant: !!(s.chantLoop || s.source === "chant-demo"), tg: !!s.tgRepo });
|
|
2651
|
+
if (tools.pop.firstElementChild && tools.pop.dataset.words === words) return;
|
|
2652
|
+
tools.pop.dataset.words = words;
|
|
2497
2653
|
const docs = el("a", null, WHAT_DOCS.text);
|
|
2498
2654
|
docs.href = WHAT_DOCS.url;
|
|
2499
2655
|
docs.target = "_blank";
|
|
2500
2656
|
docs.rel = "noopener";
|
|
2501
2657
|
const more = el("p", "k-what-more");
|
|
2502
2658
|
more.append(docs);
|
|
2503
|
-
tools.pop.replaceChildren(el("p", null,
|
|
2659
|
+
tools.pop.replaceChildren(el("p", null, words), more);
|
|
2504
2660
|
};
|
|
2505
2661
|
if (tools && tools.what && tools.pop) {
|
|
2506
2662
|
const setWhat = (open) => {
|
package/web/kiosk.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { stepTone, nextProgress, nextSeen,
|
|
2
|
+
import { FOLLOW_WORDS, RESUME_WORDS, TAP_HOLD_MS, heldWords, touchScreen, stepTone, nextProgress, nextSeen,BEAT_CHANGES, INTRO_HEAD, READ_STORE, READ_TITLE, STEP_VIEW, STEP_WORDS, aboutRows, approvalPanel, approveGloss, chantProject, factsLine, focusRoots, holdHead, holdModel, introText, readStored, readingRows, renderReading, scenarioHead, frameSrc, factLines, kioskView, matchingPull, pendingApproval, renderKiosk, renderViewToggle, reportless, runPanel, runPin, stepView, viewZoom } from "./kiosk.js";
|
|
3
3
|
import { VENDORS } from "./kiosk-vendor.js";
|
|
4
4
|
import { PICK_HOLD_MS } from "./kiosk-runs.js";
|
|
5
5
|
|
|
@@ -142,6 +142,30 @@ describe("the scenario's card under the title (behold#571)", () => {
|
|
|
142
142
|
};
|
|
143
143
|
const find = (n, cls) => (n.className.split(" ").includes(cls) ? [n] : []).concat(...(n.children || []).map((c) => (c.className !== undefined ? find(c, cls) : [])));
|
|
144
144
|
|
|
145
|
+
// behold#801: Inspect's header shows each finished wave's trace in its right box, as Watch's result card does.
|
|
146
|
+
it("lists each finished wave's trace in the right box, and nothing there before one lands", () => {
|
|
147
|
+
const was = globalThis.document;
|
|
148
|
+
// The trace rows set their bars' style and listen for a click.
|
|
149
|
+
const base = fakeDocument();
|
|
150
|
+
globalThis.document = { createElement: (tag) => Object.assign(base.createElement(tag), { style: {}, addEventListener() {} }) };
|
|
151
|
+
try {
|
|
152
|
+
const T = 1_792_166_000_000;
|
|
153
|
+
const spans = [{ id: "s", parent: null, name: "tf-apply", start: T, ms: 4000, attrs: {} }, { id: "a", parent: "s", name: "apply", start: T, ms: 4000, attrs: { "terragucci.phase": "apply" } }];
|
|
154
|
+
const s = { demo: { source: "fx", read: "2026-10-15T03:00:00Z", demo: demo("applying", { scenario: "failure", about }) }, answer: null, progress: null, waveTraces: {} };
|
|
155
|
+
let bar = document.createElement("header");
|
|
156
|
+
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
157
|
+
expect(find(bar, "k-i-traces")).toEqual([]);
|
|
158
|
+
s.waveTraces = { 1: { run: "8047", job: "apply-wave-1", trace: { start: T, ms: 4000, spans } } };
|
|
159
|
+
bar = document.createElement("header");
|
|
160
|
+
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
161
|
+
const box = find(find(bar, "k-right")[0], "k-i-traces");
|
|
162
|
+
expect(box.length).toBe(1);
|
|
163
|
+
expect(find(box[0], "k-wf-row").map((r) => r.children[0].textContent)).toEqual(["Wave 1"]);
|
|
164
|
+
} finally {
|
|
165
|
+
globalThis.document = was;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
145
169
|
it("draws the card right under the title, and none without about", () => {
|
|
146
170
|
const was = globalThis.document;
|
|
147
171
|
globalThis.document = fakeDocument();
|
|
@@ -155,7 +179,8 @@ describe("the scenario's card under the title (behold#571)", () => {
|
|
|
155
179
|
expect(left.children.map((c) => c.className)).toEqual([
|
|
156
180
|
"k-box k-box-title", "k-row k-row-beat", "k-row k-row-step k-step-failed", "k-row k-row-next", "k-row k-row-more", "k-row k-row-more", "k-row k-row-facts k-row-empty",
|
|
157
181
|
]);
|
|
158
|
-
|
|
182
|
+
// behold#777: under the title, the phone's line on what this is (CSS shows it on a phone only).
|
|
183
|
+
expect(left.children.map((c) => c.children.map((x) => x.className.split(" ")[0]))).toEqual([["k-overline", "k-title", "k-w-intro"],["k-row-label", "k-box"], ["k-row-label", "k-box"], ["k-row-label", "k-box", "k-nbar"], ["k-row-label", "k-box"], ["k-row-label", "k-box"], []]);
|
|
159
184
|
// The next row's bar is placed by CSS, in the step's tone; a stalled driver's next has none.
|
|
160
185
|
const nbar = find(bar, "k-nbar")[0];
|
|
161
186
|
expect(nbar.className).toBe("k-nbar k-nbar-none");
|
|
@@ -383,6 +408,9 @@ describe("which view the frame shows (#571)", () => {
|
|
|
383
408
|
|
|
384
409
|
renderViewToggle(host, { view: "resources", pinned: true, secs: 42 }, { components: true });
|
|
385
410
|
expect(host.children[1].textContent).toBe("each resource the change touches · held by a click; the step leads again in 42 s");
|
|
411
|
+
// behold#779: on a touch screen it was a tap.
|
|
412
|
+
renderViewToggle(host, { view: "resources", pinned: true, secs: 42 }, { components: true, touch: true });
|
|
413
|
+
expect(host.children[1].textContent).toBe("each resource the change touches · held by a tap; the step leads again in 42 s");
|
|
386
414
|
|
|
387
415
|
renderViewToggle(host, { view: "resources", pinned: false, secs: null }, { components: false });
|
|
388
416
|
expect(host.hidden).toBe(true);
|
|
@@ -559,3 +587,85 @@ describe("nextProgress and nextSeen", () => {
|
|
|
559
587
|
expect(nextSeen(nextSeen(undefined, null, "live", 0), a, "live", 6000).seen).toBe(6000);
|
|
560
588
|
});
|
|
561
589
|
});
|
|
590
|
+
|
|
591
|
+
describe("kiosk: a phone's trace rows under the step (behold#775)", () => {
|
|
592
|
+
const fakeDocument = () => {
|
|
593
|
+
const make = (tag) => {
|
|
594
|
+
const n = { tagName: tag, className: "", textContent: "", children: [], dataset: {}, style: {}, hidden: false, on: {} };
|
|
595
|
+
n.appendChild = (c) => (n.children.push(c), c);
|
|
596
|
+
n.append = (...cs) => cs.forEach((c) => n.children.push(typeof c === "string" ? { tagName: "#text", textContent: c, children: [] } : c));
|
|
597
|
+
n.replaceChildren = () => (n.children = []);
|
|
598
|
+
n.addEventListener = (k, f) => (n.on[k] = f);
|
|
599
|
+
return n;
|
|
600
|
+
};
|
|
601
|
+
return { createElement: make };
|
|
602
|
+
};
|
|
603
|
+
const find = (n, cls) => (n.className.split(" ").includes(cls) ? [n] : []).concat(...(n.children || []).map((c) => (c.className !== undefined ? find(c, cls) : [])));
|
|
604
|
+
const T = 1_792_166_000_000;
|
|
605
|
+
const trace = (wave, ms) => ({
|
|
606
|
+
start: T + wave * 10_000,
|
|
607
|
+
ms,
|
|
608
|
+
spans: [
|
|
609
|
+
{ id: "s", parent: null, name: "tf-apply", start: T, ms, attrs: {} },
|
|
610
|
+
{ id: "p", parent: "s", name: "plan", start: T, ms: ms / 2, attrs: { "terragucci.phase": "plan" } },
|
|
611
|
+
{ id: "a", parent: "s", name: "apply", start: T + ms / 2, ms: ms / 2, attrs: { "terragucci.phase": "apply" } },
|
|
612
|
+
],
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
it("draws a row per wave with a trace as each lands, opens that wave's trace on a tap, and none once the result card has them", async () => {
|
|
616
|
+
const { drawWaveTraces, WAVE_TRACES_WORDS, TRACE_LINK_WORDS } = await import("./kiosk.js");
|
|
617
|
+
const was = globalThis.document;
|
|
618
|
+
globalThis.document = fakeDocument();
|
|
619
|
+
try {
|
|
620
|
+
const host = document.createElement("section");
|
|
621
|
+
const opened = [];
|
|
622
|
+
const s = { waveTraces: {}, openWave: (n, view) => opened.push([n, view]) };
|
|
623
|
+
drawWaveTraces(host, s);
|
|
624
|
+
expect(host.hidden).toBe(true);
|
|
625
|
+
expect(host.children).toEqual([]);
|
|
626
|
+
// Wave 1 finished: its row shows at once, before the run is done.
|
|
627
|
+
s.waveTraces = { 1: { run: "8047", job: "apply-wave-1", trace: trace(1, 2000) } };
|
|
628
|
+
drawWaveTraces(host, s);
|
|
629
|
+
expect(host.hidden).toBe(false);
|
|
630
|
+
expect(host.children[0].textContent).toBe(WAVE_TRACES_WORDS);
|
|
631
|
+
let rows = find(host, "k-wf-row");
|
|
632
|
+
expect(rows.map((r) => r.children[0].textContent)).toEqual(["Wave 1"]);
|
|
633
|
+
expect(rows[0].children[3].textContent).toBe(TRACE_LINK_WORDS);
|
|
634
|
+
s.waveTraces[2] = { run: "8047", job: "apply-wave-2", trace: trace(2, 4000) };
|
|
635
|
+
drawWaveTraces(host, s);
|
|
636
|
+
rows = find(host, "k-wf-row");
|
|
637
|
+
expect(rows.map((r) => r.children[0].textContent)).toEqual(["Wave 1", "Wave 2"]);
|
|
638
|
+
rows[1].on.click();
|
|
639
|
+
expect(opened).toEqual([[2, "trace"]]);
|
|
640
|
+
// At the end the result card lists the same rows, so these go.
|
|
641
|
+
drawWaveTraces(host, s, { shown: false });
|
|
642
|
+
expect(host.hidden).toBe(true);
|
|
643
|
+
expect(host.children).toEqual([]);
|
|
644
|
+
} finally {
|
|
645
|
+
globalThis.document = was;
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
// behold#779: on a phone a stray tap on the graph held Watch's shot 90 s, under words about a click.
|
|
651
|
+
describe("a held shot on a touch screen", () => {
|
|
652
|
+
it("says it was a tap, holds a shorter time, and its button says resume", () => {
|
|
653
|
+
expect(heldWords(42)).toBe("Held where you left it · the steps lead again in 42 s");
|
|
654
|
+
expect(heldWords(12, true)).toBe("Paused where you tapped · the steps go on in 12 s");
|
|
655
|
+
expect(TAP_HOLD_MS).toBeLessThan(PICK_HOLD_MS);
|
|
656
|
+
expect([FOLLOW_WORDS, RESUME_WORDS]).toEqual(["Follow the steps", "Resume now"]);
|
|
657
|
+
});
|
|
658
|
+
it("reads a touch screen from a coarse pointer", () => {
|
|
659
|
+
const was = globalThis.matchMedia;
|
|
660
|
+
try {
|
|
661
|
+
globalThis.matchMedia = (q) => ({ matches: q === "(pointer: coarse)" });
|
|
662
|
+
expect(touchScreen()).toBe(true);
|
|
663
|
+
globalThis.matchMedia = () => ({ matches: false });
|
|
664
|
+
expect(touchScreen()).toBe(false);
|
|
665
|
+
delete globalThis.matchMedia;
|
|
666
|
+
expect(touchScreen()).toBe(false);
|
|
667
|
+
} finally {
|
|
668
|
+
globalThis.matchMedia = was;
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
});
|
package/web/small-stage.test.js
CHANGED
|
@@ -106,6 +106,14 @@ describe("nothing overlays the graph in Watch, on a held small stage only", () =
|
|
|
106
106
|
expect(tipsShown({ watch: false, held: true })).toBe(true);
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
+
it("applied: Watch's result card says it, so no modal says it again; Inspect, with no card, opens it (behold#782)", () => {
|
|
110
|
+
expect(modalShownElsewhere({ kind: "applied" }, { watch: true, result: true })).toBe(true);
|
|
111
|
+
// Before the card has the run to draw, the modal opens as before.
|
|
112
|
+
expect(modalShownElsewhere({ kind: "applied" }, { watch: true, result: false })).toBe(false);
|
|
113
|
+
expect(modalShownElsewhere({ kind: "applied" }, { watch: false, result: true })).toBe(false);
|
|
114
|
+
for (const kind of ["held", "failed", "refused"]) expect(modalShownElsewhere({ kind }, { watch: true, result: true })).toBe(false);
|
|
115
|
+
});
|
|
116
|
+
|
|
109
117
|
it("held: says what the cards said in one quiet line of the caption; not held, no such line", () => {
|
|
110
118
|
const result = { head: "Applied", line: "Done in 2 waves.", counts: ["2 waves applied", "1 updated", "3.2 s of job time"], waves: [] };
|
|
111
119
|
expect(stepLine(demo("applied"), { result, held: true })).toBe("2 waves applied · 1 updated · 3.2 s of job time");
|
package/web/terragucci-change.js
CHANGED
|
@@ -457,6 +457,18 @@ export const BLOCKED_TONE = "wait";
|
|
|
457
457
|
|
|
458
458
|
const sameCommit = (a, b) => !!a && !!b && (a.startsWith(b) || b.startsWith(a));
|
|
459
459
|
|
|
460
|
+
/**
|
|
461
|
+
* behold#770: the wave results (/api/terragucci's `results`, behold#751) of
|
|
462
|
+
* one commit, each wave by its newest report. None without a commit, or when
|
|
463
|
+
* the read kept none of it (older than its newest tf-apply commits).
|
|
464
|
+
*/
|
|
465
|
+
function commitResults(answer, commit) {
|
|
466
|
+
const all = answer && !answer.error && answer.results && typeof answer.results === "object" ? answer.results : null;
|
|
467
|
+
if (!all || typeof commit !== "string" || !commit) return [];
|
|
468
|
+
const key = Object.keys(all).find((c) => sameCommit(c, commit));
|
|
469
|
+
return key && Array.isArray(all[key]) ? all[key].filter((r) => r && Number.isInteger(r.wave)) : [];
|
|
470
|
+
}
|
|
471
|
+
|
|
460
472
|
/**
|
|
461
473
|
* behold#741 (terragucci#1161): the roots the run view's run blocked, each
|
|
462
474
|
* with its wave and the root whose failure held it (`by`), from the wave
|
|
@@ -474,6 +486,13 @@ export function blockedOf(answer, progress) {
|
|
|
474
486
|
const notStarted = new Set((progress && Array.isArray(progress.states) ? progress.states : []).filter((w) => w.state === "not-started").map((w) => w.number));
|
|
475
487
|
if (b && (!run || !run.commit || sameCommit(b.commit, run.commit))) {
|
|
476
488
|
for (const [root, x] of Object.entries(b.roots)) if (x && typeof x.by === "string" && x.by && !(Number.isInteger(x.wave) && notStarted.has(x.wave))) out.set(root, { wave: Number.isInteger(x.wave) ? x.wave : null, by: x.by });
|
|
489
|
+
} else {
|
|
490
|
+
// behold#770: `blocked` is the newest apply's alone. A run view of an older commit (a tool page's replay, pinned to
|
|
491
|
+
// its cycle's change after the fix applied) takes its blocked roots from that commit's own wave reports (`results`).
|
|
492
|
+
for (const r of commitResults(answer, run && run.commit)) {
|
|
493
|
+
if (notStarted.has(r.wave)) continue;
|
|
494
|
+
for (const x of Array.isArray(r.blocked) ? r.blocked : []) if (x && typeof x.root === "string" && typeof x.by === "string" && x.by && !out.has(x.root)) out.set(x.root, { wave: r.wave, by: x.by });
|
|
495
|
+
}
|
|
477
496
|
}
|
|
478
497
|
for (const w of progress && Array.isArray(progress.states) ? progress.states : []) {
|
|
479
498
|
if (w.state !== "blocked") continue;
|
|
@@ -492,8 +511,20 @@ export function outcomesOf(answer, progress) {
|
|
|
492
511
|
const out = new Map();
|
|
493
512
|
const run = progress && !progress.error && progress.run && progress.run.present ? progress.run : null;
|
|
494
513
|
const o = answer && !answer.error && answer.outcomes && answer.outcomes.roots && typeof answer.outcomes.roots === "object" ? answer.outcomes : null;
|
|
495
|
-
if (!o || (run && run.commit && !sameCommit(o.commit, run.commit))) return out;
|
|
496
514
|
const notStarted = new Set((progress && Array.isArray(progress.states) ? progress.states : []).filter((w) => w.state === "not-started").map((w) => w.number));
|
|
515
|
+
if (!o || (run && run.commit && !sameCommit(o.commit, run.commit))) {
|
|
516
|
+
// behold#770: `outcomes` is the newest apply's alone. A run view of an older commit (a tool page's replay of its
|
|
517
|
+
// cycle's failure, after the fix applied) reads that commit's own wave reports (`results`, behold#751), not its
|
|
518
|
+
// wave's state: cluster-b applied beside a failed cluster-a in the replay too, as it did live.
|
|
519
|
+
for (const r of commitResults(answer, run && run.commit)) {
|
|
520
|
+
if (notStarted.has(r.wave)) continue;
|
|
521
|
+
const put = (root, outcome, error) => !out.has(root) && out.set(root, { wave: r.wave, outcome, ...(typeof error === "string" && error ? { error } : {}) });
|
|
522
|
+
for (const root of Array.isArray(r.applied) ? r.applied : []) if (typeof root === "string") put(root, "applied");
|
|
523
|
+
for (const root of Array.isArray(r.unchanged) ? r.unchanged : []) if (typeof root === "string") put(root, "unchanged");
|
|
524
|
+
for (const f of Array.isArray(r.failed) ? r.failed : []) if (f && typeof f.root === "string") put(f.root, "failed", f.error);
|
|
525
|
+
}
|
|
526
|
+
return out;
|
|
527
|
+
}
|
|
497
528
|
for (const [root, x] of Object.entries(o.roots)) {
|
|
498
529
|
if (!x || !["applied", "unchanged", "failed"].includes(x.outcome)) continue;
|
|
499
530
|
if (Number.isInteger(x.wave) && notStarted.has(x.wave)) continue;
|