@astrofoundry/pi-astro 0.40.75 → 0.40.77
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/extensions/astro-discord/arcane-watch.test.ts +3 -3
- package/extensions/astro-discord/arcane-watch.ts +3 -3
- package/extensions/astro-discord/commands.ts +1 -1
- package/extensions/astro-discord/daily-report.test.ts +14 -14
- package/extensions/astro-discord/daily-report.ts +20 -20
- package/extensions/astro-discord/daily-run.test.ts +64 -56
- package/extensions/astro-discord/daily-run.ts +114 -57
- package/extensions/astro-discord/index.ts +24 -14
- package/extensions/astro-discord/reports.ts +2 -0
- package/extensions/astro-discord/security-monitor.test.ts +8 -8
- package/extensions/astro-discord/security-monitor.ts +15 -15
- package/extensions/astro-discord/security.test.ts +40 -40
- package/extensions/astro-discord/security.ts +39 -39
- package/extensions/astro-discord/supervise.test.ts +1 -1
- package/extensions/astro-discord/supervise.ts +2 -2
- package/extensions/astro-discord/tools-report.test.ts +6 -6
- package/extensions/astro-discord/tools-report.ts +12 -12
- package/package.json +1 -1
- package/skills/dns/SKILL.md +1 -1
- package/skills/proxmox/SKILL.md +1 -1
- package/specialists/entry/remote/spc-dns-node-entry.sh +2 -1
- package/specialists/entry/remote/spc-proxmox-pulsar-entry.sh +2 -1
- package/specialists/entry/remote/spc-proxmox-spacex-entry.sh +2 -1
|
@@ -145,10 +145,10 @@ describe("container watch texts", () => {
|
|
|
145
145
|
it("tags the owners and says what happened", () => {
|
|
146
146
|
const e = { name: "syncthing", project: "syncthing", restarts: [iso(T0), iso(T0 + 5 * MIN), iso(T0 + 10 * MIN)] };
|
|
147
147
|
expect(escalationText(e, [OWNER], TZ)).toBe(
|
|
148
|
-
`🔁 **Container restarting** · syncthing · 3 restarts in 24 h, last 22 Oct 10:10 CEST\nAuto-heal or Docker restarted it each time. The arcane specialist investigates in the thread
|
|
148
|
+
`🔁 **Container restarting** · syncthing · 3 restarts in 24 h, last 22 Oct 10:10 CEST\nAuto-heal or Docker restarted it each time. The arcane specialist investigates read-only in the thread.\n<@${OWNER}>`,
|
|
149
149
|
);
|
|
150
150
|
expect(unhealthyText({ name: "worker", project: "grimoire", since: iso(T0), newImage: true, problem: "unhealthy" }, [OWNER], TZ, T0 + 7 * MIN)).toBe(
|
|
151
|
-
`⚠️ **Container unhealthy after a redeploy** · worker (stack grimoire) · recreated 22 Oct 10:00 CEST with a new image, still unhealthy 7 min later\nNo stack-update or other specialist operation explains
|
|
151
|
+
`⚠️ **Container unhealthy after a redeploy** · worker (stack grimoire) · recreated 22 Oct 10:00 CEST with a new image, still unhealthy 7 min later\nNo stack-update or other specialist operation explains it; ask the arcane specialist here.\n<@${OWNER}>`,
|
|
152
152
|
);
|
|
153
153
|
});
|
|
154
154
|
|
|
@@ -271,7 +271,7 @@ describe("container watch monitor", () => {
|
|
|
271
271
|
h.answer.next = () => "not json";
|
|
272
272
|
for (let i = 0; i < 7; i++) await h.watch.poll(SCHEDULE);
|
|
273
273
|
expect(h.messages).toHaveLength(1);
|
|
274
|
-
expect(h.messages[0].message.content).toContain("⚠️ **Container checks failing:**
|
|
274
|
+
expect(h.messages[0].message.content).toContain("⚠️ **Container checks failing:** Arcane's containers unreadable for 30 min");
|
|
275
275
|
h.answer.next = () => JSON.stringify({ containers: [ct()] });
|
|
276
276
|
await h.watch.poll(SCHEDULE);
|
|
277
277
|
expect(h.messages[1].message.content).toBe("✅ Container checks work again.");
|
|
@@ -213,7 +213,7 @@ export function escalationText(e: Escalation, owners: readonly string[], timeZon
|
|
|
213
213
|
const last = e.restarts[e.restarts.length - 1];
|
|
214
214
|
return [
|
|
215
215
|
`🔁 **Container restarting** · ${where(e.name, e.project)} · ${e.restarts.length} restarts in 24 h, last ${clockText(last, timeZone)}`,
|
|
216
|
-
"Auto-heal or Docker restarted it each time. The arcane specialist investigates in the thread
|
|
216
|
+
"Auto-heal or Docker restarted it each time. The arcane specialist investigates read-only in the thread.",
|
|
217
217
|
mention(owners),
|
|
218
218
|
].join("\n");
|
|
219
219
|
}
|
|
@@ -222,13 +222,13 @@ export function unhealthyText(u: Unhealthy, owners: readonly string[], timeZone:
|
|
|
222
222
|
const minutes = Math.round((now - Date.parse(u.since)) / MINUTE);
|
|
223
223
|
return [
|
|
224
224
|
`⚠️ **Container ${u.problem} after a redeploy** · ${where(u.name, u.project)} · recreated ${clockText(u.since, timeZone)}${u.newImage ? " with a new image" : ""}, still ${u.problem} ${minutes} min later`,
|
|
225
|
-
"No stack-update or other specialist operation explains
|
|
225
|
+
"No stack-update or other specialist operation explains it; ask the arcane specialist here.",
|
|
226
226
|
mention(owners),
|
|
227
227
|
].join("\n");
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
export function watchFailingText(minutes: number, reason: string, owners: readonly string[]): string {
|
|
231
|
-
return `⚠️ **Container checks failing:**
|
|
231
|
+
return `⚠️ **Container checks failing:** Arcane's containers unreadable for ${minutes} min (${escapeDiscord(reason.slice(0, 200))}). Restarts and redeploys unchecked meanwhile; details in the bridge log on Cortex.\n${mention(owners)}`;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
export const WATCH_RECOVERED_TEXT = "✅ Container checks work again.";
|
|
@@ -53,7 +53,7 @@ function runCommand(specialist: string, text: string): Command {
|
|
|
53
53
|
/** Prompt paragraph appended for tasks that arrive from a chat channel. */
|
|
54
54
|
export const CHANNEL_RULES = `## Channel rules
|
|
55
55
|
|
|
56
|
-
This task arrived from a Discord channel and your answer is posted there. Answer in plain text
|
|
56
|
+
This task arrived from a Discord channel and your answer is posted there. Answer in plain text, facts first, no headings, with the fewest words that keep the meaning; this is mandatory, and 1500 characters is the ceiling. Write only what the owner needs to act or to know the outcome: the result, what you need from them, and the next step. Leave out what you read, checks that found nothing, what did not change, and comments on your own reasoning. Use short, plain sentences. When the task is ambiguous (which guest, which record, which host), do not act: ask one precise question and stop. Risky calls may wait for an operator's approval; if the tool reports a denial or a missing answer, report it and stop. When you need something from the owner (a go, a decision, an action, or a blocker you cannot remove), your first line starts with **Needs you:** and says what you need in one sentence; the bridge then tags them.`;
|
|
57
57
|
|
|
58
58
|
/** A reply whose first line asks the owner for something; the bridge tags the requester on it. */
|
|
59
59
|
export function needsYou(output: string): boolean {
|
|
@@ -109,7 +109,7 @@ describe("Arcane Daily Report layout", () => {
|
|
|
109
109
|
["gotenberg", "Bigcapital needs Gotenberg 7", false],
|
|
110
110
|
["proxy", "wait for the next bundle", false],
|
|
111
111
|
]);
|
|
112
|
-
expect(serviceText(stack?.lines[0] as ServiceLine)).toBe("• gotenberg: 7.10.2,
|
|
112
|
+
expect(serviceText(stack?.lines[0] as ServiceLine)).toBe("• gotenberg: 7.10.2, major 8 available (tag change by hand; Update skips it)\n-# ⏸ held: Bigcapital needs Gotenberg 7");
|
|
113
113
|
const partly = buildStacks({ ...updateReport, rows: [rows[5], proxy], holds: { "bigcapital/gotenberg": "x" } });
|
|
114
114
|
expect(partly?.stacks[0].actionable).toBe(true);
|
|
115
115
|
});
|
|
@@ -133,10 +133,10 @@ describe("Arcane Daily Report layout", () => {
|
|
|
133
133
|
const text = (c: (typeof components)[number]) => (c.type === 9 ? c.components?.[0].content : c.content);
|
|
134
134
|
expect(components.slice(1).map(text)).toEqual([
|
|
135
135
|
"**arcane**\n• arcane: v2.16.1 → v2.17.0 · new version (digest pin)",
|
|
136
|
-
"**bigcapital**\n• gotenberg: 7.10.2,
|
|
136
|
+
"**bigcapital**\n• gotenberg: 7.10.2, major 8 available (tag change by hand; Update skips it)",
|
|
137
137
|
"**media**\n• sonarr: 4.0.20.3014-ls325 → 4.0.20.3014-ls326 · new build of `latest`",
|
|
138
138
|
"**postgres**\n• db: rebuild of `18`",
|
|
139
|
-
"**stirling-pdf**\n• stirling-pdf: 2.14.3 → 3.0.0 · new version · **major
|
|
139
|
+
"**stirling-pdf**\n• stirling-pdf: 2.14.3 → 3.0.0 · new version · **major**\n-# 🟡 check: the config key changed",
|
|
140
140
|
"**supabase**\n• db: 15.8.1.085 → 15.8.1.094 · new version (tag change)\n-# ⏸ held: coordinated release: review first",
|
|
141
141
|
"**vpn**\n• gluetun: new build of `latest`",
|
|
142
142
|
"**x**\n• y: check failed (stale)",
|
|
@@ -164,7 +164,7 @@ describe("Arcane Daily Report layout", () => {
|
|
|
164
164
|
expect(label("rolled back")).toMatchObject({ label: "Rolled back", style: 4, disabled: true });
|
|
165
165
|
expect(label("failed")).toEqual({ type: 2, style: 4, label: "Retry", custom_id: "arcane:stack:media" });
|
|
166
166
|
const manager = entry(report(), "arcane");
|
|
167
|
-
expect(stackComponent({ ...manager, state: "failed" }).accessory).toMatchObject({ label: "Upgrade
|
|
167
|
+
expect(stackComponent({ ...manager, state: "failed" }).accessory).toMatchObject({ label: "Upgrade incomplete", disabled: true });
|
|
168
168
|
expect(stackComponent({ ...s, state: "rolled back", detail: "rolled back: health" }).components?.[0].content).toContain("\n-# rolled back: health");
|
|
169
169
|
});
|
|
170
170
|
|
|
@@ -178,8 +178,8 @@ describe("Arcane Daily Report layout", () => {
|
|
|
178
178
|
expect(remote.stacks[0].lines[0].environment).toBe("mira");
|
|
179
179
|
expect(serviceUsage("media-mira", remote.stacks[0].lines[0])).toContain("on the Docker host of the Arcane environment mira,");
|
|
180
180
|
expect(remote.environmentErrors).toEqual([{ environment: "lab", error: "agent offline" }]);
|
|
181
|
-
expect(headText({ ...remote, timeZone: "Europe/Madrid" }).content).toContain("\n-# ⚠️ environment lab
|
|
182
|
-
expect(headText({ ...remote, timeZone: "Europe/Madrid" }).content).toContain("\n-# ⚠️
|
|
181
|
+
expect(headText({ ...remote, timeZone: "Europe/Madrid" }).content).toContain("\n-# ⚠️ environment lab unchecked: agent offline");
|
|
182
|
+
expect(headText({ ...remote, timeZone: "Europe/Madrid" }).content).toContain("\n-# ⚠️ Arcane agent of mira runs v2.17.3, manager v2.18.0");
|
|
183
183
|
expect(failureMessage().startsWith(REPORT_PREFIX)).toBe(true);
|
|
184
184
|
});
|
|
185
185
|
|
|
@@ -202,7 +202,7 @@ describe("Arcane report plans", () => {
|
|
|
202
202
|
expect(stackComponent({ ...media, state: "running" }).accessory).toMatchObject({ label: "Updating…", disabled: true });
|
|
203
203
|
const pdf = { ...entry(r, "stirling-pdf"), plan: "careful" as const };
|
|
204
204
|
expect(stackComponent(pdf).accessory).toEqual({ type: 2, style: 4, label: "Upgrade carefully", custom_id: "arcane:careful:stirling-pdf" });
|
|
205
|
-
expect(stackComponent({ ...pdf, state: "planning" }).accessory).toMatchObject({ label: "Planning in
|
|
205
|
+
expect(stackComponent({ ...pdf, state: "planning" }).accessory).toMatchObject({ label: "Planning in thread", disabled: true });
|
|
206
206
|
expect(stackComponent({ ...pdf, plan: "update" }).accessory).toMatchObject({ label: "Update", custom_id: "arcane:stack:stirling-pdf" });
|
|
207
207
|
expect(parseArcaneButton("arcane:careful:stirling-pdf")).toEqual({ kind: "careful", stack: "stirling-pdf" });
|
|
208
208
|
expect(parseArcaneButton("arcane:careful:bad name")).toBeNull();
|
|
@@ -212,11 +212,11 @@ describe("Arcane report plans", () => {
|
|
|
212
212
|
const r = report();
|
|
213
213
|
entry(r, "media").plan = "auto";
|
|
214
214
|
entry(r, "vpn").plan = "auto";
|
|
215
|
-
expect(headText({ ...r, mention: ["178096425509453824"] }).content).toContain("\n-# 2 stacks update automatically
|
|
215
|
+
expect(headText({ ...r, mention: ["178096425509453824"] }).content).toContain("\n-# 2 stacks update automatically, rechecked 5 min later.");
|
|
216
216
|
expect(headText({ ...r, mention: ["178096425509453824"] }).content).not.toContain("<@");
|
|
217
217
|
entry(r, "stirling-pdf").plan = "careful";
|
|
218
218
|
entry(r, "postgres").plan = "update";
|
|
219
|
-
expect(headText({ ...r, mention: ["178096425509453824"] }).content).toContain("\n<@178096425509453824> 2 updates need you: postgres (major
|
|
219
|
+
expect(headText({ ...r, mention: ["178096425509453824"] }).content).toContain("\n<@178096425509453824> 2 updates need you: postgres (major), stirling-pdf (Upgrade carefully)");
|
|
220
220
|
});
|
|
221
221
|
|
|
222
222
|
it("asks the specialist for a plan and the owner's go before it applies anything", () => {
|
|
@@ -252,8 +252,8 @@ describe("Arcane report buttons and outcomes", () => {
|
|
|
252
252
|
|
|
253
253
|
it("maps each stack-update status to a state and a line", () => {
|
|
254
254
|
expect(stackOutcome({ status: "updated", services: [{ service: "sonarr", to: "4.0.20.3014-ls326" }] })).toEqual({ state: "updated", detail: "updated: sonarr 4.0.20.3014-ls326" });
|
|
255
|
-
expect(stackOutcome({ status: "nothing to do" })).toEqual({ state: "current", detail: "
|
|
256
|
-
expect(stackOutcome({ status: "rolled back", reason: "health: db (unhealthy)" })).toEqual({ state: "rolled back", detail: "rolled back: health: db (unhealthy);
|
|
255
|
+
expect(stackOutcome({ status: "nothing to do" })).toEqual({ state: "current", detail: "already current" });
|
|
256
|
+
expect(stackOutcome({ status: "rolled back", reason: "health: db (unhealthy)" })).toEqual({ state: "rolled back", detail: "rolled back: health: db (unhealthy); previous Compose file runs again" });
|
|
257
257
|
expect(stackOutcome({ status: "failed", reason: "projects redeploy exited 1" })).toEqual({ state: "failed", detail: "failed: projects redeploy exited 1" });
|
|
258
258
|
expect(stackOutcome({ status: "maybe" }).state).toBe("failed");
|
|
259
259
|
});
|
|
@@ -282,10 +282,10 @@ describe("Arcane report buttons and outcomes", () => {
|
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
it("summarises each outcome of manager-upgrade", () => {
|
|
285
|
-
expect(managerSummary({ status: "upgraded", from: "2.16.1", to: "2.17.0", digest: `sha256:${"a".repeat(64)}`, commit: "abcdef1234567", stamp: "20261019T060500Z" })).toMatch(/^✅ Arcane v2\.16\.1 → v2\.17\.0
|
|
285
|
+
expect(managerSummary({ status: "upgraded", from: "2.16.1", to: "2.17.0", digest: `sha256:${"a".repeat(64)}`, commit: "abcdef1234567", stamp: "20261019T060500Z" })).toMatch(/^✅ Arcane v2\.16\.1 → v2\.17\.0 running/);
|
|
286
286
|
expect(managerSummary({ status: "rolled back", from: "2.16.1", to: "2.17.0", reason: "version (\"2.16.1\")", stamp: "20261019T060500Z" })).toMatch(/^⚠️ Arcane v2\.17\.0 failed its checks/);
|
|
287
|
-
expect(managerSummary({ status: "stopped", from: "2.16.1", to: "2.17.0", reason: "sync timeout" })).toMatch(/^❌
|
|
288
|
-
expect(managerSummary({})).toMatch(/
|
|
287
|
+
expect(managerSummary({ status: "stopped", from: "2.16.1", to: "2.17.0", reason: "sync timeout" })).toMatch(/^❌ Arcane upgrade to v2\.17\.0 stopped before the restart: sync timeout/);
|
|
288
|
+
expect(managerSummary({})).toMatch(/Unexpected Arcane upgrade answer/);
|
|
289
289
|
});
|
|
290
290
|
});
|
|
291
291
|
|
|
@@ -222,7 +222,7 @@ export function serviceText(l: ServiceLine): string {
|
|
|
222
222
|
text = `${name}: check failed${l.note ? ` (${escapeDiscord(l.note.slice(0, 160))})` : ""}`;
|
|
223
223
|
} else if (!PENDING.has(l.status)) {
|
|
224
224
|
const newer = /newer major (\S+) available/.exec(l.note)?.[1] ?? "?";
|
|
225
|
-
text = `${name}: ${escapeDiscord(l.running ?? l.tag)},
|
|
225
|
+
text = `${name}: ${escapeDiscord(l.running ?? l.tag)}, major ${escapeDiscord(newer)} available (tag change by hand; Update skips it)`;
|
|
226
226
|
} else if (l.status === "rebuild") {
|
|
227
227
|
text = `${name}: rebuild of ${tag}`;
|
|
228
228
|
} else if (l.latest === null) {
|
|
@@ -235,9 +235,9 @@ export function serviceText(l: ServiceLine): string {
|
|
|
235
235
|
const kind = sameRelease ? `new build of ${tag}` : l.action === "edit tag" ? "new version (tag change)" : l.action === "edit digest" ? "new version (digest pin)" : "new version";
|
|
236
236
|
text = `${name}: ${escapeDiscord(from)} → ${escapeDiscord(l.latest)} · ${kind}`;
|
|
237
237
|
}
|
|
238
|
-
if (l.major) text += " · **major
|
|
238
|
+
if (l.major) text += " · **major**";
|
|
239
239
|
const newer = PENDING.has(l.status) ? /newer major (\S+) available/.exec(l.note)?.[1] : undefined;
|
|
240
|
-
if (newer) text += ` ·
|
|
240
|
+
if (newer) text += ` · major ${escapeDiscord(newer)} available`;
|
|
241
241
|
const review = l.review ? `\n-# ${l.review.verdict ? `${VERDICT_MARK[l.review.verdict]}: ` : "notes: "}${escapeDiscord(l.review.reason)}` : "";
|
|
242
242
|
const held = l.held ? `\n-# ⏸ held: ${escapeDiscord(l.held)}` : "";
|
|
243
243
|
return `• ${text}${review}${held}`;
|
|
@@ -295,15 +295,15 @@ export function parseArcaneButton(customId: string): ArcaneButton | null {
|
|
|
295
295
|
|
|
296
296
|
function stackButton(s: StackEntry): MessageComponent {
|
|
297
297
|
if (s.plan === "careful" && (s.state === "offered" || s.state === "planning")) {
|
|
298
|
-
return s.state === "planning" ? { type: 2, style: SECONDARY, label: "Planning in
|
|
298
|
+
return s.state === "planning" ? { type: 2, style: SECONDARY, label: "Planning in thread", custom_id: carefulId(s.stack), disabled: true } : { type: 2, style: DANGER, label: "Upgrade carefully", custom_id: carefulId(s.stack) };
|
|
299
299
|
}
|
|
300
300
|
const id = s.manager ? `arcane:manager:${s.manager}` : stackId(s.stack);
|
|
301
301
|
if (s.plan === "auto" && s.state === "offered") return { type: 2, style: SECONDARY, label: "Automatic", custom_id: id, disabled: true };
|
|
302
302
|
if (s.state === "running") return { type: 2, style: SECONDARY, label: s.manager ? `Upgrading Arcane to v${s.manager}…` : "Updating…", custom_id: id, disabled: true };
|
|
303
|
-
if (s.state === "updated") return { type: 2, style: SUCCESS, label: s.manager ? `Arcane v${s.manager}
|
|
303
|
+
if (s.state === "updated") return { type: 2, style: SUCCESS, label: s.manager ? `Arcane v${s.manager} running` : "Updated", custom_id: id, disabled: true };
|
|
304
304
|
if (s.state === "current") return { type: 2, style: SECONDARY, label: "Already current", custom_id: id, disabled: true };
|
|
305
305
|
if (s.state === "rolled back") return { type: 2, style: DANGER, label: "Rolled back", custom_id: id, disabled: true };
|
|
306
|
-
if (s.state === "failed") return s.manager ? { type: 2, style: DANGER, label: "Upgrade
|
|
306
|
+
if (s.state === "failed") return s.manager ? { type: 2, style: DANGER, label: "Upgrade incomplete", custom_id: id, disabled: true } : { type: 2, style: DANGER, label: "Retry", custom_id: id };
|
|
307
307
|
return { type: 2, style: PRIMARY, label: s.manager ? `Upgrade Arcane to v${s.manager}` : "Update", custom_id: id };
|
|
308
308
|
}
|
|
309
309
|
|
|
@@ -328,14 +328,14 @@ export function headText(report: ReportView): MessageComponent {
|
|
|
328
328
|
: `**${REPORT_PREFIX}** ${withUpdates} stack${withUpdates === 1 ? "" : "s"} with updates (${scope}).`;
|
|
329
329
|
const warning =
|
|
330
330
|
(report.holdsError ? `\n-# ⚠️ ${escapeDiscord(report.holdsError)}; Update still refuses held stacks` : "") +
|
|
331
|
-
(report.environmentErrors ?? []).map((e) => `\n-# ⚠️ environment ${escapeDiscord(e.environment)}
|
|
332
|
-
(report.agentsBehind ?? []).map((a) => `\n-# ⚠️
|
|
331
|
+
(report.environmentErrors ?? []).map((e) => `\n-# ⚠️ environment ${escapeDiscord(e.environment)} unchecked: ${escapeDiscord(e.error.slice(0, 200))}`).join("") +
|
|
332
|
+
(report.agentsBehind ?? []).map((a) => `\n-# ⚠️ Arcane agent of ${escapeDiscord(a.environment)} runs ${escapeDiscord(a.agent)}, manager ${escapeDiscord(a.manager)}`).join("");
|
|
333
333
|
const attention = report.stacks.filter((s) => s.plan === "update" || s.plan === "careful");
|
|
334
334
|
const automatic = report.stacks.filter((s) => s.plan === "auto").length;
|
|
335
|
-
const plan = automatic > 0 ? `\n-# ${automatic} stack${automatic === 1 ? " updates" : "s update"} automatically
|
|
335
|
+
const plan = automatic > 0 ? `\n-# ${automatic} stack${automatic === 1 ? " updates" : "s update"} automatically, rechecked 5 min later.` : "";
|
|
336
336
|
const needs =
|
|
337
337
|
attention.length > 0 && report.mention && report.mention.length > 0
|
|
338
|
-
? `\n${report.mention.map((id) => `<@${id}>`).join(" ")} ${attention.length} update${attention.length === 1 ? " needs" : "s need"} you: ${attention.map((s) => `${escapeDiscord(s.stack)} (${s.plan === "careful" ? "Upgrade carefully" : "major
|
|
338
|
+
? `\n${report.mention.map((id) => `<@${id}>`).join(" ")} ${attention.length} update${attention.length === 1 ? " needs" : "s need"} you: ${attention.map((s) => `${escapeDiscord(s.stack)} (${s.plan === "careful" ? "Upgrade carefully" : "major"})`).join(", ")}`
|
|
339
339
|
: "";
|
|
340
340
|
return { type: 10, content: `${head}${warning}${plan}${needs}` };
|
|
341
341
|
}
|
|
@@ -380,7 +380,7 @@ export function layoutMessages(report: ReportView): Omit<PostedPage, "id">[] {
|
|
|
380
380
|
|
|
381
381
|
/** Sent when the check itself fails: no list, so nothing reads as up to date. */
|
|
382
382
|
export function failureMessage(): string {
|
|
383
|
-
return `${REPORT_PREFIX}
|
|
383
|
+
return `${REPORT_PREFIX} version check failed, no update list today. Reason in the bridge log on Cortex.`;
|
|
384
384
|
}
|
|
385
385
|
|
|
386
386
|
/** The stack's state after `stack-update`, from its JSON answer, and one line for the report. */
|
|
@@ -390,10 +390,10 @@ export function stackOutcome(out: Record<string, unknown>): { state: StackState;
|
|
|
390
390
|
const services = Array.isArray(out.services) ? (out.services as { service?: unknown; to?: unknown }[]) : [];
|
|
391
391
|
const moved = services.map((s) => `${String(s.service)} ${String(s.to)}`).join(", ");
|
|
392
392
|
if (out.status === "updated") return { state: "updated", detail: `updated: ${moved || "every service"}`, ...commit };
|
|
393
|
-
if (out.status === "nothing to do") return { state: "current", detail: "
|
|
394
|
-
if (out.status === "rolled back") return { state: "rolled back", detail: `rolled back: ${reason || "a check failed"};
|
|
393
|
+
if (out.status === "nothing to do") return { state: "current", detail: "already current" };
|
|
394
|
+
if (out.status === "rolled back") return { state: "rolled back", detail: `rolled back: ${reason || "a check failed"}; previous Compose file runs again` };
|
|
395
395
|
if (out.status === "failed") return { state: "failed", detail: `failed: ${reason || "no reason given"}` };
|
|
396
|
-
return { state: "failed", detail: "
|
|
396
|
+
return { state: "failed", detail: "unexpected answer; check the stack with the arcane specialist" };
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
function short(value: unknown): string {
|
|
@@ -407,13 +407,13 @@ export function managerSummary(out: Record<string, unknown>): string {
|
|
|
407
407
|
const reason = typeof out.reason === "string" ? out.reason.slice(0, 400) : "no reason given";
|
|
408
408
|
const backup = (out.backup as { archive?: unknown; stamp?: unknown } | undefined)?.stamp;
|
|
409
409
|
if (out.status === "upgraded") {
|
|
410
|
-
return `✅ Arcane ${from} → ${to}
|
|
410
|
+
return `✅ Arcane ${from} → ${to} running (digest ${short(out.digest)}, pin commit ${short(out.commit)}). All checks passed; other containers kept running. Cold backup: /var/backups/arcane-upgrades/${typeof backup === "string" ? backup : String(out.stamp)}.`;
|
|
411
411
|
}
|
|
412
412
|
if (out.status === "rolled back") {
|
|
413
|
-
return `⚠️ Arcane ${to} failed its checks (${reason}). ${from} runs again
|
|
413
|
+
return `⚠️ Arcane ${to} failed its checks (${reason}). ${from} runs again; pin reverted in git. If ${to} migrated the database, restore the pre-upgrade data from /var/backups/arcane-upgrades/${String(out.stamp)} by hand (arcane/AGENTS.md, Upgrade rollback).`;
|
|
414
414
|
}
|
|
415
|
-
if (out.status === "stopped") return `❌
|
|
416
|
-
return `❌
|
|
415
|
+
if (out.status === "stopped") return `❌ Arcane upgrade to ${to} stopped before the restart: ${reason}. Pin reverted; ${from} keeps running.`;
|
|
416
|
+
return `❌ Unexpected Arcane upgrade answer; check the manager with the arcane specialist before retrying.`;
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
type StackNotes = { notes: Pick<ReleaseNote, "tag" | "published" | "notes">[]; omitted: string[] } | { notes: null; reason: string };
|
|
@@ -426,8 +426,8 @@ function isNote(value: unknown): value is Pick<ReleaseNote, "tag" | "published"
|
|
|
426
426
|
/** The releases from the wrapper's `release-notes <stack>/<service>` answer, or why there are none to review. */
|
|
427
427
|
export function releaseNotesFromJson(value: unknown): StackNotes {
|
|
428
428
|
const r = value as { releases?: unknown; omitted?: unknown; reason?: unknown } | null;
|
|
429
|
-
if (!r || typeof r !== "object" || !Array.isArray(r.releases) || !r.releases.every(isNote)) return { notes: null, reason: "release-notes
|
|
430
|
-
if (r.releases.length === 0) return { notes: null, reason: typeof r.reason === "string" && r.reason.length > 0 ? r.reason.slice(0, 160) : "
|
|
429
|
+
if (!r || typeof r !== "object" || !Array.isArray(r.releases) || !r.releases.every(isNote)) return { notes: null, reason: "unexpected release-notes answer" };
|
|
430
|
+
if (r.releases.length === 0) return { notes: null, reason: typeof r.reason === "string" && r.reason.length > 0 ? r.reason.slice(0, 160) : "none found" };
|
|
431
431
|
const omitted = Array.isArray(r.omitted) ? r.omitted.filter((o): o is string => typeof o === "string") : [];
|
|
432
432
|
return { notes: r.releases, omitted };
|
|
433
433
|
}
|
|
@@ -57,9 +57,9 @@ describe("morning status lines", () => {
|
|
|
57
57
|
|
|
58
58
|
it("summarises the front door and flags a down unit or a stale tunnel", () => {
|
|
59
59
|
expect(edgeStatus(EDGE, UPDATES)).toEqual({ area: "Edge", line: "front door: 5 services active, WireGuard 21s ago, no reboot pending, 3 upgradable packages" });
|
|
60
|
-
expect(edgeStatus(EDGE.replace("nginx active", "nginx failed"), UPDATES).problem).toBe("Edge: nginx
|
|
61
|
-
expect(edgeStatus(EDGE.replace("21s ago", "9m ago"), null)).toMatchObject({ problem: "Edge:
|
|
62
|
-
expect(edgeStatus(null, null)).toMatchObject({ line: "the check failed (vps status)", problem: "Edge:
|
|
60
|
+
expect(edgeStatus(EDGE.replace("nginx active", "nginx failed"), UPDATES).problem).toBe("Edge: nginx down on the front door");
|
|
61
|
+
expect(edgeStatus(EDGE.replace("21s ago", "9m ago"), null)).toMatchObject({ problem: "Edge: WireGuard handshake 9m ago", route: "admin" });
|
|
62
|
+
expect(edgeStatus(null, null)).toMatchObject({ line: "the check failed (vps status)", problem: "Edge: `vps status` failed" });
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it("reports both Proxmox hosts, the morning upgrade, a held major, and a pending reboot with its button", () => {
|
|
@@ -70,12 +70,12 @@ describe("morning status lines", () => {
|
|
|
70
70
|
{ name: "SPACE-X", id: "space-x", status: null, updates: null },
|
|
71
71
|
]);
|
|
72
72
|
expect(upgraded.line).toBe("Pulsar up 59 days, RAM 47Gi of 60Gi used, root disk 13%, 3 host updates installed, reboot needed; SPACE-X status unknown");
|
|
73
|
-
expect(upgraded.problem).toBe("Proxmox: Pulsar
|
|
73
|
+
expect(upgraded.problem).toBe("Proxmox: Pulsar: reboot needed (kernel 7.0.14-25-pve -> 7.0.14-26-pve); its guests stop for a few minutes; the status check failed for SPACE-X");
|
|
74
74
|
expect(upgraded.buttons).toEqual([{ label: "Reboot Pulsar", customId: "proxmox:reboot:pulsar" }]);
|
|
75
75
|
const major = proxmoxStatus([{ name: "SPACE-X", id: "space-x", status: `${PULSAR}\nreboot-needed: no`, updates: PULSAR_UPDATES, upgrade: "held: Proxmox VE 9.2.24 -> 10.0.1 is a major upgrade" }]);
|
|
76
|
-
expect(major).toMatchObject({ problem: "Proxmox: SPACE-X
|
|
76
|
+
expect(major).toMatchObject({ problem: "Proxmox: SPACE-X: Proxmox VE 9.2.24 -> 10.0.1 is a major upgrade, held for you", route: "admin" });
|
|
77
77
|
expect(major.line).toContain("a Proxmox VE major upgrade waits for you");
|
|
78
|
-
expect(proxmoxStatus([{ name: "Pulsar", id: "pulsar", status: PULSAR, updates: PULSAR_UPDATES, upgrade: null }]).problem).toBe("Proxmox:
|
|
78
|
+
expect(proxmoxStatus([{ name: "Pulsar", id: "pulsar", status: PULSAR, updates: PULSAR_UPDATES, upgrade: null }]).problem).toBe("Proxmox: Pulsar: host upgrade failed");
|
|
79
79
|
});
|
|
80
80
|
|
|
81
81
|
it("flags updates the nightly run left behind, reading guest-agent JSON too, and announces a Wazuh release from the held agent", () => {
|
|
@@ -84,17 +84,21 @@ describe("morning status lines", () => {
|
|
|
84
84
|
const held = "Listing...\nwazuh-agent/stable 4.14.10-1 amd64 [upgradable from: 4.14.9-1]";
|
|
85
85
|
expect(wazuhRelease({ arcane: vm, synapse: held, radius: null })).toEqual({ from: "4.14.9", to: "4.14.10" });
|
|
86
86
|
expect(wazuhRelease({ synapse: "Listing..." })).toBeNull();
|
|
87
|
-
expect(updatesStatus({ synapse: "Listing..." })).toEqual({ area: "Updates", line: "1 host up to date after the nightly run" });
|
|
88
|
-
const wazuh = updatesStatus({ technitium2: held, synapse: "Listing..." });
|
|
87
|
+
expect(updatesStatus({ synapse: "Listing..." })).toEqual([{ area: "Updates", line: "1 host up to date after the nightly run" }]);
|
|
88
|
+
const [wazuh] = updatesStatus({ technitium2: held, synapse: "Listing..." });
|
|
89
89
|
expect(wazuh.line).toBe("2 hosts up to date after the nightly run; Wazuh 4.14.10 is out (agents held at 4.14.9)");
|
|
90
|
-
expect(wazuh
|
|
90
|
+
expect(wazuh).toMatchObject({ problem: "Updates: Wazuh 4.14.10 is out (agents on 4.14.9). Claude Code on the Mac upgrades the manager first, then the agents", specialist: null });
|
|
91
91
|
const left = updatesStatus({ arcane: vm, radius: null });
|
|
92
|
-
expect(left).
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
expect(left
|
|
92
|
+
expect(left.map((a) => [a.specialist, a.items?.map((i) => i.text)])).toEqual([
|
|
93
|
+
["arcane", ["arcane: docker-ce did not install"]],
|
|
94
|
+
["network", ["radius: no update list"]],
|
|
95
|
+
[null, ["Wazuh 4.14.9 is out (agents on 4.14.7). Claude Code on the Mac upgrades the manager first, then the agents"]],
|
|
96
|
+
]);
|
|
97
|
+
expect(left[0]).toMatchObject({ line: "still waiting after the nightly run: arcane 1; no update list from radius; Wazuh 4.14.9 is out (agents held at 4.14.7)", route: "admin" });
|
|
98
|
+
const synapse = "Listing...\nlibcamera-ipa/stable 0.8.0+rpt20261104-1 arm64 [upgradable from: 0.7.2+rpt20261009-1]\nrpicam-apps-core/stable 1.15.0-1 arm64 [upgradable from: 1.14.0-1]\nnew: libcamera0.8\nremove: libcamera0.7";
|
|
99
|
+
expect(updatesStatus({ synapse })).toMatchObject([
|
|
100
|
+
{ problem: "Updates: synapse: libcamera-ipa, rpicam-apps-core kept back. Fix by hand: `apt-get full-upgrade` (adds libcamera0.8, removes libcamera0.7)", specialist: "dns" },
|
|
101
|
+
]);
|
|
98
102
|
expect(["dmz", "observability", "backup", "tailscale-mira (Mira)", "technitium3 (Mira)", "synapse", "hermes", "Pulsar guests"].map(guestOwner)).toEqual(["Identity", "Security", "Backup", "Network", "DNS", "DNS", "Proxmox", "Proxmox"]);
|
|
99
103
|
});
|
|
100
104
|
|
|
@@ -102,14 +106,14 @@ describe("morning status lines", () => {
|
|
|
102
106
|
expect(networkStatus(RADIUS, TAILSCALE)).toEqual({ area: "Network", line: "RADIUS running, Tailscale router tailscale-37 online" });
|
|
103
107
|
const both = `${TAILSCALE}\n100.95.12.39 astro-mb-m5-2 astronaute@ macOS offline, last seen 15h ago\n100.106.244.101 tailscale-mira astronaute@ linux -`;
|
|
104
108
|
expect(networkStatus(RADIUS, both)).toEqual({ area: "Network", line: "RADIUS running, Tailscale routers tailscale-37 and tailscale-mira online" });
|
|
105
|
-
expect(networkStatus(RADIUS, both.replace("tailscale-mira astronaute@ linux -", "tailscale-mira astronaute@ linux offline, last seen 2h ago"))).toMatchObject({ line: "RADIUS running, Tailscale offline: tailscale-mira", problem: "Network:
|
|
106
|
-
expect(networkStatus(RADIUS.replace("active (running)", "failed (Result: exit-code)"), "100.121.19.2 tailscale-37 astronaute@ linux offline, last seen 1h ago")).toMatchObject({ problem: "Network: FreeRADIUS
|
|
107
|
-
expect(networkStatus(null, TAILSCALE).problem).toBe("Network:
|
|
109
|
+
expect(networkStatus(RADIUS, both.replace("tailscale-mira astronaute@ linux -", "tailscale-mira astronaute@ linux offline, last seen 2h ago"))).toMatchObject({ line: "RADIUS running, Tailscale offline: tailscale-mira", problem: "Network: Tailscale router tailscale-mira offline" });
|
|
110
|
+
expect(networkStatus(RADIUS.replace("active (running)", "failed (Result: exit-code)"), "100.121.19.2 tailscale-37 astronaute@ linux offline, last seen 1h ago")).toMatchObject({ problem: "Network: FreeRADIUS down; Tailscale router tailscale-37 offline" });
|
|
111
|
+
expect(networkStatus(null, TAILSCALE).problem).toBe("Network: `pulsar radius-status` failed");
|
|
108
112
|
});
|
|
109
113
|
|
|
110
114
|
it("lists the DMZ units and flags one that is not active", () => {
|
|
111
115
|
expect(identityStatus(DMZ)).toEqual({ area: "Identity", line: "pomerium, nginx, lego-renew.timer active" });
|
|
112
|
-
expect(identityStatus(DMZ.replace("Active: active (running) since Thu 2026-09-24 17:21:24 CEST; 4 weeks 0 days ago\n● nginx", "Active: failed (Result: signal)\n● nginx")).problem).toBe("Identity: pomerium.service failed
|
|
116
|
+
expect(identityStatus(DMZ.replace("Active: active (running) since Thu 2026-09-24 17:21:24 CEST; 4 weeks 0 days ago\n● nginx", "Active: failed (Result: signal)\n● nginx")).problem).toBe("Identity: DMZ: pomerium.service failed");
|
|
113
117
|
});
|
|
114
118
|
|
|
115
119
|
it("offers an owner button when a newer Pomerium release is out", () => {
|
|
@@ -117,7 +121,7 @@ describe("morning status lines", () => {
|
|
|
117
121
|
expect(identityStatus(DMZ, { installed: "v0.33.6", newest: "v0.33.6", update: false, notes })).toEqual({ area: "Identity", line: "pomerium, nginx, lego-renew.timer active; Pomerium v0.33.6" });
|
|
118
122
|
const newer = identityStatus(DMZ, { installed: "v0.33.1", newest: "v0.33.6", update: true, notes });
|
|
119
123
|
expect(newer.line).toBe("pomerium, nginx, lego-renew.timer active; Pomerium v0.33.1, v0.33.6 available");
|
|
120
|
-
expect(newer.problem).toContain(`Pomerium v0.33.
|
|
124
|
+
expect(newer.problem).toContain(`Pomerium v0.33.1 → v0.33.6 (notes: <${notes}>)`);
|
|
121
125
|
expect(newer.buttons).toEqual([{ label: "Update Pomerium to v0.33.6", customId: pomeriumButtonId("v0.33.6") }]);
|
|
122
126
|
expect(newer.once).toBe("pomerium:v0.33.6");
|
|
123
127
|
const failedUnit = DMZ.replace("Active: active (running) since Thu 2026-09-24 17:21:24 CEST; 4 weeks 0 days ago\n● nginx", "Active: failed (Result: signal)\n● nginx");
|
|
@@ -127,28 +131,29 @@ describe("morning status lines", () => {
|
|
|
127
131
|
|
|
128
132
|
it("checks both resolvers, Nexus, and SABnzbd", () => {
|
|
129
133
|
expect(dnsStatus({ technitium1: { status: "ok" }, technitium2: { status: "ok" }, technitium3: { status: "ok" } })).toEqual({ area: "DNS", line: "technitium1, technitium2, technitium3 answer" });
|
|
130
|
-
expect(dnsStatus({ technitium1: { status: "ok" }, technitium2: null, technitium3: { status: "ok" } })).toEqual({ area: "DNS", line: "no answer from technitium2", problem: "DNS: technitium2
|
|
131
|
-
expect(dnsStatus({ technitium1: null, technitium2: { status: "error" }, technitium3: { status: "ok" } })).toMatchObject({ problem: "DNS: technitium1 and technitium2
|
|
134
|
+
expect(dnsStatus({ technitium1: { status: "ok" }, technitium2: null, technitium3: { status: "ok" } })).toEqual({ area: "DNS", line: "no answer from technitium2", problem: "DNS: technitium2 not answering", route: "admin" });
|
|
135
|
+
expect(dnsStatus({ technitium1: null, technitium2: { status: "error" }, technitium3: { status: "ok" } })).toMatchObject({ problem: "DNS: technitium1 and technitium2 not answering" });
|
|
132
136
|
});
|
|
133
137
|
|
|
134
138
|
it("flags any newer macOS of the installed major for its owner and notes a major without flagging it", () => {
|
|
135
139
|
const nexus = "26.7.2\nTitle: Command Line Tools for Xcode 26.6, Version: 26.6, Size: 920431KiB, Recommended: YES,\nTitle: Safari, Version: 27.2, Size: 250130KiB, Recommended: YES,\nTitle: macOS 27.2.1, Version: 27.2.1, Size: 17362949KiB, Recommended: YES, Action: restart,";
|
|
136
|
-
const cortex = "26.7.2\nTitle: macOS Tahoe 26.7.3, Version: 26.7.3, Size: 2506663KiB, Recommended: YES, Action: restart,\nTitle: macOS 27.2.1, Version: 27.2.1, Size: 17362949KiB, Recommended: YES, Action: restart,";
|
|
140
|
+
const cortex = "26.7.2\n* Label: macOS Tahoe 26.7.3-25H45\nTitle: macOS Tahoe 26.7.3, Version: 26.7.3, Size: 2506663KiB, Recommended: YES, Action: restart,\n* Label: macOS 27.2.1-26B131\nTitle: macOS 27.2.1, Version: 27.2.1, Size: 17362949KiB, Recommended: YES, Action: restart,";
|
|
137
141
|
expect(macosStatus([{ name: "Nexus", output: nexus }])).toEqual({ area: "macOS", line: "Nexus 26.7.2, macOS 27.2.1 offered (major, by hand)" });
|
|
138
|
-
const waiting =
|
|
142
|
+
const waiting = 'Cortex macOS 26.7.2 → 26.7.3. On Cortex: `sudo softwareupdate -i "macOS Tahoe 26.7.3-25H45" -R --user cortex` (restarts it)';
|
|
143
|
+
const nexusWaiting = 'Nexus macOS 26.7.2 → 26.7.3. On Nexus: `sudo softwareupdate -i "macOS Tahoe 26.7.3" -R --user astronaute` (restarts it)';
|
|
139
144
|
expect(macosStatus([{ name: "Cortex", output: cortex }, { name: "Nexus", output: nexus.replace("Title: Safari", "Title: macOS Tahoe 26.7.3, Version: 26.7.3, Size: 1KiB,\nTitle: Safari") }])).toEqual({
|
|
140
145
|
area: "macOS",
|
|
141
146
|
line: "Cortex 26.7.2, 26.7.3 waiting, macOS 27.2.1 offered (major, by hand); Nexus 26.7.2, 26.7.3 waiting, macOS 27.2.1 offered (major, by hand)",
|
|
142
|
-
problem: `macOS: ${waiting}; ${
|
|
147
|
+
problem: `macOS: ${waiting}; ${nexusWaiting}`,
|
|
143
148
|
items: [
|
|
144
149
|
{ owner: "Cortex", text: waiting },
|
|
145
|
-
{ owner: "Inference", text:
|
|
150
|
+
{ owner: "Inference", text: nexusWaiting },
|
|
146
151
|
],
|
|
147
152
|
route: "admin",
|
|
148
153
|
once: "macos:Cortex:26.7.3,Nexus:26.7.3",
|
|
149
154
|
});
|
|
150
155
|
const unknown = macosStatus([{ name: "Cortex", output: cortex }, { name: "Nexus", output: null }]);
|
|
151
|
-
expect(unknown.items?.at(-1)).toEqual({ owner: "Inference", text: "no macOS update list
|
|
156
|
+
expect(unknown.items?.at(-1)).toEqual({ owner: "Inference", text: "Nexus: no macOS update list" });
|
|
152
157
|
expect(unknown.once).toBeUndefined();
|
|
153
158
|
expect(macosStatus([{ name: "Cortex", output: "26.7.2" }]).line).toBe("Cortex 26.7.2");
|
|
154
159
|
});
|
|
@@ -163,10 +168,10 @@ describe("morning status lines", () => {
|
|
|
163
168
|
expect(technitiumPlan(update("16.0.0"), state(["15.6.2", "15.6.2", "15.6.2"]))).toEqual({ major: true, from: "15.6.2", to: "16.0.0" });
|
|
164
169
|
const all = { technitium1: { status: "ok" }, technitium2: { status: "ok" }, technitium3: { status: "ok" } };
|
|
165
170
|
expect(dnsStatus(all, { host: "technitium3", from: "15.6.2", to: "15.7.0", ok: true })).toEqual({ area: "DNS", line: "technitium1, technitium2, technitium3 answer; technitium3 upgraded 15.6.2 -> 15.7.0 (one node per morning, primary last)" });
|
|
166
|
-
expect(dnsStatus(all, { host: "technitium3", from: "15.6.2", to: "15.7.0", ok: false, why: "installer exited 1" }).problem).toBe("DNS:
|
|
167
|
-
expect(dnsStatus(all, { major: true, from: "15.6.2", to: "16.0.0" }).problem).toMatch(/^DNS: Technitium 16
|
|
171
|
+
expect(dnsStatus(all, { host: "technitium3", from: "15.6.2", to: "15.7.0", ok: false, why: "installer exited 1" }).problem).toBe("DNS: technitium3: upgrade to 15.7.0 failed (installer exited 1)");
|
|
172
|
+
expect(dnsStatus(all, { major: true, from: "15.6.2", to: "16.0.0" }).problem).toMatch(/^DNS: Technitium 15\.6\.2 → 16\.0\.0 is a major release: read its change log/);
|
|
168
173
|
expect(inferenceStatus("embed \tstate = running \tpid = 80042 health=200\nrerank \tstate = running \tpid = 81670 health=200")).toEqual({ area: "Inference", line: "Nexus embed, rerank running and healthy" });
|
|
169
|
-
expect(inferenceStatus("embed \tstate = running \tpid = 80042 health=503")).toMatchObject({ problem: "Inference: embed
|
|
174
|
+
expect(inferenceStatus("embed \tstate = running \tpid = 80042 health=503")).toMatchObject({ problem: "Inference: embed unhealthy on Nexus" });
|
|
170
175
|
expect(homeStatus({ problems: [], unavailable: 3, version: "2026.11.1" })).toEqual({ area: "Home", line: "Home Assistant 2026.11.1, nothing to do, 3 entities unavailable" });
|
|
171
176
|
expect(homeStatus({ problems: ["1 update waits: Home Assistant Core 2026.11.1 → 2026.11.2", "the Nest integration (nest) did not load: setup_retry"], unavailable: 1, version: "2026.11.1" })).toEqual({
|
|
172
177
|
area: "Home",
|
|
@@ -178,18 +183,18 @@ describe("morning status lines", () => {
|
|
|
178
183
|
],
|
|
179
184
|
once: "home:1 update waits: Home Assistant Core 2026.11.1 → 2026.11.2|the Nest integration (nest) did not load: setup_retry",
|
|
180
185
|
});
|
|
181
|
-
expect(homeStatus(null)).toMatchObject({ area: "Home", problem: "Home:
|
|
186
|
+
expect(homeStatus(null)).toMatchObject({ area: "Home", problem: "Home: `problems` failed" });
|
|
182
187
|
const empty = { records: [], warnings: [] };
|
|
183
188
|
expect(mediaStatus({ sabnzbd_paused: true, warnings: [] }, empty, NOW)).toEqual({ area: "Media", line: "downloads paused" });
|
|
184
|
-
expect(mediaStatus({ sabnzbd_paused: false, warnings: [{ text: "login failed" }] }, empty, NOW)).toMatchObject({ line: "downloads running, 1 warning", problem: "Media:
|
|
185
|
-
expect(mediaStatus({ sabnzbd_paused: false, warnings: [] }, null, NOW)).toMatchObject({ line: "downloads running, import queue unknown", problem: "Media:
|
|
186
|
-
expect(mediaStatus({ sabnzbd_paused: false, warnings: [] }, { records: [], warnings: ["sonarr: sonarr answered 401 to GET /api/v3/queue"] }, NOW)).toMatchObject({ problem: "Media:
|
|
189
|
+
expect(mediaStatus({ sabnzbd_paused: false, warnings: [{ text: "login failed" }] }, empty, NOW)).toMatchObject({ line: "downloads running, 1 warning", problem: "Media: SABnzbd: 1 warning", route: "media" });
|
|
190
|
+
expect(mediaStatus({ sabnzbd_paused: false, warnings: [] }, null, NOW)).toMatchObject({ line: "downloads running, import queue unknown", problem: "Media: `queue` failed" });
|
|
191
|
+
expect(mediaStatus({ sabnzbd_paused: false, warnings: [] }, { records: [], warnings: ["sonarr: sonarr answered 401 to GET /api/v3/queue"] }, NOW)).toMatchObject({ problem: "Media: sonarr queue unreadable", route: "media" });
|
|
187
192
|
});
|
|
188
193
|
|
|
189
194
|
it("names imports that wait in the queue for more than a day, and tags them once", () => {
|
|
190
195
|
const record = (id: number, added: string) => ({ app: "radarr", id, title: "Primetime.2026.REPACK.2160p", state: "importPending", status: "warning", messages: ["Not a Custom Format upgrade for existing movie file(s)."], added, size: 13406787332 });
|
|
191
196
|
const queue = { records: [record(7, "2026-10-22T16:03:52Z"), record(8, "2026-10-23T20:00:00Z")], warnings: [] };
|
|
192
|
-
const item = "Primetime.2026.REPACK.2160p (radarr)
|
|
197
|
+
const item = "Primetime.2026.REPACK.2160p (radarr) stuck since 2026-10-22: Not a Custom Format upgrade for existing movie file(s). Reply \"remove\" to delete it (`queue-remove radarr 7`)";
|
|
193
198
|
expect(mediaStatus({ sabnzbd_paused: false, warnings: [] }, queue, NOW)).toEqual({
|
|
194
199
|
area: "Media",
|
|
195
200
|
line: "downloads running, 1 import stuck",
|
|
@@ -208,7 +213,7 @@ describe("morning status lines", () => {
|
|
|
208
213
|
];
|
|
209
214
|
const restic = "Result=success\nExecMainStartTimestamp=Sun 2026-10-18 04:00:24 CEST";
|
|
210
215
|
expect(backupStatus(archives.slice(0, 1), restic, NOW)).toEqual({ area: "Backup", line: "the only guest backed up last night, restic check success 18 Oct 04:00" });
|
|
211
|
-
expect(backupStatus(archives, restic.replace("success", "exit-code"), NOW)).toMatchObject({ problem: "Backup: no
|
|
216
|
+
expect(backupStatus(archives, restic.replace("success", "exit-code"), NOW)).toMatchObject({ problem: "Backup: no backup last night: identity; restic check: exit-code", route: "admin" });
|
|
212
217
|
});
|
|
213
218
|
});
|
|
214
219
|
|
|
@@ -221,22 +226,22 @@ describe("morning summary", () => {
|
|
|
221
226
|
reports: [
|
|
222
227
|
{ area: "Security", line: "quiet day", needs: [], channelId: "21", messageId: "31" },
|
|
223
228
|
{ area: "Cortex tools", line: "1 updated", needs: [], channelId: "23", messageId: "33" },
|
|
224
|
-
{ area: "Arcane", line: "3 stacks updated", needs: ["stirling-pdf waits for you (major
|
|
229
|
+
{ area: "Arcane", line: "3 stacks updated", needs: ["stirling-pdf waits for you (major)"], channelId: "22", messageId: "32" },
|
|
225
230
|
],
|
|
226
231
|
areas: [
|
|
227
232
|
{ area: "DNS", line: "both resolvers answer" },
|
|
228
|
-
{ area: "Backup", line: "no backup last night for identity", problem: "Backup: no
|
|
233
|
+
{ area: "Backup", line: "no backup last night for identity", problem: "Backup: no backup last night: identity", route: "admin", messageId: "41" },
|
|
229
234
|
{ area: "macOS", line: "Cortex 26.7.2" },
|
|
230
|
-
{ area: "Updates", line: "x", problem: "Updates:
|
|
235
|
+
{ area: "Updates", line: "x", problem: "Updates: synapse: libcamera-ipa kept back. Fix by hand: `apt-get full-upgrade` (adds libcamera0.8)", items: [{ owner: "DNS", text: "synapse: libcamera-ipa kept back. Fix by hand: `apt-get full-upgrade` (adds libcamera0.8)" }], route: "admin" },
|
|
231
236
|
],
|
|
232
237
|
});
|
|
233
238
|
expect(text).toBe(
|
|
234
239
|
[
|
|
235
240
|
"**Daily** · Fri 24 Oct · 🟠 3 items need you",
|
|
236
|
-
"Arcane · stirling-pdf waits for you (major
|
|
237
|
-
"
|
|
238
|
-
"
|
|
239
|
-
"All clear: Security, Cortex, Proxmox
|
|
241
|
+
"Arcane · stirling-pdf waits for you (major) ([report](https://discord.com/channels/1/22/32))",
|
|
242
|
+
"Backup · no backup last night: identity ([message](https://discord.com/channels/1/11/41))",
|
|
243
|
+
"DNS · synapse: libcamera-ipa kept back. Fix by hand: `apt-get full-upgrade` (adds libcamera0.8) (<#11>)",
|
|
244
|
+
"All clear: Security, Cortex, Proxmox",
|
|
240
245
|
].join("\n"),
|
|
241
246
|
);
|
|
242
247
|
expect(text).not.toContain("<@");
|
|
@@ -253,20 +258,23 @@ describe("morning summary", () => {
|
|
|
253
258
|
});
|
|
254
259
|
|
|
255
260
|
it("tags the owners for an area's problem in its channel", () => {
|
|
256
|
-
expect(problemText({ area: "Backup", line: "x", problem: "Backup:
|
|
257
|
-
"⚠️ **Backup** · Backup: the restic check ended with exit-code\nFound by the morning run; the backup specialist can look into it here.\n<@178096425509453824>",
|
|
258
|
-
);
|
|
261
|
+
expect(problemText({ area: "Backup", line: "x", problem: "Backup: restic check: exit-code", route: "admin" }, ["178096425509453824"])).toBe("⚠️ **Backup** · restic check: exit-code\nReplies go to the backup specialist.\n<@178096425509453824>");
|
|
259
262
|
});
|
|
260
263
|
|
|
261
|
-
it("names the specialist that
|
|
262
|
-
expect(problemText({ area: "Updates", line: "x", problem: "Updates: no update list
|
|
263
|
-
|
|
264
|
+
it("names the specialist that answers replies, the owner's for updates, none for macOS, and keeps commands as code", () => {
|
|
265
|
+
expect(problemText({ area: "Updates", line: "x", problem: "Updates: radius: no update list" }, ["1"])).toBe("⚠️ **Updates** · radius: no update list\nReplies go to the proxmox specialist.\n<@1>");
|
|
266
|
+
const [synapse] = updatesStatus({ synapse: "libcamera-ipa/stable 0.8.0 arm64 [upgradable from: 0.7.2]\nnew: libcamera0.8" });
|
|
267
|
+
expect(problemText(synapse, ["1"])).toBe("⚠️ **Updates** · synapse: libcamera-ipa kept back. Fix by hand: `apt-get full-upgrade` (adds libcamera0.8)\nReplies go to the dns specialist.\n<@1>");
|
|
268
|
+
const two = { area: "Home", line: "x", problem: "Home: a; b", items: [{ owner: "Home", text: "no_current_backup" }, { owner: "Home", text: "b" }] };
|
|
269
|
+
expect(problemText(two, ["1"])).toBe("⚠️ **Home**\n- no\\_current\\_backup\n- b\nReplies go to the home specialist.\n<@1>");
|
|
270
|
+
expect(problemText({ area: "macOS", line: "x", problem: "macOS: Nexus: no macOS update list" }, ["1"])).toBe("⚠️ **macOS** · Nexus: no macOS update list\n<@1>");
|
|
264
271
|
});
|
|
265
272
|
|
|
266
|
-
it("reads back the specialist a problem names, also after a button note", () => {
|
|
267
|
-
const text = problemText({ area: "Updates", line: "x", problem: "Updates: no update list
|
|
273
|
+
it("reads back the specialist a problem names, in both message formats, also after a button note", () => {
|
|
274
|
+
const text = problemText({ area: "Updates", line: "x", problem: "Updates: radius: no update list" }, ["1"]);
|
|
268
275
|
expect(problemSpecialist(text)).toBe("proxmox");
|
|
269
276
|
expect(problemSpecialist(`${text}\n♻️ SPACE-X reboots in one minute, started by <@1>; its guests restart with it.`)).toBe("proxmox");
|
|
277
|
+
expect(problemSpecialist("⚠️ **Updates** · x\nFound by the morning run; the proxmox specialist can look into it here.\n<@1>")).toBe("proxmox");
|
|
270
278
|
expect(problemSpecialist(problemText({ area: "macOS", line: "x", problem: "macOS: x" }, ["1"]))).toBeNull();
|
|
271
279
|
expect(problemSpecialist("Several specialists live here")).toBeNull();
|
|
272
280
|
});
|
|
@@ -276,15 +284,15 @@ describe("report summaries", () => {
|
|
|
276
284
|
const tool = (over: Partial<ToolsReport["lines"][number]>): ToolsReport["lines"][number] => ({ key: "brew:jq", label: "jq", installed: "1.8.1", latest: "1.8.2", major: false, action: { kind: "brew", name: "jq" }, state: "offered", ...over }) as ToolsReport["lines"][number];
|
|
277
285
|
|
|
278
286
|
it("says what the tools report updated, what failed, and what waits for a button", () => {
|
|
279
|
-
const report = { date: "2026-10-24", lines: [tool({ state: "updated", plan: "auto" }), tool({ key: "brew:herdr", label: "herdr", latest: "0.10.0", state: "failed", plan: "auto" }), tool({ key: "pi", label: "Pi", latest: "1.4.0", plan: "button" }), tool({ key: "spc:node", label: "Node", latest: "26.1.0", major: true, plan: "update" }), tool({ key: "cask:temurin@17", label: "temurin@17", latest: "17.0.18", plan: "auto", manual: "
|
|
287
|
+
const report = { date: "2026-10-24", lines: [tool({ state: "updated", plan: "auto" }), tool({ key: "brew:herdr", label: "herdr", latest: "0.10.0", state: "failed", plan: "auto" }), tool({ key: "pi", label: "Pi", latest: "1.4.0", plan: "button" }), tool({ key: "spc:node", label: "Node", latest: "26.1.0", major: true, plan: "update" }), tool({ key: "cask:temurin@17", label: "temurin@17", latest: "17.0.18", plan: "auto", manual: "installer needs your password; on Cortex: brew upgrade --cask temurin@17" })], messages: [{ id: "9", keys: [], head: true, all: false }] } as unknown as ToolsReport;
|
|
280
288
|
expect(toolsSummary(report, "2026-10-24", "5")).toEqual({
|
|
281
289
|
area: "Cortex tools",
|
|
282
290
|
line: "1 updated (jq 1.8.2), 1 failed (herdr), Pi 1.4.0, Node 26.1.0 wait for a button, 1 by hand",
|
|
283
|
-
needs: ["Node 26.1.0 waits for its button (major
|
|
291
|
+
needs: ["Node 26.1.0 waits for its button (major)", "Pi 1.4.0 waits for its button", "herdr automatic update failed", "temurin@17 17.0.18 by hand: installer needs your password; on Cortex: brew upgrade --cask temurin@17"],
|
|
284
292
|
channelId: "5",
|
|
285
293
|
messageId: "9",
|
|
286
294
|
});
|
|
287
|
-
expect(toolsSummary(report, "2026-10-25", "5")).toMatchObject({ line: "no report today; the bridge log
|
|
295
|
+
expect(toolsSummary(report, "2026-10-25", "5")).toMatchObject({ line: "no report today; reason in the bridge log", needs: ["Cortex Tools Report did not run today; reason in the bridge log"] });
|
|
288
296
|
});
|
|
289
297
|
|
|
290
298
|
it("says what the Arcane report updated, rolled back, and leaves to the owner", () => {
|
|
@@ -302,11 +310,11 @@ describe("report summaries", () => {
|
|
|
302
310
|
expect(arcaneSummary(report, "2026-10-24", "6")).toEqual({
|
|
303
311
|
area: "Arcane",
|
|
304
312
|
line: "1 stack updated (media), mealie rolled back, stirling-pdf waits for you, supabase held",
|
|
305
|
-
needs: ["stirling-pdf waits for you (Upgrade carefully)", "mealie automatic update rolled back", "paperless gotenberg 8.40.0: major 9 needs a tag change by hand", "paperless broker:
|
|
313
|
+
needs: ["stirling-pdf waits for you (Upgrade carefully)", "mealie automatic update rolled back", "paperless gotenberg 8.40.0: major 9 needs a tag change by hand", "paperless broker: update check failed"],
|
|
306
314
|
channelId: "6",
|
|
307
315
|
messageId: "8",
|
|
308
316
|
});
|
|
309
317
|
const unchecked = { ...report, stacks: [], environmentErrors: [{ environment: "mira", error: "environment offline" }], agentsBehind: [{ environment: "lab", agent: "v2.17.3", manager: "v2.18.0" }] } as unknown as ArcaneReport;
|
|
310
|
-
expect(arcaneSummary(unchecked, "2026-10-24", "6").needs).toEqual(["Arcane environment mira
|
|
318
|
+
expect(arcaneSummary(unchecked, "2026-10-24", "6").needs).toEqual(["Arcane environment mira unchecked for updates", "Arcane agent of lab runs v2.17.3, manager v2.18.0: move its tag on the host"]);
|
|
311
319
|
});
|
|
312
320
|
});
|