(blockId: string, output: unknown)
| 207 | let terminalWritten = false |
| 208 | |
| 209 | const cellOnBlockComplete = async (blockId: string, output: unknown) => { |
| 210 | const outputs = outputsByBlockId.get(blockId) |
| 211 | if (!outputs) return |
| 212 | const blockResult = |
| 213 | output && typeof output === 'object' && 'output' in (output as object) |
| 214 | ? (output as { output: unknown }).output |
| 215 | : output |
| 216 | const errorMessage = |
| 217 | blockResult && |
| 218 | typeof blockResult === 'object' && |
| 219 | typeof (blockResult as { error?: unknown }).error === 'string' |
| 220 | ? (blockResult as { error: string }).error |
| 221 | : null |
| 222 | if (errorMessage) { |
| 223 | blockErrors[blockId] = errorMessage |
| 224 | } else { |
| 225 | for (const out of outputs) { |
| 226 | const plucked = pluckByPath(blockResult, out.path) |
| 227 | if (plucked === undefined) continue |
| 228 | accumulatedData[out.columnName] = plucked as RowData[string] |
| 229 | } |
| 230 | } |
| 231 | const dataSnapshot: RowData = { ...accumulatedData } |
| 232 | const blockErrorsSnapshot = { ...blockErrors } |
| 233 | writeChain = writeChain |
| 234 | .then(async () => { |
| 235 | if (terminalWritten) return |
| 236 | const partial: RowExecutionMetadata = { |
| 237 | status: 'running', |
| 238 | executionId: parentExecutionId, |
| 239 | jobId: null, |
| 240 | workflowId: cellContext.workflowId, |
| 241 | error: null, |
| 242 | blockErrors: blockErrorsSnapshot, |
| 243 | } |
| 244 | await writeWorkflowGroupState(writeCtx, { |
| 245 | executionState: partial, |
| 246 | dataPatch: dataSnapshot, |
| 247 | }) |
| 248 | }) |
| 249 | .catch((err) => { |
| 250 | logger.warn( |
| 251 | `Resume per-block partial write failed (table=${cellContext.tableId} row=${cellContext.rowId} group=${cellContext.groupId}):`, |
| 252 | err |
| 253 | ) |
| 254 | }) |
| 255 | } |
| 256 | |
| 257 | const writeCellTerminal = async ( |
| 258 | status: 'completed' | 'error' | 'paused', |
nothing calls this directly
no test coverage detected