From c6dc266f2fd59a8c05623d12631466d148bcda8a Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Wed, 20 May 2026 13:33:05 +0900 Subject: [PATCH] test(test-isolation): add diagnostic regression test for cross-suite leak Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- .../rules-injector/test-isolation.test.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/hooks/rules-injector/test-isolation.test.ts diff --git a/src/hooks/rules-injector/test-isolation.test.ts b/src/hooks/rules-injector/test-isolation.test.ts new file mode 100644 index 000000000..44e71ad0a --- /dev/null +++ b/src/hooks/rules-injector/test-isolation.test.ts @@ -0,0 +1,25 @@ +import { beforeEach, describe, expect, it } from "bun:test"; +import { existsSync, readdirSync } from "node:fs"; +import { RULES_INJECTOR_STORAGE } from "./constants"; + +function readStorageEntries(): readonly string[] { + if (!existsSync(RULES_INJECTOR_STORAGE)) return []; + return readdirSync(RULES_INJECTOR_STORAGE); +} + +describe("rules injector test isolation", () => { + beforeEach(() => { + const leakedEntries = readStorageEntries(); + expect(leakedEntries).toEqual([]); + }); + + it("#given the shared test setup runs #then persisted injected-rule state starts empty", () => { + // given: test-setup beforeEach has already run + + // when + const entries = readStorageEntries(); + + // then + expect(entries).toEqual([]); + }); +});