@@ -8,11 +8,13 @@ import { getBlock } from '@/blocks/index'
88import { BlockType } from '@/executor/constants'
99import { GenericBlockHandler } from '@/executor/handlers/generic/generic-handler'
1010import type { ExecutionContext } from '@/executor/types'
11+ import { resolveBlockReference } from '@/executor/utils/block-reference'
1112import { ResolvedSecretTraceRegistry } from '@/executor/utils/resolved-secret-trace-registry'
1213import type { SerializedBlock } from '@/serializer/types'
1314import { executeTool } from '@/tools'
1415import { selectKnowledgeDocumentWriteSecretProvenance } from '@/tools/knowledge/secret-provenance'
1516import { mcpRunOperationTool } from '@/tools/mcp/run-operation'
17+ import { tableQueryRowsV2Tool } from '@/tools/table/query_rows_v2'
1618import type { ToolConfig } from '@/tools/types'
1719import { getTool } from '@/tools/utils'
1820
@@ -107,6 +109,33 @@ describe('GenericBlockHandler', () => {
107109 expect ( result ) . toEqual ( expectedOutput )
108110 } )
109111
112+ it ( 'exposes the Table success field used by downstream workflow references' , async ( ) => {
113+ const rows = [ { id : 'row-1' , data : { amount : 17 } , executions : { } } ]
114+ const tableResponse = await tableQueryRowsV2Tool . transformResponse ! (
115+ Response . json ( { data : { rows, rowCount : 1 , totalCount : 1 , limit : 10 , nextCursor : null } } )
116+ )
117+ mockGetTool . mockReturnValue ( tableQueryRowsV2Tool )
118+ mockExecuteTool . mockResolvedValue ( tableResponse )
119+ const block : SerializedBlock = {
120+ ...mockBlock ,
121+ metadata : { id : 'table_v2' , name : 'Read open items' } ,
122+ config : { tool : tableQueryRowsV2Tool . id , params : { } } ,
123+ }
124+ const output = await handler . execute ( mockContext , block , { tableId : 'table-1' } )
125+ const resolved = resolveBlockReference ( 'readopenitems' , [ 'success' ] , {
126+ blockNameMapping : { readopenitems : block . id } ,
127+ blockData : { [ block . id ] : output } ,
128+ blockOutputSchemas : { [ block . id ] : tableQueryRowsV2Tool . outputs ?? { } } ,
129+ } )
130+ expect ( resolved ?. value ) . toBe ( true )
131+ expect ( output . rows ) . toEqual ( rows )
132+
133+ mockExecuteTool . mockResolvedValue ( { success : false , error : 'Table access denied' , output : { } } )
134+ await expect ( handler . execute ( mockContext , block , { tableId : 'table-1' } ) ) . rejects . toThrow (
135+ 'Table access denied'
136+ )
137+ } )
138+
110139 it ( 'executes the standalone stable MCP action after argument resolution with trusted block scope' , async ( ) => {
111140 mockGetBlock . mockReturnValue ( McpBlock )
112141 mockGetTool . mockReturnValue ( mcpRunOperationTool )
0 commit comments