Export CSV on every table, edit recurring maintenance, runs-on nothing, and run package checks outside the agent sandbox

- Export CSV for the small tables that had none (reads the table as shown)
- Servers page shows a skeleton while loading instead of "No servers registered yet"
- Recurring maintenance schedules can be edited (PUT /schedules/:id)
- A server can be set to run on nothing (servers.no_parent, migration 0028)
- Linux agent v3: package-manager question runs in ExecStartPre=-+ outside the sandbox,
  with --prepare-updates and --check-updates modes
- Docs: README, DATABASE, AGENT_UPDATE

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-17 22:25:18 +02:00
1 parent c17e9aa140
commit 540ab704b7
32 files changed
+3003 -66

No files matched your search

+33 -1
View File
@@ -168,10 +168,42 @@ describe("the schedules and their windows", () => {
assert.ok((await windowsOf(scheduleId)).length >= 12);
});
test("editing a schedule remakes the windows that haven't begun from the new settings, and keeps what is under way", async () => {
const now = Date.now();
await db.insert(maintenanceWindows).values({ targetType: "server", targetId: a, reason: "x", startedAt: new Date(now - 60_000).toISOString(), endsAt: new Date(now + 600_000).toISOString(), source: `schedule:${scheduleId}:2000-01-02` });
const edited = { ...good, name: "Patch weekend", reason: "", targets: [{ type: "server", id: a }], days: [6], startTime: "01:30", durationMinutes: 90 };
const res = await call("PUT", `/schedules/${scheduleId}`, edited);
assert.equal(res.status, 200);
const future = (await windowsOf(scheduleId)).filter((w) => w.startedAt > new Date().toISOString());
assert.ok(future.length >= 1 && future.length <= 2, `${future.length} Saturdays in the coming week`);
assert.ok(future.every((w) => w.targetId === a && w.reason === "Patch weekend" && new Date(w.startedAt).getUTCDay() === 6 && w.startedAt.includes("T01:30") && Date.parse(w.endsAt) - Date.parse(w.startedAt) === 90 * 60_000));
assert.ok((await windowsOf(scheduleId)).some((w) => w.source.endsWith("2000-01-02")), "the one under way is left alone");
await db.delete(maintenanceWindows).where(eq(maintenanceWindows.source, `schedule:${scheduleId}:2000-01-02`));
const list = await (await call("GET", "/schedules")).json();
assert.equal(list.schedules[0].name, "Patch weekend");
assert.deepEqual(list.schedules[0].days, [6]);
assert.equal(list.schedules[0].reason, null);
assert.equal(list.schedules[0].targets.length, 1);
assert.equal(list.schedules[0].enabled, true);
// a bad edit changes nothing; a schedule that is off stays off and makes nothing
assert.equal((await call("PUT", `/schedules/${scheduleId}`, { ...edited, timezone: "Mars/Olympus" })).status, 400);
assert.equal((await call("PUT", `/schedules/${scheduleId}`, { ...edited, targets: [{ type: "server", id: 99999 }] })).status, 400);
assert.equal((await call("PUT", "/schedules/99999", edited)).status, 404);
assert.equal((await (await call("GET", "/schedules")).json()).schedules[0].name, "Patch weekend");
await call("PATCH", `/schedules/${scheduleId}`, { enabled: false });
assert.equal((await (await call("PUT", `/schedules/${scheduleId}`, { ...edited, days: [0, 1] })).json()).windowsMade, 0);
assert.equal((await windowsOf(scheduleId)).filter((w) => w.startedAt > new Date().toISOString()).length, 0);
assert.equal((await (await call("GET", "/schedules")).json()).schedules[0].enabled, false);
await call("PUT", `/schedules/${scheduleId}`, { ...good, targets: [{ type: "server", id: a }, { type: "server", id: b }] });
await call("PATCH", `/schedules/${scheduleId}`, { enabled: true });
});
test("only operators change schedules; a bad one is refused", async () => {
who = "viewer";
assert.equal((await call("POST", "/schedules", { ...good, targets: [{ type: "server", id: a }] })).status, 403);
assert.equal((await call("PATCH", `/schedules/${scheduleId}`, { enabled: false })).status, 403);
assert.equal((await call("PUT", `/schedules/${scheduleId}`, { ...good, targets: [{ type: "server", id: a }] })).status, 403);
assert.equal((await call("DELETE", `/schedules/${scheduleId}`)).status, 403);
assert.equal((await call("GET", "/schedules")).status, 200, "anyone signed in can see them");
who = "operator";
@@ -197,6 +229,6 @@ describe("the schedules and their windows", () => {
assert.equal((await windowsOf(scheduleId)).filter((w) => w.startedAt > new Date().toISOString()).length, 0);
assert.equal((await call("DELETE", `/schedules/${scheduleId}`)).status, 404);
const actions = (await db.select().from(auditLog)).filter((e) => e.category === "maintenance").map((e) => e.action);
for (const wanted of ["create_schedule", "disable_schedule", "enable_schedule", "delete_schedule"]) assert.ok(actions.includes(wanted), wanted);
for (const wanted of ["create_schedule", "update_schedule", "disable_schedule", "enable_schedule", "delete_schedule"]) assert.ok(actions.includes(wanted), wanted);
});
});