@intentius/behold 0.30.2 → 0.31.0
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 +444 -15
- package/README.md +14 -13
- package/demos.json +14 -9
- package/dist/cli.js +53928 -26475
- package/example-carve/README.md +19 -23
- package/example-carve/app/package.json +1 -1
- package/example-carve/app/src/carved.ts +3 -3
- package/example-carve/carve-report.json +1 -1
- package/example-carve/{legacy-tf → tf-root}/terraform.tfstate +1 -1
- package/example-choudoufu-estate/README.md +7 -0
- package/example-choudoufu-estate/chant.workspace.json +1 -1
- package/example-choudoufu-estate/scripts/choudoufu-down.sh +2 -1
- package/example-choudoufu-estate/scripts/choudoufu-up.sh +10 -3
- package/example-terraform-estate/README.md +32 -5
- package/example-terraform-estate/chant.workspace.json +1 -1
- package/example-terraform-estate/recorded/adoption/platform.json +72 -0
- package/example-terraform-estate/recorded/adoption/prod.json +224 -0
- package/example-three-cloud/README.md +111 -18
- package/example-three-cloud/aws/Pulumi.yaml +15 -0
- package/example-three-cloud/aws/index.ts +174 -0
- package/example-three-cloud/aws/package-lock.json +2725 -0
- package/example-three-cloud/aws/package.json +14 -0
- package/example-three-cloud/aws/tsconfig.json +17 -0
- package/example-three-cloud/azure/main.tf +48 -0
- package/example-three-cloud/azure/site.tf +104 -0
- package/example-three-cloud/chant.config.json +9 -0
- package/example-three-cloud/chant.workspace.json +30 -4
- package/example-three-cloud/dns/chant.config.ts +26 -1
- package/example-three-cloud/dns/src/records.component.ts +32 -6
- package/example-three-cloud/package-lock.json +48 -27
- package/example-three-cloud/package.json +8 -6
- package/example-three-cloud/scripts/emulators-up.sh +28 -1
- package/example-three-cloud/scripts/front-door.ts +679 -86
- package/package.json +13 -6
- package/web/adopt-pulumi.js +114 -0
- package/web/adopt-pulumi.test.js +28 -0
- package/web/adopt.js +203 -0
- package/web/adopt.test.js +27 -0
- package/web/app.js +358 -10
- package/web/carve-steps.js +1 -1
- package/web/carve-steps.test.js +2 -2
- package/web/change-set-overlay.js +12 -5
- package/web/change-set-overlay.test.js +22 -0
- package/web/drift-stream.js +241 -0
- package/web/drift-stream.test.js +146 -0
- package/web/edge-weight.d.ts +1 -1
- package/web/edge-weight.js +5 -1
- package/web/edge-weight.test.js +19 -0
- package/web/graph-query.js +180 -0
- package/web/graph-query.test.js +49 -0
- package/web/graph.html +107 -0
- package/web/index-diff.js +109 -0
- package/web/index-diff.test.js +39 -0
- package/web/index.html +37 -0
- package/web/kiosk-ask-tips.js +15 -5
- package/web/kiosk-ask-tips.test.js +14 -1
- package/web/kiosk-estate-scene.js +72 -8
- package/web/kiosk-light-frame.js +1 -0
- package/web/kiosk-light.js +41 -3
- package/web/kiosk-member-kind.test.js +140 -0
- package/web/kiosk-popover.js +4 -1
- package/web/kiosk-side.js +296 -0
- package/web/kiosk-side.test.js +249 -0
- package/web/kiosk-watch.js +12 -0
- package/web/kiosk-watch.test.js +15 -1
- package/web/kiosk.html +47 -1
- package/web/kiosk.js +106 -7
- package/web/member-kind.js +31 -0
- package/web/template-apps.js +245 -0
- package/web/template-apps.test.js +252 -0
- package/web/templates.js +285 -0
- package/web/templates.test.js +155 -0
- package/web/terragucci-lifecycle.js +112 -62
- package/web/terragucci-lifecycle.test.js +29 -1
- package/web/terragucci-timeline.js +39 -2
- package/web/terragucci-timeline.test.js +42 -1
- package/example-three-cloud/aws/chant.config.ts +0 -8
- package/example-three-cloud/aws/site.component.ts +0 -13
- package/example-three-cloud/aws/src/site.ts +0 -27
- package/example-three-cloud/azure/chant.config.ts +0 -1
- package/example-three-cloud/azure/src/site.component.ts +0 -13
- package/example-three-cloud/azure/src/site.ts +0 -18
- /package/example-carve/{legacy-tf → tf-root}/cdn.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/compute.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/floci-override.tf.disabled +0 -0
- /package/example-carve/{legacy-tf → tf-root}/modules/cdn/main.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/naming.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/network.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/observability.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/outputs.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/storage.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/versions.tf +0 -0
package/web/graph.html
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>behold · graph</title>
|
|
7
|
+
<style>
|
|
8
|
+
/* behold#1027: the graph pane. Box's tokens (theme.js KIOSK_THEME) as the fallback, as terralith.html does. */
|
|
9
|
+
:root {
|
|
10
|
+
--bg: #141d2b; --panel: #213027; --line: #2e3d2a; --fg: #9fef00; --muted: #7d9e5a; --edge: #40601d;
|
|
11
|
+
--managed: #19cb00; --foreign: #cecb00; --pending: #0d73cc; --degraded: #cc0403; --runtime: #0dcdcd;
|
|
12
|
+
--well: #070f1c; --surface-box: #20242a; --surface-pane-a: #262a30;
|
|
13
|
+
--font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
14
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
15
|
+
}
|
|
16
|
+
@media (prefers-color-scheme: light) {
|
|
17
|
+
:root { --bg: #f6f7f4; --panel: #ffffff; --line: #d5dacb; --fg: #1d2a12; --muted: #5d6b4f; --edge: #8aa06a; --well: #eef1e8; --surface-box: #ffffff; --surface-pane-a: #f0f2ec; }
|
|
18
|
+
}
|
|
19
|
+
* { box-sizing: border-box; }
|
|
20
|
+
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font-ui); }
|
|
21
|
+
main { max-width: 1400px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
|
|
22
|
+
@media (max-width: 900px) { main { grid-template-columns: minmax(0, 1fr); } }
|
|
23
|
+
header { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; }
|
|
24
|
+
h1 { font-size: 18px; margin: 0; }
|
|
25
|
+
section { background: var(--surface-pane-a); border-radius: 8px; padding: 12px 14px; min-width: 0; }
|
|
26
|
+
h2 { font-size: 14px; margin: 0 0 8px; }
|
|
27
|
+
textarea, input { width: 100%; background: var(--well); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: 13px/1.4 var(--font-mono); }
|
|
28
|
+
textarea { min-height: 7em; resize: vertical; }
|
|
29
|
+
button { background: var(--surface-box); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; margin: 6px 6px 0 0; font: inherit; cursor: pointer; }
|
|
30
|
+
button:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
31
|
+
pre { white-space: pre-wrap; font: 12px/1.4 var(--font-mono); margin: 6px 0 0; color: var(--muted); }
|
|
32
|
+
#g-error { color: var(--degraded); }
|
|
33
|
+
.g-muted { color: var(--muted); }
|
|
34
|
+
table { border-collapse: collapse; width: 100%; font: 12px/1.35 var(--font-mono); display: block; overflow-x: auto; }
|
|
35
|
+
th, td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; }
|
|
36
|
+
svg { width: 100%; height: auto; max-height: 560px; }
|
|
37
|
+
.g-edge { stroke: var(--edge); stroke-width: 1.4; }
|
|
38
|
+
.g-edge.derived { stroke-dasharray: 5 4; stroke: var(--foreign); }
|
|
39
|
+
.g-arrowhead { fill: var(--edge); }
|
|
40
|
+
.g-node circle { fill: var(--managed); }
|
|
41
|
+
.g-node.engine circle { fill: var(--runtime); }
|
|
42
|
+
.g-node.index circle, .g-node.cloud circle { fill: var(--pending); }
|
|
43
|
+
.g-node text { fill: var(--fg); font: 11px var(--font-mono); }
|
|
44
|
+
/* behold#1028: the index diff overlay. Not observed is never drawn as removed. */
|
|
45
|
+
.g-node.d-added circle { fill: var(--managed); }
|
|
46
|
+
.g-node.d-removed circle { fill: var(--degraded); }
|
|
47
|
+
.g-node.d-changed circle { fill: var(--foreign); }
|
|
48
|
+
.g-node.d-not-observed circle { fill: none; stroke: var(--muted); stroke-dasharray: 3 2; }
|
|
49
|
+
.g-node.d-same circle { fill: var(--edge); }
|
|
50
|
+
.g-edge.d-added { stroke: var(--managed); }
|
|
51
|
+
.g-edge.d-removed { stroke: var(--degraded); }
|
|
52
|
+
.g-edge.d-not-observed { stroke: var(--muted); stroke-dasharray: 3 3; }
|
|
53
|
+
select { background: var(--well); color: var(--fg); border: 1px solid var(--line); border-radius: 6px; padding: 4px; font: 12px var(--font-mono); max-width: 100%; }
|
|
54
|
+
ul { margin: 6px 0 0; padding-left: 18px; font: 12px/1.4 var(--font-mono); }
|
|
55
|
+
a { color: var(--runtime); }
|
|
56
|
+
</style>
|
|
57
|
+
</head>
|
|
58
|
+
<body>
|
|
59
|
+
<main>
|
|
60
|
+
<header>
|
|
61
|
+
<h1>Graph</h1>
|
|
62
|
+
<span id="g-peer" class="g-muted"></span>
|
|
63
|
+
<span id="g-counts" class="g-muted"></span>
|
|
64
|
+
<a href="/">Back to the estate</a>
|
|
65
|
+
</header>
|
|
66
|
+
<section>
|
|
67
|
+
<h2>Cypher</h2>
|
|
68
|
+
<form id="g-cypher-form">
|
|
69
|
+
<textarea id="g-cypher" spellcheck="false" aria-label="Cypher query">MATCH (a:Resource)-[:KNOWN_AS]->(c:CloudId)<-[:KNOWN_AS]-(b:Resource) WHERE a.scopeKey <> b.scopeKey RETURN a.key, b.key, c.value LIMIT 50</textarea>
|
|
70
|
+
<input id="g-params" placeholder='Parameters as JSON, such as {"k": "aws_s3_bucket"}' aria-label="Parameters" />
|
|
71
|
+
<button type="submit">Ask</button>
|
|
72
|
+
</form>
|
|
73
|
+
<h2 style="margin-top: 14px">Start from a resource</h2>
|
|
74
|
+
<form id="g-resolve-form">
|
|
75
|
+
<input id="g-ref" placeholder="A name, an IR id, a block address or a cloud id" aria-label="Resource" />
|
|
76
|
+
<button type="submit">Resolve</button>
|
|
77
|
+
</form>
|
|
78
|
+
<ul id="g-candidates"></ul>
|
|
79
|
+
<div id="g-templates"></div>
|
|
80
|
+
<pre id="g-error"></pre>
|
|
81
|
+
<h2 style="margin-top: 14px">What changed between two reads</h2>
|
|
82
|
+
<form id="d-form">
|
|
83
|
+
<label>Scope <select id="d-scope" aria-label="Index scope"></select></label>
|
|
84
|
+
<label>From <select id="d-from" aria-label="Earlier version"></select></label>
|
|
85
|
+
<label>To <select id="d-to" aria-label="Later version"></select></label>
|
|
86
|
+
<button type="submit">Diff</button>
|
|
87
|
+
</form>
|
|
88
|
+
<p id="d-hint" class="g-muted"></p>
|
|
89
|
+
<pre id="d-summary"></pre>
|
|
90
|
+
<h2 style="margin-top: 14px">Sources, and when each was read</h2>
|
|
91
|
+
<pre id="g-sources"></pre>
|
|
92
|
+
<pre id="g-notes"></pre>
|
|
93
|
+
</section>
|
|
94
|
+
<section>
|
|
95
|
+
<h2>Answer <a id="g-link" hidden>open in the estate view</a></h2>
|
|
96
|
+
<div id="g-draw"></div>
|
|
97
|
+
<div id="g-rows"></div>
|
|
98
|
+
</section>
|
|
99
|
+
</main>
|
|
100
|
+
<script type="module">
|
|
101
|
+
import { initGraphPane } from "./graph-query.js";
|
|
102
|
+
import { initIndexDiff } from "./index-diff.js";
|
|
103
|
+
initGraphPane();
|
|
104
|
+
initIndexDiff();
|
|
105
|
+
</script>
|
|
106
|
+
</body>
|
|
107
|
+
</html>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* behold#1028: the index diff overlay on the graph pane (web/graph.html).
|
|
3
|
+
*
|
|
4
|
+
* Picks a scope and two of its versions from GET /api/graphdb/index-versions,
|
|
5
|
+
* asks GET /api/graphdb/index-diff, and draws the answer's overlay: added
|
|
6
|
+
* nodes and edges green, removed red, changed amber with the changed paths
|
|
7
|
+
* in the tooltip, and not-observed grey and dashed (an unobserved type is
|
|
8
|
+
* never drawn as removed). Both reads' stamps are shown above the drawing.
|
|
9
|
+
* Every request is a GET.
|
|
10
|
+
*
|
|
11
|
+
* The pure helpers are exported for web/index-diff.test.js.
|
|
12
|
+
*/
|
|
13
|
+
import { circleLayout } from "./graph-query.js";
|
|
14
|
+
|
|
15
|
+
/** The diff route for a scope and two versions; empty arguments are left to the server's defaults. */
|
|
16
|
+
export function diffUrl(scope, from, to) {
|
|
17
|
+
const q = new URLSearchParams();
|
|
18
|
+
if (scope) q.set("scope", scope);
|
|
19
|
+
if (from) q.set("from", from);
|
|
20
|
+
if (to) q.set("to", to);
|
|
21
|
+
const s = q.toString();
|
|
22
|
+
return `/api/graphdb/index-diff${s ? `?${s}` : ""}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The two stamps and the counts, as lines. */
|
|
26
|
+
export function diffSummary(diff) {
|
|
27
|
+
if (!diff) return [];
|
|
28
|
+
const stamp = (s) => `${s.version ?? "?"}: observed ${s.observedAt}${s.completedAt ? ` to ${s.completedAt}` : ""}, digest ${String(s.digest).slice(0, 12)}`;
|
|
29
|
+
const c = diff.counts;
|
|
30
|
+
const lines = [`scope ${diff.scopeKey}`, `from ${stamp(diff.from)}`, `to ${stamp(diff.to)}`];
|
|
31
|
+
if (diff.unchanged) lines.push("unchanged: both reads have the same digest");
|
|
32
|
+
else {
|
|
33
|
+
lines.push(`${c.added} added, ${c.removed} removed, ${c.changed} changed (${c.properties} properties), ${c.notObserved} not observed in one read`);
|
|
34
|
+
lines.push(`edges: ${c.edgesAdded} added, ${c.edgesRemoved} removed, ${c.edgesNotObserved} not observed`);
|
|
35
|
+
}
|
|
36
|
+
for (const n of diff.nodes?.changed ?? []) for (const p of n.properties) lines.push(` ${n.key} ${p.path}: ${JSON.stringify(p.before)} -> ${JSON.stringify(p.after)}`);
|
|
37
|
+
for (const k of diff.coverage ?? []) lines.push(` coverage ${k.listedType} in ${k.location}: ${k.before ?? "absent"} -> ${k.after ?? "absent"}`);
|
|
38
|
+
return lines;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const esc = (s) => String(s).replace(/[&<>"']/g, (ch) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[ch]);
|
|
42
|
+
|
|
43
|
+
/** The overlay as SVG text. Each node and edge carries its change as a class: d-added, d-removed, d-changed, d-not-observed, d-same. */
|
|
44
|
+
export function drawOverlaySvg(draw, size = 520) {
|
|
45
|
+
const nodes = draw?.nodes ?? [];
|
|
46
|
+
if (!nodes.length) return "";
|
|
47
|
+
const at = circleLayout(nodes, size);
|
|
48
|
+
const edges = (draw.edges ?? [])
|
|
49
|
+
.filter((e) => at[e.from] && at[e.to])
|
|
50
|
+
.map((e) => {
|
|
51
|
+
const a = at[e.from];
|
|
52
|
+
const b = at[e.to];
|
|
53
|
+
return `<line class="g-edge d-${esc(e.change)}" x1="${a.x}" y1="${a.y}" x2="${b.x}" y2="${b.y}" marker-end="url(#g-arrow)"><title>${esc(`${e.from} -> ${e.to}${e.viaAttr ? ` via ${e.viaAttr}` : ""}: ${e.change}`)}</title></line>`;
|
|
54
|
+
})
|
|
55
|
+
.join("");
|
|
56
|
+
const dots = nodes
|
|
57
|
+
.map((n) => {
|
|
58
|
+
const p = at[n.key];
|
|
59
|
+
const label = n.name || n.key;
|
|
60
|
+
const title = `${n.key} (${n.kind}): ${n.change}${n.detail ? `, ${n.detail}` : ""}`;
|
|
61
|
+
return `<g class="g-node d-${esc(n.change)}"><circle cx="${p.x}" cy="${p.y}" r="7"><title>${esc(title)}</title></circle><text x="${p.x + 10}" y="${p.y + 4}">${esc(label.length > 32 ? `${label.slice(0, 29)}...` : label)}</text></g>`;
|
|
62
|
+
})
|
|
63
|
+
.join("");
|
|
64
|
+
return `<svg viewBox="0 0 ${size} ${size}" role="img" aria-label="index diff overlay"><defs><marker id="g-arrow" viewBox="0 0 10 10" refX="16" refY="5" markerWidth="6" markerHeight="6" orient="auto"><path d="M0,0 L10,5 L0,10 z" class="g-arrowhead"/></marker></defs>${edges}${dots}</svg>`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* c8 ignore start: the DOM half, driven by the page */
|
|
68
|
+
export function initIndexDiff(doc = document, fetchJson = (u) => fetch(u, { headers: { accept: "application/json" } }).then(async (r) => ({ status: r.status, body: await r.json().catch(() => ({})) }))) {
|
|
69
|
+
const $ = (id) => doc.getElementById(id);
|
|
70
|
+
if (!$("d-form")) return;
|
|
71
|
+
let scopes = [];
|
|
72
|
+
const fill = (sel, items, pick) => {
|
|
73
|
+
sel.innerHTML = "";
|
|
74
|
+
for (const v of items) {
|
|
75
|
+
const o = doc.createElement("option");
|
|
76
|
+
o.value = v;
|
|
77
|
+
o.textContent = v;
|
|
78
|
+
sel.append(o);
|
|
79
|
+
}
|
|
80
|
+
if (pick !== undefined) sel.value = pick;
|
|
81
|
+
};
|
|
82
|
+
const versionsFor = () => {
|
|
83
|
+
const s = scopes.find((x) => x.scopeKey === $("d-scope").value);
|
|
84
|
+
const vs = (s?.versions ?? []).map((v) => v.version);
|
|
85
|
+
fill($("d-from"), vs, vs[vs.length - 2]);
|
|
86
|
+
fill($("d-to"), vs, vs[vs.length - 1]);
|
|
87
|
+
};
|
|
88
|
+
fetchJson("/api/graphdb/index-versions").then((r) => {
|
|
89
|
+
if (r.status !== 200) return;
|
|
90
|
+
scopes = r.body.scopes ?? [];
|
|
91
|
+
fill($("d-scope"), scopes.map((s) => s.scopeKey));
|
|
92
|
+
versionsFor();
|
|
93
|
+
$("d-hint").textContent = scopes.length ? "" : "No index versions yet: run behold index <substrate> twice on one scope.";
|
|
94
|
+
});
|
|
95
|
+
$("d-scope").addEventListener("change", versionsFor);
|
|
96
|
+
$("d-form").addEventListener("submit", async (ev) => {
|
|
97
|
+
ev.preventDefault();
|
|
98
|
+
const r = await fetchJson(diffUrl($("d-scope").value, $("d-from").value, $("d-to").value));
|
|
99
|
+
if (r.status !== 200) {
|
|
100
|
+
$("g-error").textContent = `${r.body.error ?? "Refused."}${r.body.code ? ` (${r.body.code})` : ""}`;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
$("g-error").textContent = "";
|
|
104
|
+
$("g-rows").innerHTML = "";
|
|
105
|
+
$("g-draw").innerHTML = drawOverlaySvg(r.body.draw);
|
|
106
|
+
$("d-summary").textContent = [...diffSummary(r.body.diff), r.body.chantStore ? `read through chant's ${r.body.chantStore.kind} store` : "", r.body.draw.omitted ? `${r.body.draw.omitted} unchanged nodes not drawn` : ""].filter(Boolean).join("\n");
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/* c8 ignore stop */
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// behold#1028: the index diff overlay's pure helpers.
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { diffSummary, diffUrl, drawOverlaySvg } from "./index-diff.js";
|
|
4
|
+
|
|
5
|
+
describe("the overlay", () => {
|
|
6
|
+
it("asks a GET with only the arguments given", () => {
|
|
7
|
+
expect(diffUrl()).toBe("/api/graphdb/index-diff");
|
|
8
|
+
expect(diffUrl("cloud/aws/1/abc", "a.json", "")).toBe("/api/graphdb/index-diff?scope=cloud%2Faws%2F1%2Fabc&from=a.json");
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("draws each change as a class, and not observed is never drawn as removed", () => {
|
|
12
|
+
const svg = drawOverlaySvg({
|
|
13
|
+
nodes: [
|
|
14
|
+
{ key: "a", kind: "k", name: "a", change: "changed", detail: "attrs.x" },
|
|
15
|
+
{ key: "b", kind: "k", name: "b", change: "not-observed" },
|
|
16
|
+
],
|
|
17
|
+
edges: [{ from: "a", to: "b", change: "not-observed" }],
|
|
18
|
+
});
|
|
19
|
+
expect(svg).toContain('class="g-node d-changed"');
|
|
20
|
+
expect(svg).toContain('class="g-node d-not-observed"');
|
|
21
|
+
expect(svg).toContain('class="g-edge d-not-observed"');
|
|
22
|
+
expect(svg).not.toContain("d-removed");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("shows both stamps and each changed property", () => {
|
|
26
|
+
const lines = diffSummary({
|
|
27
|
+
scopeKey: "cloud/aws/1/abc",
|
|
28
|
+
from: { version: "v1", observedAt: "t1", digest: "a".repeat(64) },
|
|
29
|
+
to: { version: "v2", observedAt: "t2", digest: "b".repeat(64) },
|
|
30
|
+
unchanged: false,
|
|
31
|
+
counts: { added: 0, removed: 0, changed: 1, properties: 1, notObserved: 0, edgesAdded: 0, edgesRemoved: 0, edgesNotObserved: 0 },
|
|
32
|
+
nodes: { changed: [{ key: "n", properties: [{ path: "attrs.x", before: 1, after: 2 }] }] },
|
|
33
|
+
coverage: [],
|
|
34
|
+
});
|
|
35
|
+
expect(lines[1]).toMatch(/^from v1: observed t1/);
|
|
36
|
+
expect(lines[2]).toMatch(/^to {3}v2: observed t2/);
|
|
37
|
+
expect(lines).toContain(" n attrs.x: 1 -> 2");
|
|
38
|
+
});
|
|
39
|
+
});
|
package/web/index.html
CHANGED
|
@@ -342,6 +342,39 @@
|
|
|
342
342
|
#tab-trunk a { color: inherit; }
|
|
343
343
|
#tab-trunk .lane-change-set { color: var(--pending); }
|
|
344
344
|
/* behold#685: a plan run locally, beside CI's, in the runs pane's run view (web/kiosk-runs.js renderRun; kiosk.html's rules, scoped). */
|
|
345
|
+
#panel-body #tab-adopt.active { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-caption); }
|
|
346
|
+
#tab-adopt h3 { margin: var(--s3) 0 0; font-size: var(--t-caption); overflow-wrap: anywhere; }
|
|
347
|
+
#tab-adopt .tg-legend { color: var(--muted); overflow-wrap: anywhere; }
|
|
348
|
+
#tab-adopt .tg-refusal { color: var(--degraded); font-weight: 600; overflow-wrap: anywhere; }
|
|
349
|
+
#tab-adopt .ad-card { border-top: 1px solid var(--rule); padding-top: var(--s2); display: flex; flex-direction: column; gap: var(--s1); }
|
|
350
|
+
#tab-adopt .ad-label { font-weight: 600; margin-top: var(--s2); }
|
|
351
|
+
#tab-adopt .ad-list { margin: 0; padding-left: 1.2em; }
|
|
352
|
+
#tab-adopt .ad-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
|
|
353
|
+
#tab-adopt .ad-cmd { font-family: var(--font-mono); overflow-wrap: anywhere; cursor: copy; }
|
|
354
|
+
#tab-adopt .ad-recorded { font-style: italic; }
|
|
355
|
+
#tab-adopt .ad-out { font: 0.95em/1.45 var(--font-mono); white-space: pre-wrap; max-height: 12em; overflow-y: auto; }
|
|
356
|
+
#tab-adopt .ad-table { border-collapse: collapse; width: 100%; }
|
|
357
|
+
#tab-adopt .ad-table td, #tab-adopt .ad-table th { text-align: left; padding: 2px var(--s2) 2px 0; vertical-align: top; border-top: 1px solid var(--rule); }
|
|
358
|
+
#tab-adopt .ad-addr { font-family: var(--font-mono); overflow-wrap: anywhere; }
|
|
359
|
+
#tab-adopt .ad-claimed .ad-status { color: var(--managed); } #tab-adopt .ad-left-out .ad-status { color: var(--foreign); } #tab-adopt .ad-unknown .ad-status { color: var(--degraded); }
|
|
360
|
+
#tab-adopt .ad-refused { color: var(--degraded); }
|
|
361
|
+
/* behold#1035: the Templates tab (web/templates.js), drawn like Adopt. */
|
|
362
|
+
#panel-body #tab-templates.active { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-caption); }
|
|
363
|
+
#tab-templates h3 { margin: var(--s3) 0 0; font-size: var(--t-caption); overflow-wrap: anywhere; }
|
|
364
|
+
#tab-templates .tg-legend { color: var(--muted); overflow-wrap: anywhere; }
|
|
365
|
+
#tab-templates .tg-refusal { color: var(--degraded); font-weight: 600; overflow-wrap: anywhere; }
|
|
366
|
+
#tab-templates .ad-card { border-top: 1px solid var(--rule); padding-top: var(--s2); display: flex; flex-direction: column; gap: var(--s1); }
|
|
367
|
+
#tab-templates .ad-label { font-weight: 600; margin-top: var(--s2); }
|
|
368
|
+
#tab-templates .ad-row { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
|
|
369
|
+
#tab-templates .tp-form { display: flex; flex-direction: column; gap: 2px; }
|
|
370
|
+
#tab-templates .tp-form input[type="text"], #tab-templates .tp-form input[type="number"], #tab-templates .tp-form textarea { font: inherit; max-width: 100%; }
|
|
371
|
+
#tab-templates .tp-form textarea { min-height: 4em; font-family: var(--font-mono); }
|
|
372
|
+
#tab-templates .tp-request { align-self: flex-start; }
|
|
373
|
+
#tab-templates .tp-all { align-self: flex-start; }
|
|
374
|
+
/* behold#1036: an app's part of the inspect pane (web/template-apps.js). */
|
|
375
|
+
#inspect-body .tpl-app .tpl-app-fact { margin: 2px 0; overflow-wrap: anywhere; }
|
|
376
|
+
#inspect-body .tpl-app .tpl-app-buttons { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s2); }
|
|
377
|
+
#inspect-body .tpl-app .tpl-app-result { overflow-wrap: anywhere; }
|
|
345
378
|
#panel-body #tab-local-runs.active { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-caption); }
|
|
346
379
|
#tab-local-runs h3 { margin: var(--s3) 0 0; font-size: var(--t-caption); }
|
|
347
380
|
#tab-local-runs .tg-legend { color: var(--muted); overflow-wrap: anywhere; }
|
|
@@ -985,6 +1018,10 @@
|
|
|
985
1018
|
filled — the fill is the status channel and this card has no status yet,
|
|
986
1019
|
so colouring it would claim an observation behold has not made. */
|
|
987
1020
|
#graph [data-pending-read] { opacity: 0.55; }
|
|
1021
|
+
/* behold#998: a card a started drift read has not reported yet. Not a
|
|
1022
|
+
status, so the fill is left as it was; the stream's record paints it. */
|
|
1023
|
+
#graph [data-drift-reading] { opacity: 0.6; }
|
|
1024
|
+
#graph [data-drift-reading] rect { stroke-dasharray: 3 3; }
|
|
988
1025
|
#graph [data-pending-read] rect { stroke-dasharray: 4 3; }
|
|
989
1026
|
@media (prefers-reduced-motion: no-preference) {
|
|
990
1027
|
#graph [data-pending-read] { animation: pending-breathe calc(var(--beat) * 2) ease-in-out infinite; }
|
package/web/kiosk-ask-tips.js
CHANGED
|
@@ -284,6 +284,17 @@ export function dockCorner(area, w, h, lit = []) {
|
|
|
284
284
|
return null;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
/**
|
|
288
|
+
* The room a tip may dock in, in page pixels: the shown graph frame (`frame`), less what the prompt pane (`ask`) covers
|
|
289
|
+
* under it and what the side pane (`side`: web/kiosk-side.js, open or folded to its tab) covers at its right. Either
|
|
290
|
+
* may be null (not shown).
|
|
291
|
+
*/
|
|
292
|
+
export function tipArea(frame, ask = null, side = null) {
|
|
293
|
+
const bottom = ask ? Math.min(frame.bottom, ask.top) : frame.bottom;
|
|
294
|
+
const right = side && side.left < frame.right && side.right > frame.left && side.top < bottom && side.bottom > frame.top ? Math.max(frame.left, side.left) : frame.right;
|
|
295
|
+
return { left: frame.left, top: frame.top, width: Math.max(0, right - frame.left), height: Math.max(0, bottom - frame.top) };
|
|
296
|
+
}
|
|
297
|
+
|
|
287
298
|
const STYLE_ID = "k-ask-tips-style";
|
|
288
299
|
const STYLE = `
|
|
289
300
|
#k-ask-tips { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 50; pointer-events: none; overflow: hidden; }
|
|
@@ -331,14 +342,13 @@ export function mountAskTips({ win = window, doc = document, askHost, reduced =
|
|
|
331
342
|
const f = doc.getElementById("view");
|
|
332
343
|
return f && f.getClientRects().length > 0 ? f : null;
|
|
333
344
|
};
|
|
334
|
-
/** The graph's room above the prompt, in page pixels. */
|
|
345
|
+
/** The graph's room above the prompt and left of the side pane, in page pixels. */
|
|
335
346
|
const area = () => {
|
|
336
347
|
const f = shownFrame();
|
|
337
348
|
if (!f) return null;
|
|
338
|
-
const
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
return { left: r.left, top: r.top, width: r.width, height: Math.max(0, bottom - r.top), frame: f };
|
|
349
|
+
const side = [doc.getElementById("k-side"), doc.getElementById("k-side-tab")].find((n) => n && n.getClientRects().length > 0);
|
|
350
|
+
const room = tipArea(f.getBoundingClientRect(), askHost.hidden ? null : askHost.getBoundingClientRect(), side ? side.getBoundingClientRect() : null);
|
|
351
|
+
return { ...room, frame: f };
|
|
342
352
|
};
|
|
343
353
|
const litRects = (a) => {
|
|
344
354
|
if (!a || !a.frame || lit.source !== a.frame.contentWindow) return [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { ATMOS_TIP, CHANT_TIPS, DEFAULT_TIPS, EDGE, LINK_RESUME_MS, PLAIN_FREE_TIP, TERRAGRUNT_TIP, TIP_FADE_MS, TIP_MIN_MS, TIP_QUIET_MS, TIP_WAIT_MS, actTip, actTips, createTipSequencer, dockCorner, holdMs, safeLink, shouldDismiss } from "./kiosk-ask-tips.js";
|
|
2
|
+
import { ATMOS_TIP, CHANT_TIPS, DEFAULT_TIPS, EDGE, LINK_RESUME_MS, PLAIN_FREE_TIP, TERRAGRUNT_TIP, TIP_FADE_MS, TIP_MIN_MS, TIP_QUIET_MS, TIP_WAIT_MS, actTip, actTips, createTipSequencer, dockCorner, holdMs, safeLink, shouldDismiss, tipArea } from "./kiosk-ask-tips.js";
|
|
3
3
|
|
|
4
4
|
function rig(opts = {}) {
|
|
5
5
|
const log = [];
|
|
@@ -357,3 +357,16 @@ describe("tip cards: a wait about to end", () => {
|
|
|
357
357
|
expect(shows(log)).toHaveLength(1);
|
|
358
358
|
});
|
|
359
359
|
});
|
|
360
|
+
|
|
361
|
+
describe("the room a tip docks in", () => {
|
|
362
|
+
const frame = { left: 5, top: 80, right: 1035, bottom: 900 };
|
|
363
|
+
it("is the graph frame above the prompt pane", () => {
|
|
364
|
+
expect(tipArea(frame, { top: 640 }, null)).toEqual({ left: 5, top: 80, width: 1030, height: 560 });
|
|
365
|
+
expect(tipArea(frame, null, null)).toEqual({ left: 5, top: 80, width: 1030, height: 820 });
|
|
366
|
+
});
|
|
367
|
+
it("ends where the side pane starts, open or folded to its tab", () => {
|
|
368
|
+
expect(tipArea(frame, { top: 640 }, { left: 1000, right: 1395, top: 80, bottom: 630 })).toEqual({ left: 5, top: 80, width: 995, height: 560 });
|
|
369
|
+
// A side pane beside the frame (the frame already narrowed for it) leaves the frame's room as it is.
|
|
370
|
+
expect(tipArea(frame, { top: 640 }, { left: 1045, right: 1395, top: 80, bottom: 630 }).width).toBe(1030);
|
|
371
|
+
});
|
|
372
|
+
});
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import { askLayout, orderRoots } from "./kiosk-ask-layout.js";
|
|
13
13
|
import { applyOf, cardLines, cardTitle } from "./kiosk-light.js";
|
|
14
|
+
import { HOLE_WORDS, KIND_TAGS, memberKinds } from "./member-kind.js";
|
|
14
15
|
|
|
15
16
|
/** What hangs under a card for each unknown value it carries (web/kiosk-light-frame.js drawSlots). */
|
|
16
17
|
export const SLOT_ROW = 26;
|
|
@@ -63,30 +64,46 @@ export function askDeltas({ roots, nodes, boxes, extras = {}, edges = [], open }
|
|
|
63
64
|
/**
|
|
64
65
|
* A composed choudoufu run's scene: each estate's box and cards from `answer.estateScene`, laid out for `open`, and
|
|
65
66
|
* an edge for each reach the blast radius names. Null when the answer holds no scene.
|
|
67
|
+
*
|
|
68
|
+
* behold#1008: a composed chant run says what each member is (`answer.chant.members`, web/member-kind.js). Each root
|
|
69
|
+
* then carries `kind` (hole, previewed or plain), and a hole with nothing previewed keeps its box with one empty slot
|
|
70
|
+
* (`hole`: where its cards would be, and why there are none).
|
|
66
71
|
*/
|
|
67
72
|
export function sceneModel(answer, plan, progress, open) {
|
|
68
|
-
const
|
|
73
|
+
const kinds = memberKinds(answer);
|
|
74
|
+
// Kinds come from answer.chant alone: without it (a composed choudoufu run) a root's `hole` flag is ignored and
|
|
75
|
+
// nothing is marked, so the run draws as it did before behold#1008.
|
|
76
|
+
const isHole = (r) => kinds.size > 0 && (r.hole === true || (kinds.get(r.path) || {}).kind === "hole");
|
|
77
|
+
const scene = answer && answer.estateScene && Array.isArray(answer.estateScene.roots) ? answer.estateScene.roots.filter((r) => (r.resources && r.resources.length) || (r.path && r.name && isHole(r))) : [];
|
|
69
78
|
if (!scene.length) return null;
|
|
70
79
|
const extras = slotCounts(plan);
|
|
71
80
|
const ordered = upstreamFirst(scene, plan.edges);
|
|
81
|
+
const holeSlot = (r) => `${r.member}/${r.name}/~hole`;
|
|
82
|
+
const resourcesOf = (r) => r.resources || [];
|
|
72
83
|
const input = ordered.map((r) => ({
|
|
73
84
|
id: r.path,
|
|
74
|
-
cards: r.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
cards: resourcesOf(r).length
|
|
86
|
+
? r.resources.map((res) => {
|
|
87
|
+
const id = `${r.member}/${r.name}/${res.address}`;
|
|
88
|
+
return { id, w: CARD_W, h: CARD_H + (extras[id] ? extras[id] * SLOT_ROW + 10 : 0) };
|
|
89
|
+
})
|
|
90
|
+
: [{ id: holeSlot(r), w: CARD_W, h: CARD_H }],
|
|
78
91
|
}));
|
|
79
92
|
const layout = askLayout(input, open);
|
|
80
93
|
const roots = ordered.map((r) => {
|
|
81
94
|
const box = layout.boxes[r.path];
|
|
82
95
|
const outcome = applyOf(r.path, progress);
|
|
83
96
|
const done = outcome ? outcome.apply === "applied" || outcome.apply === "no-changes" : null;
|
|
97
|
+
const known = kinds.get(r.path);
|
|
98
|
+
const kind = isHole(r) ? "hole" : known ? known.kind : null;
|
|
84
99
|
return {
|
|
85
100
|
path: r.path,
|
|
86
101
|
name: r.name,
|
|
87
102
|
member: r.member,
|
|
88
103
|
...box,
|
|
89
|
-
|
|
104
|
+
...(kind ? { kind } : {}),
|
|
105
|
+
...(!resourcesOf(r).length ? { hole: { ...layout.cards[holeSlot(r)], words: HOLE_WORDS, reasons: known ? known.reasons : [] } } : {}),
|
|
106
|
+
cards: resourcesOf(r).map((res) => {
|
|
90
107
|
const id = `${r.member}/${r.name}/${res.address}`;
|
|
91
108
|
const at = layout.cards[id];
|
|
92
109
|
const { name, type } = cardTitle(res.address);
|
|
@@ -112,6 +129,25 @@ export function sceneModel(answer, plan, progress, open) {
|
|
|
112
129
|
return { roots, edges, width: layout.width, height: layout.height, cols: layout.cols };
|
|
113
130
|
}
|
|
114
131
|
|
|
132
|
+
/** The words in a box whose plan is not written yet. */
|
|
133
|
+
export const WAITING_WORDS = "waiting for the plan";
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The scene while the plan is not there to draw (a pull request being planned, the reset between acts): each
|
|
137
|
+
* estate the reports name, upstream on top, with one empty slot where its cards will be. Without it the pane holds
|
|
138
|
+
* dark until the plan job writes the plan, or keeps the last act's cards under the next act's title. Null when the
|
|
139
|
+
* reports name no estate.
|
|
140
|
+
*/
|
|
141
|
+
export function waitingModel(answer, plan, open) {
|
|
142
|
+
const scene = answer && answer.estateScene && Array.isArray(answer.estateScene.roots) ? answer.estateScene.roots.filter((r) => r && r.path && r.name) : [];
|
|
143
|
+
if (!scene.length) return null;
|
|
144
|
+
const ordered = upstreamFirst(scene, (plan && plan.edges) || []);
|
|
145
|
+
const slotOf = (r) => `${r.member}/${r.name}/~waiting`;
|
|
146
|
+
const layout = askLayout(ordered.map((r) => ({ id: r.path, cards: [{ id: slotOf(r), w: CARD_W, h: CARD_H }] })), open);
|
|
147
|
+
const roots = ordered.map((r) => ({ path: r.path, name: r.name, member: r.member, ...layout.boxes[r.path], cards: [], waiting: { ...layout.cards[slotOf(r)], words: WAITING_WORDS } }));
|
|
148
|
+
return { roots, edges: [], width: layout.width, height: layout.height, cols: layout.cols, waiting: true };
|
|
149
|
+
}
|
|
150
|
+
|
|
115
151
|
/** A curve from one card's edge to the other's, on the sides that face. */
|
|
116
152
|
export function edgePath(a, b) {
|
|
117
153
|
if (b.y >= a.y + a.h) {
|
|
@@ -175,10 +211,38 @@ export function drawScene(svg, model) {
|
|
|
175
211
|
scene.appendChild(g);
|
|
176
212
|
}
|
|
177
213
|
for (const r of model.roots) {
|
|
178
|
-
|
|
179
|
-
g
|
|
214
|
+
// behold#1008: a hole's box is dashed in the degraded tone; a hole's and a previewed member's carry a tag saying so.
|
|
215
|
+
const g = make("g", { "data-layout-box": `box:${r.name}`, ...(r.kind ? { "data-member-kind": r.kind } : {}) });
|
|
216
|
+
const hole = r.kind === "hole";
|
|
217
|
+
g.appendChild(make("rect", { "data-group-id": r.name, x: r.x, y: r.y, width: r.w, height: r.h, rx: 16, fill: "var(--panel, var(--bg))", "fill-opacity": 0.6, stroke: hole ? "var(--frame-degraded, var(--degraded))" : "var(--frame-neutral, var(--neutral))", "stroke-width": hole ? 2 : 1.5, ...(hole ? { "stroke-dasharray": "10 6" } : {}) }));
|
|
180
218
|
g.appendChild(make("text", { x: r.x + 18, y: r.y + 26, "font-size": 20, "font-weight": 700, "letter-spacing": ".5", fill: "var(--muted)" }, r.name));
|
|
219
|
+
const tag = r.kind && KIND_TAGS[r.kind];
|
|
220
|
+
if (tag) {
|
|
221
|
+
const color = hole ? "var(--frame-degraded, var(--degraded))" : "var(--frame-pending, var(--pending))";
|
|
222
|
+
const w = tag.length * 8.5 + 20;
|
|
223
|
+
const mark = make("g", { "data-kl-kind-mark": r.kind });
|
|
224
|
+
mark.appendChild(make("rect", { x: r.x + r.w - w - 14, y: r.y + 9, width: w, height: 24, rx: 12, fill: "none", stroke: color, "stroke-width": 1.5 }));
|
|
225
|
+
mark.appendChild(make("text", { x: r.x + r.w - w / 2 - 14, y: r.y + 26, "text-anchor": "middle", "font-size": 14, "font-weight": 600, fill: color }, tag));
|
|
226
|
+
g.appendChild(mark);
|
|
227
|
+
}
|
|
181
228
|
scene.appendChild(g);
|
|
229
|
+
if (r.hole) {
|
|
230
|
+
// Where the hole's cards would be: no data-node-id, as the waiting slot has none.
|
|
231
|
+
const h = r.hole;
|
|
232
|
+
const slot = make("g", { "data-kl-hole": r.name });
|
|
233
|
+
slot.appendChild(make("rect", { x: h.x, y: h.y, width: h.w, height: h.h, rx: 12, fill: "none", stroke: "var(--frame-degraded, var(--degraded))", "stroke-width": 1.5, "stroke-dasharray": "6 5" }));
|
|
234
|
+
slot.appendChild(make("text", { x: h.x + h.w / 2, y: h.y + h.h / 2 + 5, "text-anchor": "middle", "font-size": 15, fill: "var(--muted)" }, h.words));
|
|
235
|
+
if (h.reasons && h.reasons.length) slot.appendChild(make("title", {}, h.reasons.join("\n")));
|
|
236
|
+
scene.appendChild(slot);
|
|
237
|
+
}
|
|
238
|
+
if (r.waiting) {
|
|
239
|
+
// No data-node-id: the lighting and the reads look for cards, and this is where they will be, not one of them.
|
|
240
|
+
const w = r.waiting;
|
|
241
|
+
const slot = make("g", { "data-kl-waiting": r.name });
|
|
242
|
+
slot.appendChild(make("rect", { x: w.x, y: w.y, width: w.w, height: w.h, rx: 12, fill: "none", stroke: "var(--frame-neutral, var(--neutral))", "stroke-width": 1.5, "stroke-dasharray": "6 5" }));
|
|
243
|
+
slot.appendChild(make("text", { x: w.x + w.w / 2, y: w.y + w.h / 2 + 5, "text-anchor": "middle", "font-size": 15, fill: "var(--muted)" }, w.words));
|
|
244
|
+
scene.appendChild(slot);
|
|
245
|
+
}
|
|
182
246
|
for (const c of r.cards) {
|
|
183
247
|
const card = make("g", { "data-node-id": c.id, "data-kl-synth": "1" });
|
|
184
248
|
const edge = c.applied ? "var(--frame-managed, var(--managed))" : "var(--frame-pending, var(--pending))";
|
package/web/kiosk-light-frame.js
CHANGED
|
@@ -114,6 +114,7 @@ function drawStates(layer, answer, progress, h) {
|
|
|
114
114
|
const g = make("g", { "data-kl-state": r.path, "data-kl-look": m.look || "none", "pointer-events": "none" });
|
|
115
115
|
if (host) g.setAttribute("data-kl-layer", "1");
|
|
116
116
|
const words = stateWords(m);
|
|
117
|
+
if (!words) continue; // an estate with nothing decided yet: its box's title already names it
|
|
117
118
|
const w = Math.max(120, words.length * 7.4 + 20);
|
|
118
119
|
const x = box.x + 14;
|
|
119
120
|
const rect = make("rect", { x, y: y - 17, width: w, height: 22, rx: 4, fill: "var(--panel, var(--bg))", stroke: "var(--frame-neutral, var(--neutral))", "stroke-width": 1.5 });
|
package/web/kiosk-light.js
CHANGED
|
@@ -134,6 +134,13 @@ export function planOf(answer, progress = null) {
|
|
|
134
134
|
}
|
|
135
135
|
for (const [root, ups] of Object.entries(pr.upstreams || {})) for (const u of ups || []) edge(u, root);
|
|
136
136
|
for (const res of (pr.blast && pr.blast.resources) || []) out.reaches.set(lightKey(res.root, res.address), res.reaches || []);
|
|
137
|
+
} else if (answer.estateScene && Array.isArray(answer.estateScene.reads)) {
|
|
138
|
+
// behold#1012: a composed run drawn from its tf-apply report alone carries the reads on its scene. Root to root:
|
|
139
|
+
// the report maps no output to the resource that produced it, so they stay box-to-box.
|
|
140
|
+
for (const r of answer.estateScene.reads) {
|
|
141
|
+
edge(r.upstream, r.root);
|
|
142
|
+
out.reads.push(r);
|
|
143
|
+
}
|
|
137
144
|
}
|
|
138
145
|
if (progress && Array.isArray(progress.reads)) for (const r of progress.reads) for (const u of r.reads || []) edge(u, r.root);
|
|
139
146
|
// A composed run's members come in the order it applies them. When no read names an order, each reads the one before.
|
|
@@ -239,6 +246,29 @@ export function applyOf(root, progress) {
|
|
|
239
246
|
return null;
|
|
240
247
|
}
|
|
241
248
|
|
|
249
|
+
/**
|
|
250
|
+
* The run view, or in its place what the apply reports of its commit say. A pipeline that writes reports and no run
|
|
251
|
+
* view (choudoufu's Terragrunt and Atmos examples, whose workflows write chant-report's tf-plan and tf-apply only)
|
|
252
|
+
* leaves the read of the act's merge commit `present: false`, and its cards would say "known after apply" past the
|
|
253
|
+
* apply. Each root whose apply report is of that commit is then one apply's part, applied or failed as the report says,
|
|
254
|
+
* and the view is marked `reported`. A run view that is there, or a report of another commit, changes nothing.
|
|
255
|
+
*/
|
|
256
|
+
export function reportedRunView(progress, answer) {
|
|
257
|
+
if (!progress || progress.error || !progress.run || progress.run.present !== false) return progress;
|
|
258
|
+
const commit = typeof progress.run.commit === "string" ? progress.run.commit : "";
|
|
259
|
+
if (commit.length < 7 || !answer || answer.error || !Array.isArray(answer.roots)) return progress;
|
|
260
|
+
const same = (c) => typeof c === "string" && c.length >= 7 && (c.startsWith(commit) || commit.startsWith(c));
|
|
261
|
+
const states = [];
|
|
262
|
+
for (const r of answer.roots) {
|
|
263
|
+
const a = r && r.apply;
|
|
264
|
+
if (!a || a.approval === "waiting" || !a.run || !same(a.run.commit)) continue;
|
|
265
|
+
if (a.status === "failed") states.push({ number: 1, state: "failed", roots: [r.path], reported: true });
|
|
266
|
+
else if (a.applied) states.push({ number: 1, state: "applied", roots: [r.path], changed: a.changes > 0 ? [r.path] : [], reported: true });
|
|
267
|
+
}
|
|
268
|
+
if (!states.length) return progress;
|
|
269
|
+
return { ...progress, run: { ...progress.run, present: true, reported: true }, states: [...(Array.isArray(progress.states) ? progress.states : []), ...states] };
|
|
270
|
+
}
|
|
271
|
+
|
|
242
272
|
/**
|
|
243
273
|
* The words on a root's badge in ask mode: no wave (a viewer has no use for one), and the step's own word. Follows the
|
|
244
274
|
* run view's outcome for the root when it has one, so the badge and the state label under the box agree.
|
|
@@ -264,19 +294,27 @@ const LOOK_OF = { applied: "applied", "no-changes": "applied", partial: "partial
|
|
|
264
294
|
export function stateMarks(answer, progress) {
|
|
265
295
|
const roots = answer && Array.isArray(answer.roots) ? rootsOf(answer).map((r) => r.path) : progress && Array.isArray(progress.reads) ? progress.reads.map((r) => r.root) : [];
|
|
266
296
|
// behold#940: an estate of choudoufu's has no state file: it holds records, one per resource, written as each applies.
|
|
267
|
-
|
|
297
|
+
// The reports' binaries say so too, and still do when a pin holds the scene back (a pull request being planned):
|
|
298
|
+
// the scene alone would call the same estates state files for that while.
|
|
299
|
+
const scene = !!(answer && answer.estateScene && Array.isArray(answer.estateScene.roots) && answer.estateScene.roots.length);
|
|
300
|
+
const binaries = (answer && answer.binaries) || {};
|
|
268
301
|
const out = {};
|
|
269
302
|
for (const root of roots) {
|
|
270
303
|
const a = applyOf(root, progress);
|
|
304
|
+
const estate = scene || binaries[root] === "choudoufu";
|
|
271
305
|
const file = estate ? { file: lastSegment(root), from: "estate", estate: true } : stateFile(root, progress);
|
|
272
306
|
out[root] = { ...file, written: !!a && a.state === "written", look: a && a.apply ? LOOK_OF[a.apply] || null : null, covered: !!(a && a.covered) };
|
|
273
307
|
}
|
|
274
308
|
return out;
|
|
275
309
|
}
|
|
276
310
|
|
|
277
|
-
/**
|
|
311
|
+
/**
|
|
312
|
+
* The words of a state's label: its file, its look, and that it was written. An estate has no file to name, and its
|
|
313
|
+
* name is already its box's title: its label says only the look and the records written, and is empty (no label is
|
|
314
|
+
* drawn) until there is one of them to say. A label of the name alone read as a second copy of the box.
|
|
315
|
+
*/
|
|
278
316
|
export function stateWords(m) {
|
|
279
|
-
return [m.estate ?
|
|
317
|
+
return [m.estate ? null : `state ${m.file}`, m.look ? LOOK_WORDS[m.look] : null, m.written ? (m.estate ? "records written" : "written") : null, m.covered ? COVERED_WORDS : null].filter(Boolean).join(" \u00b7 ");
|
|
280
318
|
}
|
|
281
319
|
|
|
282
320
|
// ---------------------------------------------------------------------------
|