TouchStep bumps the step's and its parent run's updated_at timestamps without changing any other fields. This prevents long-running operations (e.g. streaming) from being prematurely swept by FinalizeStale, which first marks runs stale by chat_debug_runs.updated_at and then cascades to steps whose r
( ctx context.Context, stepID uuid.UUID, runID uuid.UUID, chatID uuid.UUID, )
| 506 | // first marks runs stale by chat_debug_runs.updated_at and then cascades |
| 507 | // to steps whose run_id was just finalized. |
| 508 | func (s *Service) TouchStep( |
| 509 | ctx context.Context, |
| 510 | stepID uuid.UUID, |
| 511 | runID uuid.UUID, |
| 512 | chatID uuid.UUID, |
| 513 | ) error { |
| 514 | // Atomically bump both the step and its parent run so |
| 515 | // FinalizeStale cannot interleave between the two touches. |
| 516 | return s.db.TouchChatDebugStepAndRun(chatdContext(ctx), |
| 517 | database.TouchChatDebugStepAndRunParams{ |
| 518 | Now: s.clock.Now(), |
| 519 | StepID: stepID, |
| 520 | RunID: runID, |
| 521 | ChatID: chatID, |
| 522 | }) |
| 523 | } |
| 524 | |
| 525 | // DeleteByChatID deletes debug data for a chat and emits a delete event. |
| 526 | // The startedBefore bound scopes deletion to runs created before that |
no test coverage detected