@intentius/behold 0.29.45 → 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/web/kiosk.html CHANGED
@@ -353,6 +353,8 @@
353
353
  .k-what { font: 600 0.92em var(--font-ui); color: var(--pending); background: transparent; border: 0; padding: 0.1em 0.2em; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
354
354
  #k-what-pop { position: absolute; top: 1.8em; right: 0; width: min(34em, calc(100vw - 32px)); padding: var(--s3) var(--s4); background: var(--surface-pane-b); color: var(--fg); border: 1px solid var(--focus);
355
355
  border-radius: 8px; box-shadow: 0 6px 24px color-mix(in srgb, var(--shadow) 70%, transparent); font-size: 1.15em; line-height: 1.45; }
356
+ /* behold#764: never past the window's bottom on a short screen: it scrolls. */
357
+ #k-what-pop { max-height: calc(100vh - 4em); overflow-y: auto; overscroll-behavior: contain; }
356
358
  #k-what-pop[hidden] { display: none; }
357
359
  #k-what-pop p { margin: 0; }
358
360
  #k-what-pop .k-what-more { margin-top: var(--s2); }
@@ -424,6 +426,8 @@
424
426
  #runs-main { order: 4; display: none; height: 85vh; border-radius: 0; }
425
427
  body.k-runs-open #runs-side, body.k-runs-open #runs-main { display: flex; flex-direction: column; }
426
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; }
427
431
  .r-log { margin-left: var(--s2); max-height: 60vh; }
428
432
  .r-log-line { grid-template-columns: 2.4em 1fr; gap: var(--s2); }
429
433
  .r-ann-note { grid-column: 1 / -1; }
@@ -518,7 +522,13 @@
518
522
  .k-notch { position: absolute; width: 14px; height: 14px; background: inherit; border: inherit; transform: rotate(45deg); top: 1.4em; }
519
523
  .k-side-right > .k-notch { left: -9px; border-top: 0; border-right: 0; }
520
524
  .k-side-left > .k-notch { right: -9px; border-bottom: 0; border-left: 0; }
521
- .k-side-below > .k-notch { display: none; }
525
+ .k-side-below > .k-notch, .k-side-above > .k-notch { display: none; }
526
+ /* behold#764: an overlay taller than the graph's view is capped (placeBeside's maxHeight, .k-capped): the callout and
527
+ the result scroll (their notch goes: a scroller clips it), the drawer's log shrinks to fit and scrolls. */
528
+ .k-over.k-capped { overflow-y: auto; overscroll-behavior: contain; }
529
+ .k-over.k-capped > .k-notch { display: none; }
530
+ #k-drawer.k-capped { overflow: hidden; }
531
+ #k-drawer.k-open .k-drawer-body { flex: 1 1 auto; }
522
532
  /* The running job's log, a drawer from the active wave's box: folded to its last lines, open on a hover or a click. */
523
533
  #k-drawer { width: min(34em, 46vw); background: var(--surface-pane-a); border: 2px solid color-mix(in srgb, var(--pending) 80%, var(--fg)); border-radius: 10px; box-shadow: 0 10px 34px color-mix(in srgb, var(--shadow) 75%, transparent); display: flex; flex-direction: column; }
524
534
  .k-drawer-head { display: flex; align-items: center; gap: var(--s3); width: 100%; padding: var(--s3) var(--s4) var(--s1); background: transparent; border: 0; color: var(--fg); cursor: pointer; text-align: left; font: inherit; }
@@ -535,6 +545,8 @@
535
545
  #k-drawer.k-open .k-drawer-tail { display: none; }
536
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; }
537
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; }
538
550
  /* behold#571: where the job's trace waterfall mounts (OpenTelemetry traces), once that pane is built. Empty, it takes no room. */
539
551
  #k-traces:empty { display: none; }
540
552
  #k-traces { border-top: 1px solid var(--rule); max-height: 30vh; overflow: auto; }
package/web/kiosk.js CHANGED
@@ -2013,6 +2013,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2013
2013
  const carvingNow = shownCaption() !== watch.caption || !!s.stageHeld;
2014
2014
  const put = (node, n) => {
2015
2015
  if (node.hidden) return;
2016
+ // behold#764: measured at its own height, then capped to the view (placeBeside's maxHeight); its body scrolls.
2017
+ node.style.maxHeight = "";
2016
2018
  const size = { w: node.offsetWidth, h: node.offsetHeight };
2017
2019
  const box = carvingNow ? null : boxOf(n);
2018
2020
  // Before the frame says where the box is: the right of the view, under its top.
@@ -2021,13 +2023,16 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2021
2023
  const labels = [...((s.boxes && s.boxes.labels) || []).map((r) => ({ x: r.x + view.x, y: r.y + view.y, w: r.w, h: r.h })), chrome];
2022
2024
  const p = box ? placeBeside(box, size, view, 18, labels) : { x: view.x + view.w - size.w - 20, y: view.y + FRAME_CONTROLS.h + 8, side: "below" };
2023
2025
  // The result card stands level with the middle of the graph it sums up.
2024
- if (box && node === watch.result) p.y = Math.max(view.y + 8, Math.min(box.y + box.h / 2 - size.h / 2, view.y + view.h - size.h - 8));
2026
+ const h = p.maxHeight || size.h;
2027
+ node.style.maxHeight = p.maxHeight ? `${Math.floor(p.maxHeight)}px` : "";
2028
+ node.classList.toggle("k-capped", !!p.maxHeight);
2029
+ if (box && node === watch.result) p.y = Math.max(view.y + 8, Math.min(box.y + box.h / 2 - h / 2, view.y + view.h - h - 8));
2025
2030
  node.style.transform = `translate(${Math.round(p.x)}px, ${Math.round(p.y)}px)`;
2026
- for (const k of ["right", "left", "below"]) node.classList.toggle(`k-side-${k}`, p.side === k);
2031
+ for (const k of ["right", "left", "below", "above"]) node.classList.toggle(`k-side-${k}`, p.side === k);
2027
2032
  node.classList.add("k-placed");
2028
2033
  const notch = node.querySelector(":scope > .k-notch");
2029
- if (notch && box) notch.style.top = `${Math.round(Math.max(12, Math.min(size.h - 26, box.y + 22 - p.y)))}px`;
2030
- taken.push({ x: p.x, y: p.y, x2: p.x + size.w, y2: p.y + size.h });
2034
+ if (notch && box) notch.style.top = `${Math.round(Math.max(12, Math.min(h - 26, box.y + 22 - p.y)))}px`;
2035
+ taken.push({ x: p.x, y: p.y, x2: p.x + size.w, y2: p.y + h });
2031
2036
  };
2032
2037
  put(watch.callout, s.held);
2033
2038
  put(watch.drawer, drawerWave !== null ? drawerWave : s.shot && s.shot.waves[0]);
@@ -2056,6 +2061,13 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2056
2061
  window.addEventListener("message", (e) => {
2057
2062
  if (e.origin !== origin || !frame || e.source !== frame.contentWindow || !e.data) return;
2058
2063
  if (e.data.type === "behold:viewer") return holdShot();
2064
+ // behold#764: the frame's card details popover opened, moved or closed: a modal yields to it, and one held back opens after.
2065
+ if (e.data.type === "behold:pop") {
2066
+ const a = e.data.at;
2067
+ s.framePop = a && [a.x, a.y, a.w, a.h].every(Number.isFinite) ? { x: a.x, y: a.y, w: a.w, h: a.h } : null;
2068
+ if (ehApi) ehApi.tick();
2069
+ return;
2070
+ }
2059
2071
  if (e.data.type !== "behold:boxes") return;
2060
2072
  s.boxes = e.data;
2061
2073
  // A held small stage: nothing the step shows overlays the graph (watchOverlays), and a drawer the viewer opens
@@ -2113,6 +2125,14 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2113
2125
  ? startEventHelp({
2114
2126
  doc: document,
2115
2127
  store: shelf,
2128
+ // behold#764: the story modals a viewer closes, for this visit only (never localStorage).
2129
+ session: (() => {
2130
+ try {
2131
+ return typeof sessionStorage !== "undefined" ? sessionStorage : null;
2132
+ } catch {
2133
+ return null;
2134
+ }
2135
+ })(),
2116
2136
  switchHost: eh.switchHost,
2117
2137
  trailHost: eh.trailHost,
2118
2138
  tipsHost: eh.tipsHost,
@@ -2152,6 +2172,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2152
2172
  // which the approval card beside the graph wins over.
2153
2173
  hideTrail: !!(storyOn(s) && s.trackOn && s.watchMode),
2154
2174
  waiting: storyOn(s) && s.watchMode && !(watch && watch.callout && !watch.callout.hidden) ? s.waitingNow || null : null,
2175
+ // behold#764: the card's details popover the frame has open (`behold:pop`), which no modal covers.
2176
+ pop: s.framePop || null,
2155
2177
  frame,
2156
2178
  watch: s.watchMode,
2157
2179
  // The caption shown now: the live carve's while it has the camera (web/kiosk-carve.js).
@@ -2560,6 +2582,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
2560
2582
  buffer = null;
2561
2583
  frameDrawn = true;
2562
2584
  s.boxes = null;
2585
+ s.framePop = null; // behold#764: the old frame's details popover went with it
2563
2586
  lastFocus = undefined;
2564
2587
  tellFrame(true);
2565
2588
  tellShot(true);
@@ -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
+ });
package/web/tooltip.js CHANGED
@@ -10,6 +10,8 @@
10
10
  // its words go into the shared tooltip; they go back when the pointer or the
11
11
  // focus leaves. An HTML element can ask for the tooltip with data-tip.
12
12
 
13
+ import { shiftInto } from "./float-place.js";
14
+
13
15
  export const TIP_ID = "b-tip";
14
16
  /** The room between the tooltip and what it describes, and between it and the window's edge, in px. */
15
17
  export const TIP_GAP = 8;
@@ -29,8 +31,9 @@ export function placeTip(target, size, view, { gap = TIP_GAP, margin = TIP_MARGI
29
31
  const side = fitsBelow || above < margin ? "below" : "above";
30
32
  const top = side === "below" ? below : above;
31
33
  const centred = (target.left + target.right) / 2 - size.width / 2;
32
- const left = Math.max(margin, Math.min(centred, view.width - margin - size.width));
33
- return { left: Math.round(left), top: Math.round(Math.max(margin, top)), side };
34
+ // behold#764: inside the window on every side (web/float-place.js), its bottom too when it fits neither way.
35
+ const { dx, dy } = shiftInto({ left: centred, top, width: size.width, height: size.height }, { left: 0, top: 0, width: view.width, height: view.height }, margin);
36
+ return { left: Math.round(centred + dx), top: Math.round(top + dy), side };
34
37
  }
35
38
 
36
39
  /** An id list (aria-describedby) with `id` in it once. */