@astrofoundry/pi-astro 0.40.42 → 0.40.43
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.
|
@@ -200,6 +200,11 @@ describe("morning summary", () => {
|
|
|
200
200
|
"⚠️ **Backup** · Backup: the restic check ended with exit-code\nFound by the morning run; the backup specialist can look into it here.\n<@178096425509453824>",
|
|
201
201
|
);
|
|
202
202
|
});
|
|
203
|
+
|
|
204
|
+
it("names the specialist that reads an area of another name, and none for macOS", () => {
|
|
205
|
+
expect(problemText({ area: "Updates", line: "x", problem: "Updates: no update list from radius" }, ["1"])).toBe("⚠️ **Updates** · Updates: no update list from radius\nFound by the morning run; the proxmox specialist can look into it here.\n<@1>");
|
|
206
|
+
expect(problemText({ area: "macOS", line: "x", problem: "macOS: no macOS update list from Nexus" }, ["1"])).toBe("⚠️ **macOS** · macOS: no macOS update list from Nexus\nFound by the morning run; ask about it here.\n<@1>");
|
|
207
|
+
});
|
|
203
208
|
});
|
|
204
209
|
|
|
205
210
|
describe("report summaries", () => {
|
|
@@ -424,7 +424,12 @@ export function summaryText(s: Summary): string {
|
|
|
424
424
|
return [head, ...reports, ...areas, ...(needs.length > 0 ? [`Needs you · ${needs.map((n, i) => `${i + 1}) ${n}`).join(" ")}`] : [])].join("\n");
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
/** Areas read by a specialist of another name, or by none: Cortex's macOS is this host's own. */
|
|
428
|
+
const AREA_SPECIALIST: Readonly<Record<string, string | null>> = { Updates: "proxmox", macOS: null };
|
|
429
|
+
|
|
427
430
|
/** The tagged message for one area's problem in its routed channel. */
|
|
428
431
|
export function problemText(a: AreaStatus, owners: readonly string[]): string {
|
|
429
|
-
|
|
432
|
+
const specialist = Object.hasOwn(AREA_SPECIALIST, a.area) ? AREA_SPECIALIST[a.area] : a.area.toLowerCase();
|
|
433
|
+
const who = specialist === null ? "ask about it here" : `the ${escapeDiscord(specialist)} specialist can look into it here`;
|
|
434
|
+
return `⚠️ **${escapeDiscord(a.area)}** · ${escapeDiscord(a.problem ?? a.line)}\nFound by the morning run; ${who}.\n${owners.map((id) => `<@${id}>`).join(" ")}`;
|
|
430
435
|
}
|
|
@@ -624,12 +624,13 @@ class Bridge {
|
|
|
624
624
|
/** Every configured specialist's status, read through its wrapper without a model. */
|
|
625
625
|
private async collectAreas(): Promise<AreaStatus[]> {
|
|
626
626
|
const present = new Set(this.specialists().names);
|
|
627
|
-
const text = (service: string, args: string[]) => this.runEntry(service, AUTO_CALLER, args, 3 * 60_000).catch(() => null);
|
|
627
|
+
const text = (service: string, args: string[]) => this.runEntry(service, AUTO_CALLER, args, 3 * 60_000).catch((err) => (log(`daily: ${service} ${args.join(" ")} failed: ${err instanceof Error ? err.message : String(err)}`), null));
|
|
628
628
|
const json = async (service: string, args: string[]) => {
|
|
629
629
|
const out = await text(service, args);
|
|
630
630
|
try {
|
|
631
631
|
return out === null ? null : (JSON.parse(out) as unknown);
|
|
632
632
|
} catch {
|
|
633
|
+
log(`daily: ${service} ${args.join(" ")} returned no JSON`);
|
|
633
634
|
return null;
|
|
634
635
|
}
|
|
635
636
|
};
|