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:
2026-05-07 10:14:46 +08:00
parent b1ccce567e
commit a2b6d5382e
8 changed files with 110 additions and 22 deletions
+3 -2
View File
@@ -35,12 +35,13 @@ RETURNING *;
-- name: DeleteWorkspace :exec
DELETE FROM workspaces WHERE id = $1;
-- name: ResetStuckSyncStatuses :exec
-- 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');
WHERE sync_status IN ('cloning', 'syncing')
RETURNING id, last_sync_error;
-- name: ListFetchTargets :many
SELECT w.id, p.owner_id, w.name, w.main_path