55 queueTableRows ,
66 resetDbChainMock ,
77} from '@sim/testing'
8+ import { isPlainRecord } from '@sim/utils/object'
89import { afterAll , beforeEach , describe , expect , test , vi } from 'vitest'
910import { recordUsage } from '@/lib/billing/core/usage-log'
1011import { ExecutionLogger } from '@/lib/logs/execution/logger'
@@ -328,13 +329,17 @@ describe('ExecutionLogger', () => {
328329 dbChainMockFns . returning . mockResolvedValueOnce ( [
329330 { id : 'log-1' , executionData : { } , startedAt, createdAt : startedAt } ,
330331 ] )
331- vi . spyOn ( logger as any , 'applyPiiRedaction' ) . mockImplementation (
332- async ( _workspaceId : unknown , payload : any ) =>
332+ const internals = logger as unknown as {
333+ applyPiiRedaction : ( workspaceId : string , payload : Record < string , unknown > ) => unknown
334+ recordExecutionUsage : ( ) => Promise < number >
335+ }
336+ vi . spyOn ( internals , 'applyPiiRedaction' ) . mockImplementation (
337+ async ( _workspaceId : string , payload : Record < string , unknown > ) =>
333338 Object . hasOwn ( params , 'redactedState' )
334339 ? { ...payload , executionState : params . redactedState }
335340 : payload
336341 )
337- vi . spyOn ( logger as any , 'recordExecutionUsage' ) . mockResolvedValue ( 0 )
342+ vi . spyOn ( internals , 'recordExecutionUsage' ) . mockResolvedValue ( 0 )
338343
339344 await logger . completeWorkflowExecution ( {
340345 executionId : 'execution-1' ,
@@ -356,8 +361,8 @@ describe('ExecutionLogger', () => {
356361 } )
357362
358363 return dbChainMockFns . set . mock . calls
359- . map ( ( [ values ] : [ any ] ) => values ?. executionData )
360- . find ( ( data : any ) => data && typeof data === 'object' )
364+ . map ( ( [ values ] : [ { executionData ?: unknown } ] ) => values ?. executionData )
365+ . find ( ( data ) : data is Record < string , unknown > => isPlainRecord ( data ) )
361366 }
362367
363368 /**
@@ -745,7 +750,12 @@ describe('ExecutionLogger', () => {
745750 }
746751
747752 function compactWithProvenance ( traceSpans : unknown [ ] , finalOutput : unknown ) {
748- const loggerInstance = new ExecutionLogger ( ) as any
753+ const loggerInstance = new ExecutionLogger ( ) as unknown as {
754+ compactExecutionDataForStorage : (
755+ data : Record < string , unknown > ,
756+ executionId : string
757+ ) => Record < string , unknown >
758+ }
749759 return loggerInstance . compactExecutionDataForStorage (
750760 {
751761 secretProjectionVersion : SECRET_PROJECTION_VERSION ,
0 commit comments