(context, values)
| 294 | } |
| 295 | |
| 296 | async function persistRun(context, values) { |
| 297 | if (!db.UpdateRun || !context.runId) { |
| 298 | emitStructuredAuditLog("run_update_skipped", { |
| 299 | traceId: context.traceId, |
| 300 | rootTraceId: context.rootTraceId, |
| 301 | values, |
| 302 | }); |
| 303 | return context; |
| 304 | } |
| 305 | |
| 306 | try { |
| 307 | await db.UpdateRun.update(values, { where: { id: context.runId } }); |
| 308 | } catch (error) { |
| 309 | emitAuditInternalError("[updateAudit] failed to update run", error); |
| 310 | } |
| 311 | |
| 312 | emitStructuredAuditLog("run_updated", { |
| 313 | runId: context.runId, |
| 314 | traceId: context.traceId, |
| 315 | rootTraceId: context.rootTraceId, |
| 316 | values, |
| 317 | }); |
| 318 | |
| 319 | return context; |
| 320 | } |
| 321 | |
| 322 | async function startRun(payload = {}, parentTraceContext = null) { |
| 323 | const baseContext = cloneTraceContext(parentTraceContext); |
no test coverage detected