You've already forked agentic-coding-workflow
feat(workspace,jobs): emit sync_aborted_on_restart audit + enrich worktree.pruned metadata
- workspace.ResetStuckSyncStatuses now returns affected IDs so app.New can record one workspace.sync_aborted_on_restart audit per reset row - worktree_prune audit metadata gains workspace_id and path alongside existing branch - updated fakeRepo + integration test for new ResetStuckSyncStatuses signature - add TestWorktreePrune_AuditMetadataContainsWorkspaceIDAndPath
This commit is contained in:
@@ -241,17 +241,38 @@ func (q *Queries) MarkSyncingCAS(ctx context.Context, id pgtype.UUID) (int64, er
|
||||
return result.RowsAffected(), nil
|
||||
}
|
||||
|
||||
const resetStuckSyncStatuses = `-- name: ResetStuckSyncStatuses :exec
|
||||
const resetStuckSyncStatuses = `-- name: ResetStuckSyncStatuses :many
|
||||
UPDATE workspaces
|
||||
SET sync_status = 'error',
|
||||
last_sync_error = 'process_restarted_during_' || sync_status,
|
||||
updated_at = now()
|
||||
WHERE sync_status IN ('cloning', 'syncing')
|
||||
RETURNING id, last_sync_error
|
||||
`
|
||||
|
||||
func (q *Queries) ResetStuckSyncStatuses(ctx context.Context) error {
|
||||
_, err := q.db.Exec(ctx, resetStuckSyncStatuses)
|
||||
return err
|
||||
type ResetStuckSyncStatusesRow struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
LastSyncError *string `json:"last_sync_error"`
|
||||
}
|
||||
|
||||
func (q *Queries) ResetStuckSyncStatuses(ctx context.Context) ([]ResetStuckSyncStatusesRow, error) {
|
||||
rows, err := q.db.Query(ctx, resetStuckSyncStatuses)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []ResetStuckSyncStatusesRow
|
||||
for rows.Next() {
|
||||
var i ResetStuckSyncStatusesRow
|
||||
if err := rows.Scan(&i.ID, &i.LastSyncError); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const updateWorkspaceCore = `-- name: UpdateWorkspaceCore :one
|
||||
|
||||
Reference in New Issue
Block a user