Skip to content

Commit f26fe15

Browse files
saravmajesticclaude
andcommitted
test(workspace): clear the binding cache between routing-pin tests
CodeRabbit's point: the cache is one file under `XDG_STATE_HOME` shared by every test in the file, so a row seeded by one decided what the next one read. It happened to be harmless here — each test seeds the link it asserts on — but it made the file order-dependent by construction. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 parent d5227fe commit f26fe15

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎packages/opencode/test/altimate/workspace/routing-pin.test.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ const SANDBOX = path.join(os.tmpdir(), `altimate-routing-pin-test-${process.pid}
1717
mkdirSync(path.join(SANDBOX, "state"), { recursive: true })
1818
process.env.XDG_STATE_HOME = path.join(SANDBOX, "state")
1919

20-
const { resolvePinnedBindingForRouting, recordApprovedBinding, __resetPinValidation } = await import(
21-
"../../../src/altimate/workspace/state"
22-
)
20+
const { resolvePinnedBindingForRouting, recordApprovedBinding, __resetPinValidation, cachePath } =
21+
await import("../../../src/altimate/workspace/state")
2322
const { refresh, precedenceInternals } = await import("../../../src/altimate/workspace/precedence")
2423
const { Instance } = await import("../../../src/project/instance")
2524
const { SNOWFLAKE_TOOLS } = await import("./precedence-fixture")
@@ -101,6 +100,10 @@ beforeEach(() => {
101100
afterEach(() => {
102101
clearPin()
103102
__resetPinValidation()
103+
// The binding cache is a single file under `XDG_STATE_HOME`, shared by every test here, so a
104+
// row seeded by one would otherwise decide what the next one reads. Cleared so each test states
105+
// its own starting point and the file can be read in any order.
106+
rmSync(cachePath(), { force: true })
104107
})
105108

106109
afterAll(() => {

0 commit comments

Comments
 (0)