@intentius/behold 0.29.46 → 0.29.47
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.47",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",
|
package/web/kiosk.html
CHANGED
|
@@ -426,6 +426,8 @@
|
|
|
426
426
|
#runs-main { order: 4; display: none; height: 85vh; border-radius: 0; }
|
|
427
427
|
body.k-runs-open #runs-side, body.k-runs-open #runs-main { display: flex; flex-direction: column; }
|
|
428
428
|
body.k-runs-open #runs-side { display: block; }
|
|
429
|
+
/* behold#771: in Watch the pane is the drawer's log, open with the drawer and not with the runs toggle. */
|
|
430
|
+
#k-drawer .k-drawer-body #runs-main { display: flex; height: auto; }
|
|
429
431
|
.r-log { margin-left: var(--s2); max-height: 60vh; }
|
|
430
432
|
.r-log-line { grid-template-columns: 2.4em 1fr; gap: var(--s2); }
|
|
431
433
|
.r-ann-note { grid-column: 1 / -1; }
|
|
@@ -543,6 +545,8 @@
|
|
|
543
545
|
#k-drawer.k-open .k-drawer-tail { display: none; }
|
|
544
546
|
#k-drawer.k-open .k-drawer-body { display: flex; flex-direction: column; height: min(62vh, 40em); border-top: 1px solid var(--rule); overflow: hidden; border-radius: 0 0 10px 10px; }
|
|
545
547
|
#k-drawer.k-open .k-drawer-body #runs-main { flex: 1; border-radius: 0; }
|
|
548
|
+
/* behold#771: the drawer is the job's log: the drawer's head names the job, so the run's head, its jobs and its features stay in Inspect. */
|
|
549
|
+
#k-drawer .k-drawer-body #runs-main > :not(.r-steps) { display: none; }
|
|
546
550
|
/* behold#571: where the job's trace waterfall mounts (OpenTelemetry traces), once that pane is built. Empty, it takes no room. */
|
|
547
551
|
#k-traces:empty { display: none; }
|
|
548
552
|
#k-traces { border-top: 1px solid var(--rule); max-height: 30vh; overflow: auto; }
|
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;
|
|
@@ -15,7 +15,7 @@ import { readTerragucci } from "../src/terragucci-reports.ts";
|
|
|
15
15
|
import { terragucciSource } from "../src/terragucci-source.ts";
|
|
16
16
|
import { cycleFacts, ehSnapshot, storyTrail } from "./kiosk-event-help.js";
|
|
17
17
|
import { componentMarks, reportStatus } from "./terragucci-components-live.js";
|
|
18
|
-
import { resultWords, waveResultOf } from "./terragucci-change.js";
|
|
18
|
+
import { blockedOf, outcomesOf, resultWords, rootStates, waveResultOf } from "./terragucci-change.js";
|
|
19
19
|
|
|
20
20
|
const FIXTURE = join(import.meta.dirname, "..", "src", "__fixtures__", "terragucci-wave-results");
|
|
21
21
|
const CHANGE = "2a615596a4f0ed954bdcaa83f77e575eaf2cb5ab";
|
|
@@ -39,10 +39,12 @@ const changeView = runView(CHANGE, "2026-10-19T01:58:52.600Z", [[1, "applied", [
|
|
|
39
39
|
const fixView = runView(FIX, "2026-10-19T02:01:47.800Z", [[1, "applied", ["network"]], [2, "applied", ["cluster-a", "cluster-b"]], [3, "applied", [...APPS_A, ...APPS_B]]]);
|
|
40
40
|
|
|
41
41
|
let answer;
|
|
42
|
+
let read;
|
|
42
43
|
beforeAll(async () => {
|
|
43
44
|
const structural = { validation: { by: "structural" }, check: (_n, doc) => (doc && typeof doc === "object" ? undefined : "not an object") };
|
|
44
45
|
const r = await readTerragucci(terragucciSource(FIXTURE), { validator: structural });
|
|
45
46
|
answer = { roots: [], pull_request: null, results: r.results };
|
|
47
|
+
read = r;
|
|
46
48
|
});
|
|
47
49
|
|
|
48
50
|
const facts = (snap) => cycleFacts(ehSnapshot({ waves, ...snap }));
|
|
@@ -123,3 +125,56 @@ describe("the wave box's title (behold#751)", () => {
|
|
|
123
125
|
expect(reportStatus(failed, null)).toBe(failed);
|
|
124
126
|
});
|
|
125
127
|
});
|
|
128
|
+
|
|
129
|
+
// behold#770: a tool page's replay of the cycle (kiosk-vendor.js) pins the
|
|
130
|
+
// change's run view (wave 2 failed) after the fix applied, so /api/terragucci's
|
|
131
|
+
// `outcomes` and `blocked` are the fix's, the newest apply's. The replay read
|
|
132
|
+
// cluster-b "failed" and wave 2 "2 failed" from the wave's state, where live it
|
|
133
|
+
// read cluster-b applied beside a failed cluster-a. The change's own reports,
|
|
134
|
+
// in `results`, say how each root came out.
|
|
135
|
+
describe("the replay of the failure, after the fix applied (behold#770)", () => {
|
|
136
|
+
const facets = {
|
|
137
|
+
jobs: [
|
|
138
|
+
{ component: "network", jobName: "apply-wave-1", wave: 1 },
|
|
139
|
+
{ component: "cluster-a", jobName: "apply-wave-2", wave: 2 },
|
|
140
|
+
{ component: "cluster-b", jobName: "apply-wave-2", wave: 2 },
|
|
141
|
+
...[...APPS_A, ...APPS_B].map((c) => ({ component: c, jobName: "apply-wave-3", wave: 3 })),
|
|
142
|
+
],
|
|
143
|
+
};
|
|
144
|
+
// /api/terragucci as it answers after the fix's apply: its outcomes are the fix's, and nothing of it is blocked.
|
|
145
|
+
const replayAnswer = () => ({ roots: [], pull_request: null, ...(read.outcomes ? { outcomes: read.outcomes } : {}), ...(read.blocked ? { blocked: read.blocked } : {}), results: read.results });
|
|
146
|
+
const runs = { doc: { runs: [{ id: 6745, commit: CHANGE, jobs: run6745.jobs.map(({ name, status }) => ({ name, status })) }] } };
|
|
147
|
+
|
|
148
|
+
it("is the fixture's case: the read's outcomes are the fix's, not the change's", () => {
|
|
149
|
+
expect(read.outcomes.commit).toBe(FIX);
|
|
150
|
+
expect(read.blocked).toBeUndefined();
|
|
151
|
+
expect(Object.keys(read.results)).toEqual(expect.arrayContaining([CHANGE, FIX]));
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it("reads each root of the change's run from the change's own reports", () => {
|
|
155
|
+
const o = outcomesOf(replayAnswer(), changeView);
|
|
156
|
+
expect(o.get("cluster-a")).toMatchObject({ wave: 2, outcome: "failed" });
|
|
157
|
+
expect(o.get("cluster-a").error).toMatch(/QueueAlreadyExists/);
|
|
158
|
+
expect(o.get("cluster-b")).toEqual({ wave: 2, outcome: "applied" });
|
|
159
|
+
expect([...blockedOf(replayAnswer(), changeView).keys()].sort()).toEqual(APPS_A);
|
|
160
|
+
expect(blockedOf(replayAnswer(), changeView).get("app-01")).toEqual({ wave: 3, by: "cluster-a" });
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("draws cluster-a failed, cluster-b applied, cluster-a's apps blocked and cluster-b's applied", () => {
|
|
164
|
+
const m = componentMarks(replayAnswer(), changeView, facets, { runs, story: { kiosk: true } });
|
|
165
|
+
expect(m.cards["cluster-a"]).toMatchObject({ state: "failed", tone: "bad" });
|
|
166
|
+
expect(m.cards["cluster-b"]).toMatchObject({ state: "applied", tone: "ok", words: "applied" });
|
|
167
|
+
for (const a of APPS_A) expect(m.cards[a]).toMatchObject({ state: "blocked", blockedBy: "cluster-a" });
|
|
168
|
+
for (const a of APPS_B) expect(m.cards[a]).toMatchObject({ state: "applied" });
|
|
169
|
+
expect(m.waves[2].status).toMatchObject({ status: "failed", words: "1 failed, 1 applied", tone: "bad" });
|
|
170
|
+
expect(m.waves[3].title).toBe("apply-wave-3 · 6 applied, 6 blocked by cluster-a");
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it("holds a wave the paced replay hasn't started, and falls back to the wave's state for a commit the read kept no result of", () => {
|
|
174
|
+
const paced = { ...changeView, states: changeView.states.map((w) => (w.number === 3 ? { ...w, state: "not-started" } : w)) };
|
|
175
|
+
expect(blockedOf(replayAnswer(), paced).size).toBe(0);
|
|
176
|
+
expect(outcomesOf(replayAnswer(), paced).has("app-07")).toBe(false);
|
|
177
|
+
const gone = { ...replayAnswer(), results: { [FIX]: read.results[FIX] } };
|
|
178
|
+
expect(rootStates(gone, changeView, { story: true }).roots["cluster-b"].state).toBe("failed");
|
|
179
|
+
});
|
|
180
|
+
});
|