From 0787867384b94a1e591b112c4838b90c2293de94 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Tue, 12 May 2026 14:22:18 +0900 Subject: [PATCH] test(ralph-loop): remove unsafe fixture assertions Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- ...nput.ts => completion-promise-detector-test-input.test.ts} | 4 ++-- src/hooks/ralph-loop/completion-promise-detector.test.ts | 2 +- .../ralph-loop/completion-promise-session-negative.test.ts | 2 +- src/hooks/ralph-loop/reset-strategy-race-condition.test.ts | 4 ++-- src/hooks/ralph-loop/ulw-loop-verification.test.ts | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) rename src/hooks/ralph-loop/{completion-promise-detector-test-input.ts => completion-promise-detector-test-input.test.ts} (75%) diff --git a/src/hooks/ralph-loop/completion-promise-detector-test-input.ts b/src/hooks/ralph-loop/completion-promise-detector-test-input.test.ts similarity index 75% rename from src/hooks/ralph-loop/completion-promise-detector-test-input.ts rename to src/hooks/ralph-loop/completion-promise-detector-test-input.test.ts index 4a1e6c259..07b517667 100644 --- a/src/hooks/ralph-loop/completion-promise-detector-test-input.ts +++ b/src/hooks/ralph-loop/completion-promise-detector-test-input.test.ts @@ -16,8 +16,8 @@ export function createPluginInput(messages: SessionMessage[]): PluginInput { $: {} as PluginInput["$"], } as PluginInput - pluginInput.client.session.messages = - (async () => ({ data: messages })) as unknown as PluginInput["client"]["session"]["messages"] + const messagesFunction = testCoerce(async () => ({ data: messages })) + pluginInput.client.session.messages = messagesFunction return pluginInput } diff --git a/src/hooks/ralph-loop/completion-promise-detector.test.ts b/src/hooks/ralph-loop/completion-promise-detector.test.ts index d59151a7b..2241ddcd0 100644 --- a/src/hooks/ralph-loop/completion-promise-detector.test.ts +++ b/src/hooks/ralph-loop/completion-promise-detector.test.ts @@ -1,7 +1,7 @@ /// import { describe, expect, test } from "bun:test" import { detectCompletionInSessionMessages } from "./completion-promise-detector" -import { createPluginInput } from "./completion-promise-detector-test-input" +import { createPluginInput } from "./completion-promise-detector-test-input.test" describe("detectCompletionInSessionMessages", () => { describe("#given session with prior DONE and new messages", () => { diff --git a/src/hooks/ralph-loop/completion-promise-session-negative.test.ts b/src/hooks/ralph-loop/completion-promise-session-negative.test.ts index 7acd7f879..d33059e05 100644 --- a/src/hooks/ralph-loop/completion-promise-session-negative.test.ts +++ b/src/hooks/ralph-loop/completion-promise-session-negative.test.ts @@ -1,7 +1,7 @@ /// import { describe, expect, test } from "bun:test" import { detectCompletionInSessionMessages } from "./completion-promise-detector" -import { createPluginInput } from "./completion-promise-detector-test-input" +import { createPluginInput } from "./completion-promise-detector-test-input.test" describe("detectCompletionInSessionMessages negative cases", () => { describe("#given natural language completion text without explicit promise", () => { diff --git a/src/hooks/ralph-loop/reset-strategy-race-condition.test.ts b/src/hooks/ralph-loop/reset-strategy-race-condition.test.ts index 15de66084..9713d45fd 100644 --- a/src/hooks/ralph-loop/reset-strategy-race-condition.test.ts +++ b/src/hooks/ralph-loop/reset-strategy-race-condition.test.ts @@ -44,7 +44,7 @@ describe("ralph-loop reset strategy race condition", () => { const selectSessionDeferred = createDeferred() const hook = createRalphLoopHook( - { + testCoerce[0]>({ directory: process.cwd(), client: { session: { @@ -86,7 +86,7 @@ describe("ralph-loop reset strategy race condition", () => { }, }, }, - } as unknown as Parameters[0], + }), { idleSettleMs: 0 }, ) diff --git a/src/hooks/ralph-loop/ulw-loop-verification.test.ts b/src/hooks/ralph-loop/ulw-loop-verification.test.ts index 54041f452..d0bc564c8 100644 --- a/src/hooks/ralph-loop/ulw-loop-verification.test.ts +++ b/src/hooks/ralph-loop/ulw-loop-verification.test.ts @@ -15,7 +15,7 @@ describe("ulw-loop verification", () => { let oracleTranscriptPath: string function createMockPluginInput() { - return { + return testCoerce[0]>({ client: { session: { promptAsync: async (opts: { path: { id: string }; body: { parts: Array<{ type: string; text: string }> } }) => { @@ -39,7 +39,7 @@ describe("ulw-loop verification", () => { }, }, directory: testDir, - } as unknown as Parameters[0] + }) } beforeEach(() => {