(db *sql.DB, runID string)
| 288 | } |
| 289 | |
| 290 | func attemptsForRun(db *sql.DB, runID string) ([]attemptFileView, error) { |
| 291 | rows, err := db.Query(`SELECT a.id, a.rollout_id, a.tool_call_id, a.snapshot_id, a.workspace_path, |
| 292 | a.strategy, a.command, a.status, a.is_winner, COALESCE(a.artifact_result, '') |
| 293 | FROM fork_attempts a JOIN rollouts r ON a.rollout_id = r.id |
| 294 | WHERE r.run_id = ? |
| 295 | ORDER BY a.created_at ASC`, runID) |
| 296 | if err != nil { |
| 297 | return nil, err |
| 298 | } |
| 299 | defer rows.Close() |
| 300 | var attempts []attemptFileView |
| 301 | for rows.Next() { |
| 302 | var item attemptFileView |
| 303 | var isWinner int |
| 304 | if err := rows.Scan(&item.AttemptID, &item.RolloutID, &item.ToolCallID, &item.SnapshotID, &item.WorkspacePath, &item.Strategy, &item.Command, &item.Status, &isWinner, &item.ArtifactRef); err != nil { |
| 305 | return nil, err |
| 306 | } |
| 307 | item.IsWinner = isWinner != 0 |
| 308 | attempts = append(attempts, item) |
| 309 | } |
| 310 | return attempts, rows.Err() |
| 311 | } |
| 312 | |
| 313 | func cleanRelativeFile(value string) (string, error) { |
| 314 | if strings.TrimSpace(value) == "" { |
no test coverage detected