From ca55b5c2699f54ce12635d2990106d4fc55afc4d Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 4 Apr 2026 19:59:54 -0500 Subject: [PATCH] fix(test): reset dedup cache between ask-user-freetext tests The per-turn dedup cache introduced in the parent commit persists across test cases since they all use the same question signature. Test 1 populates the cache, causing tests 2 and 3 to get cached results instead of exercising their intended code paths. --- .../extensions/shared/tests/ask-user-freetext.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/resources/extensions/shared/tests/ask-user-freetext.test.ts b/src/resources/extensions/shared/tests/ask-user-freetext.test.ts index 065150899..41e4d8292 100644 --- a/src/resources/extensions/shared/tests/ask-user-freetext.test.ts +++ b/src/resources/extensions/shared/tests/ask-user-freetext.test.ts @@ -10,12 +10,13 @@ * triggers a follow-up free-text input prompt via ctx.ui.input(). */ -import { describe, it } from "node:test"; +import { describe, it, beforeEach } from "node:test"; import assert from "node:assert/strict"; // The ask-user-questions extension registers a tool via pi.registerTool(). // We capture that registration and call execute() directly with a mock context. import AskUserQuestions from "../../ask-user-questions.js"; +import { resetAskUserQuestionsCache } from "../../ask-user-questions.js"; interface CapturedTool { name: string; @@ -73,6 +74,10 @@ function makeMockCtx(opts: { } describe("ask-user-questions RPC fallback free-text", () => { + beforeEach(() => { + resetAskUserQuestionsCache(); + }); + it("prompts for free-text input when user selects 'None of the above'", async () => { const tool = captureTool(); const { ctx, selectCalls, inputCalls } = makeMockCtx({