From 05e76776d6df8549418f0fcee2b2a2f088f42526 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 17 Oct 2026 17:04:41 +0200 Subject: [PATCH 1/2] =?UTF-8?q?test:=20reproduce=20#676=20=E2=80=94=20a=20?= =?UTF-8?q?recovered=20interrupted=20reclaim=20attributes=20device.shutdow?= =?UTF-8?q?n=20to=20a=20module=20that=20does=20not=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/reclaim-coordinator.test.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/core/reclaim-coordinator.test.ts b/src/core/reclaim-coordinator.test.ts index b9d0eeee1..405d042d8 100644 --- a/src/core/reclaim-coordinator.test.ts +++ b/src/core/reclaim-coordinator.test.ts @@ -366,7 +366,7 @@ describe("ReclaimCoordinator", () => { expect(harness.notifyAvailability).not.toHaveBeenCalled(); }); - it("recovers an unleased interrupted reclaim through shutdown and a committed fact", async () => { + it("recovers an unleased interrupted reclaim through shutdown, a committed fact, and itself as the emitter", async () => { const harness = await createHarness(); let stateAtFact: VirtualDevice["state"] | undefined; harness.bus.subscribe("device.shutdown", () => { @@ -378,6 +378,20 @@ describe("ReclaimCoordinator", () => { expect(stateAtFact).toBe("shutdown"); expect(harness.driver.calls.map((call) => call.operation)).toContain("shutdown"); expect(harness.notifyAvailability).toHaveBeenCalledOnce(); + // why: Events rule 7 binds the emitting module onto every event, and both EVENTS.md cuts name + // the reclaim coordinator as this shutdown's emitter — `simlock events` and the `events.jsonl` + // audit trail print that string, so it must name the module that actually did it. + expect( + harness.bus + .replay() + .filter((event) => event.event === "device.shutdown") + .map((event) => ({ module: event.module, payload: event.payload })), + ).toEqual([ + { + module: "reclaim-coordinator", + payload: { deviceId: harness.reclaiming.id, initiator: "startup-interrupted-reclaim" }, + }, + ]); }); describe("a device whose wipe a daemon start put off", () => { From 2e821428fea64fd89436c057da3be2c82f27c8f8 Mon Sep 17 00:00:00 2001 From: Szymon Chmal Date: Sat, 17 Oct 2026 17:05:31 +0200 Subject: [PATCH 2/2] fix(core): attribute the recovered interrupted reclaim's device.shutdown to the reclaim coordinator The literal emitter string was carried across the decomposition that split warm-pool-coordinator.ts and names a module that no longer exists, while both EVENTS.md cuts publish the reclaim coordinator as this emitter. --- src/core/reclaim-coordinator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/reclaim-coordinator.ts b/src/core/reclaim-coordinator.ts index 05d19413a..6eae4f5ed 100644 --- a/src/core/reclaim-coordinator.ts +++ b/src/core/reclaim-coordinator.ts @@ -163,7 +163,7 @@ export class ReclaimCoordinator { this.options.eventBus.emit( "device.shutdown", { deviceId, initiator: "startup-interrupted-reclaim" }, - "warm-pool-coordinator", + "reclaim-coordinator", ); return true; });