feat(FN-4973): complete Step 1 — add stale self-owned registry reconcile helper
Fusion-Task-Id: FN-4973 Fusion-Task-Lineage: 2edb5479-a01a-4775-b121-f4be32792e7a
This commit is contained in:
committed by
gsxdsm
parent
b53172befd
commit
3a53c6778c
@@ -35,4 +35,31 @@ describe("activeSessionRegistry", () => {
|
||||
|
||||
warnSpy.mockRestore();
|
||||
});
|
||||
|
||||
it("reconcileStaleSelfOwned returns no-entry when path is unregistered", () => {
|
||||
expect(activeSessionRegistry.reconcileStaleSelfOwned("/tmp/missing", "FN-1")).toEqual({
|
||||
reconciled: false,
|
||||
reason: "no-entry",
|
||||
});
|
||||
});
|
||||
|
||||
it("reconcileStaleSelfOwned returns foreign-task for mismatched owner", () => {
|
||||
activeSessionRegistry.registerPath("/tmp/w1", { taskId: "FN-2", kind: "executor", ownerKey: "FN-2" });
|
||||
|
||||
expect(activeSessionRegistry.reconcileStaleSelfOwned("/tmp/w1", "FN-1")).toEqual({
|
||||
reconciled: false,
|
||||
reason: "foreign-task",
|
||||
});
|
||||
expect(activeSessionRegistry.lookupByPath("/tmp/w1")?.taskId).toBe("FN-2");
|
||||
});
|
||||
|
||||
it("reconcileStaleSelfOwned unregisters matching self-owned entry", () => {
|
||||
activeSessionRegistry.registerPath("/tmp/w1", { taskId: "FN-1", kind: "executor", ownerKey: "FN-1" });
|
||||
|
||||
expect(activeSessionRegistry.reconcileStaleSelfOwned("/tmp/w1", "FN-1")).toEqual({
|
||||
reconciled: true,
|
||||
reason: "reconciled",
|
||||
});
|
||||
expect(activeSessionRegistry.lookupByPath("/tmp/w1")).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user