* Record node execution start (inputs captured)
(data: {
runId: string;
nodeRef: string;
workflowId?: string;
organizationId?: string | null;
componentId: string;
inputs?: Record<string, unknown>;
inputsSpilled?: boolean;
inputsStorageRef?: string | null;
inputsSize?: number;
})
| 32 | * Record node execution start (inputs captured) |
| 33 | */ |
| 34 | async recordStart(data: { |
| 35 | runId: string; |
| 36 | nodeRef: string; |
| 37 | workflowId?: string; |
| 38 | organizationId?: string | null; |
| 39 | componentId: string; |
| 40 | inputs?: Record<string, unknown>; |
| 41 | inputsSpilled?: boolean; |
| 42 | inputsStorageRef?: string | null; |
| 43 | inputsSize?: number; |
| 44 | }): Promise<void> { |
| 45 | const inputsJson = data.inputs ? JSON.stringify(data.inputs) : null; |
| 46 | const computedInputsSize = inputsJson ? Buffer.byteLength(inputsJson, 'utf8') : 0; |
| 47 | |
| 48 | // Favor provided spilled info from worker, fallback to local calculation |
| 49 | const inputsSize = data.inputsSize ?? computedInputsSize; |
| 50 | const inputsSpilled = data.inputsSpilled ?? inputsSize > KAFKA_SPILL_THRESHOLD_BYTES; |
| 51 | // Use the storage ref provided by worker (UUID), or generate a path-based fallback |
| 52 | const inputsStorageRef = data.inputsStorageRef ?? null; |
| 53 | |
| 54 | const insert: NodeIOInsert = { |
| 55 | runId: data.runId, |
| 56 | nodeRef: data.nodeRef, |
| 57 | workflowId: data.workflowId ?? null, |
| 58 | organizationId: data.organizationId ?? null, |
| 59 | componentId: data.componentId, |
| 60 | inputs: inputsSpilled |
| 61 | ? createSpilledMarker(inputsStorageRef ?? 'unknown', inputsSize) |
| 62 | : data.inputs, |
| 63 | inputsSize, |
| 64 | inputsSpilled, |
| 65 | inputsStorageRef, |
| 66 | startedAt: new Date(), |
| 67 | status: 'running', |
| 68 | }; |
| 69 | |
| 70 | await this.db |
| 71 | .insert(nodeIOTable) |
| 72 | .values(insert) |
| 73 | .onConflictDoUpdate({ |
| 74 | target: [nodeIOTable.runId, nodeIOTable.nodeRef], |
| 75 | set: { |
| 76 | ...insert, |
| 77 | // Only update status to 'running' if it's not already in a terminal state |
| 78 | status: sql`CASE |
| 79 | WHEN ${nodeIOTable.status} IN ('completed', 'failed', 'skipped') |
| 80 | THEN ${nodeIOTable.status} |
| 81 | ELSE ${insert.status} |
| 82 | END`, |
| 83 | updatedAt: new Date(), |
| 84 | }, |
| 85 | }); |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Update node execution with outputs (completion) |
nothing calls this directly
no test coverage detected