From 565e190c7e78494c89ceafe1c38d3ac33a029819 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Tue, 6 Oct 2026 23:31:38 -0400 Subject: [PATCH] test(arma-locker-sync): scope locker.apply assertions to this run The helper counted arma-commands DB-wide, so any spec file that leaves a game-server online (operation-*, supply-*, respawn-tickets) made later web-originated locker edits leak into the count once vitest's timing-based file order put those files first. Filter commands by this run's instance refs, and mark the grid-metadata fixture write with the lockerSyncOrigin context flag so it stops enqueuing an echo command of its own. --- tests/int/arma-locker-sync.int.spec.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/int/arma-locker-sync.int.spec.ts b/tests/int/arma-locker-sync.int.spec.ts index 92ba6a5f..3cfe316a 100644 --- a/tests/int/arma-locker-sync.int.spec.ts +++ b/tests/int/arma-locker-sync.int.spec.ts @@ -59,7 +59,20 @@ async function findLockerApplyCommands(): Promise<{ id: number; payload: unknown depth: 0, overrideAccess: true, }); - return found.docs.map((doc) => ({ id: doc.id, payload: (doc as { payload?: unknown }).payload })); + // Scope to this run's instances: other spec files leave game-servers online, + // so their web-originated locker edits also enqueue locker.apply commands. + // An unscoped count made this file order-dependent (25 foreign rows once + // vitest's timing-based file order put those files first). + return found.docs + .filter((doc) => { + const commandPayload = (doc as { payload?: unknown }).payload; + const instanceRef = Array.isArray(commandPayload) ? commandPayload[0] : undefined; + return ( + typeof instanceRef === "string" && + (instanceRef.includes(STEAM_ID) || instanceRef.includes(SLUG)) + ); + }) + .map((doc) => ({ id: doc.id, payload: (doc as { payload?: unknown }).payload })); } async function lockerDoc() { @@ -300,6 +313,10 @@ describe("Arma locker sync", () => { }, ], } as never, + // Fixture write, not an echo-guard test: suppress the locker.apply + // enqueue so this file's absolute command counts stay stable even + // when other spec files leave a game-server online. + context: { lockerSyncOrigin: true }, overrideAccess: true, depth: 0, });