Skip to content

Commit 0704c48

Browse files
waleedlatif1claude
andcommitted
test(execution): type the logging-session factory instead of casting
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BYi7yz8qo98ziQWZmRpqb8
1 parent a2a2633 commit 0704c48

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

apps/sim/lib/execution/preprocessing.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import { loggingSessionMock, workflowAuthzMockFns } from '@sim/testing'
66
import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest'
77
import { ADMISSION_ERROR_CODE } from '@/lib/core/admission/transient-failure'
8+
import type { LoggingSession } from '@/lib/logs/execution/logging-session'
89

910
const {
1011
mockSleep,
@@ -275,6 +276,11 @@ describe('preprocessExecution suppressRetryableFailureLogs option', () => {
275276
}
276277
}
277278

279+
/** Preprocessing only reaches `safeStart`/`safeCompleteWithError`, so the mock stands in for the full session. */
280+
function asLoggingSession(session: ReturnType<typeof makeLoggingSession>): LoggingSession {
281+
return session as unknown as LoggingSession
282+
}
283+
278284
it('skips the failure row for a retryable infrastructure failure', async () => {
279285
workflowAuthzMockFns.mockGetActiveWorkflowRecord.mockRejectedValue(
280286
Object.assign(new Error('write CONNECT_TIMEOUT'), { code: 'CONNECT_TIMEOUT' })
@@ -284,7 +290,7 @@ describe('preprocessExecution suppressRetryableFailureLogs option', () => {
284290
const result = await preprocessExecution({
285291
...baseOptions,
286292
suppressRetryableFailureLogs: true,
287-
loggingSession: loggingSession as any,
293+
loggingSession: asLoggingSession(loggingSession),
288294
})
289295

290296
expect(result).toMatchObject({
@@ -307,7 +313,7 @@ describe('preprocessExecution suppressRetryableFailureLogs option', () => {
307313
const result = await preprocessExecution({
308314
...baseOptions,
309315
suppressRetryableFailureLogs: true,
310-
loggingSession: loggingSession as any,
316+
loggingSession: asLoggingSession(loggingSession),
311317
})
312318

313319
expect(result).toMatchObject({
@@ -324,7 +330,7 @@ describe('preprocessExecution suppressRetryableFailureLogs option', () => {
324330

325331
const result = await preprocessExecution({
326332
...baseOptions,
327-
loggingSession: makeLoggingSession() as any,
333+
loggingSession: asLoggingSession(makeLoggingSession()),
328334
})
329335

330336
expect(workflowAuthzMockFns.mockGetActiveWorkflowRecord).toHaveBeenCalledTimes(3)
@@ -342,7 +348,7 @@ describe('preprocessExecution suppressRetryableFailureLogs option', () => {
342348

343349
const result = await preprocessExecution({
344350
...baseOptions,
345-
loggingSession: loggingSession as any,
351+
loggingSession: asLoggingSession(loggingSession),
346352
})
347353

348354
expect(result).toMatchObject({

0 commit comments

Comments
 (0)