From a79c9c6a4364fffc9bc8c4ff79bfb2ce7a64a3f8 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 23 Jul 2026 06:46:50 +0200 Subject: [PATCH] fix: preserve aggregate HWPOD lifecycle actions --- tools/src/hwpod-native-service.test.ts | 1 + tools/src/hwpod-native-service.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/src/hwpod-native-service.test.ts b/tools/src/hwpod-native-service.test.ts index 9e8b0e18..804a6a2b 100644 --- a/tools/src/hwpod-native-service.test.ts +++ b/tools/src/hwpod-native-service.test.ts @@ -31,6 +31,7 @@ test("aggregate stop owns all HWPOD native services", async () => { expect(result.ok).toBe(true); expect(Object.keys(result.services).sort()).toEqual(["api", "web", "worker"]); expect(result.summary.completed).toBe(3); + expect(Object.values(result.services).every((service) => service.operation.endsWith(".stop"))).toBe(true); } finally { await rm(cwd, { recursive: true, force: true }); } diff --git a/tools/src/hwpod-native-service.ts b/tools/src/hwpod-native-service.ts index 39102078..7f794a55 100644 --- a/tools/src/hwpod-native-service.ts +++ b/tools/src/hwpod-native-service.ts @@ -27,21 +27,21 @@ export async function hwpodNativeServicesStatus(input: { cwd: string; env: Recor export async function hwpodNativeServicesCommand(input: { action: string; cwd: string; env: Record }) { if (input.action === "status") return hwpodNativeServicesStatus(input); if (input.action === "logs") { - const results = await Promise.all(SERVICE_NAMES.map((service) => hwpodNativeServiceCommand({ service, action: "logs", ...input }))); + const results = await Promise.all(SERVICE_NAMES.map((service) => hwpodNativeServiceCommand({ ...input, service, action: "logs" }))); return aggregateResult("logs", results); } if (input.action === "stop") { const results = []; - for (const service of [...SERVICE_NAMES].reverse()) results.push(await hwpodNativeServiceCommand({ service, action: "stop", ...input })); + for (const service of [...SERVICE_NAMES].reverse()) results.push(await hwpodNativeServiceCommand({ ...input, service, action: "stop" })); return aggregateResult("stop", results); } if (input.action === "start" || input.action === "restart") { const stopped = []; if (input.action === "restart") { - for (const service of [...SERVICE_NAMES].reverse()) stopped.push(await hwpodNativeServiceCommand({ service, action: "stop", ...input })); + for (const service of [...SERVICE_NAMES].reverse()) stopped.push(await hwpodNativeServiceCommand({ ...input, service, action: "stop" })); } const started = []; - for (const service of SERVICE_NAMES) started.push(await hwpodNativeServiceCommand({ service, action: "start", ...input })); + for (const service of SERVICE_NAMES) started.push(await hwpodNativeServiceCommand({ ...input, service, action: "start" })); const readiness = await waitForServicesReady(input); return { ...aggregateResult(input.action, started), stopped, readiness, ok: readiness.ok, status: readiness.status }; }