fix(housekeeping): harden command dispatch boundaries

This commit is contained in:
Simo committed 2026-08-27 19:32:19 +02:00
1 parent 796d009c07
commit 00618fb2a3
8 files changed
+608 -30

No files matched your search

@@ -0,0 +1,23 @@
import { describe, expect, it } from "vitest";
import { z } from "zod";
import { anyCapability, ok } from "../contracts";
import { housekeepingCommandRegistryReady } from "./bootstrap";
import { registerHousekeepingCommand } from "./registry";
describe("housekeeping command bootstrap", () => {
it("registers the complete current list and seals during module initialization", () => {
expect(housekeepingCommandRegistryReady).toBe(true);
expect(() =>
registerHousekeepingCommand({
id: "system.bootstrap.too-late",
owner: "system",
risk: "safe",
capability: anyCapability("admin.settings.view"),
input: z.object({}),
requiresReason: false,
rateLimit: { attempts: 1, windowMs: 1_000 },
execute: async (context) => ok(null, context.correlationId),
}),
).toThrow("command registry is sealed");
});
});