feat(hub): add idempotent service registration

This commit is contained in:
DCCONSTRUCTIONS
2026-08-10 16:53:47 +03:00
parent 24d01fc813
commit 64624293a8
7 changed files with 494 additions and 51 deletions
@@ -81,6 +81,28 @@ describe("assistant-ready Launcher admin routes", () => {
expect(block).toContain("scopeAdminMutationResult");
});
it("keeps generic service registration root-guarded and idempotent", () => {
const block = sourceBlock(
'app.put("/api/admin/services/registrations/:serviceSlug"',
'app.patch("/api/admin/services/reorder"'
);
expect(block).toContain("requireLauncherAdmin");
expect(block).toContain("requireRootLauncherAdmin");
expect(block).toContain("sendAdminIdempotentJson");
expect(block).toContain("controlPlaneStore.ensureService");
});
it("keeps service grants idempotent and outside the assistant gateway allowlist", () => {
const block = sourceBlock('app.post("/api/admin/access/grants"', 'app.post("/api/admin/access/exceptions"');
const allowlistBlock = sourceBlock("const assistantGatewayAdminRouteAllowlist = [", "];",);
expect(block).toContain("sendAdminIdempotentJson");
expect(block).toContain("controlPlaneStore.upsertGrant");
expect(allowlistBlock).not.toContain("/api/admin/services/registrations");
expect(allowlistBlock).not.toContain("/api/admin/access/grants");
});
it("keeps hard delete routes outside assistant-ready routes and root-guarded where available", () => {
const userDeleteBlock = sourceBlock('app.delete("/api/admin/users/:userId"', 'app.post("/api/admin/users/:userId/provision-authentik"');