chore(jobs): align log keys + add prune no-op test + down-migration comment

Cross-cutting review polish:
- worker.go: id/type → job_id/job_type; one stray attempts → attempt for
  consistency with the other 4 sites in the same file.
- runners/workspace_fetch.go: ws_id → workspace_id (matches the dispatched
  notify.Message metadata key).
- runners/worktree_prune.go: id → worktree_id (same reason).
- runners/worktree_prune_test.go: add TestWorktreePrune_NoRowsIsNoOp for
  symmetry with the no-op tests in the other 4 runner test files.
- migrations/0005_jobs.down.sql: comment that DROP TABLE jobs cascades to
  drop the three idx_jobs_* indexes automatically.
This commit is contained in:
2026-05-06 11:52:17 +08:00
parent cf1ec7b1c6
commit f6089ac5fb
5 changed files with 39 additions and 20 deletions
@@ -155,6 +155,23 @@ func TestWorktreePrune_ExecutionFailureRollsBack(t *testing.T) {
assert.Equal(t, "rollback", repo.finalized[id])
}
func TestWorktreePrune_NoRowsIsNoOp(t *testing.T) {
t.Parallel()
repo := &fakeWorktreeRepo{} // both lists nil
gitr := &fakePruner{}
disp := &recordingDispatcher{}
cfg := runners.WorktreePruneConfig{IdleThreshold: 7 * 24 * time.Hour, WarningLead: 3 * 24 * time.Hour}
r := runners.NewWorktreePrune(repo, gitr, disp, cfg, discardLogger())
r.Run(context.Background())
assert.Empty(t, repo.markedWarning)
assert.Empty(t, repo.tryStartCalled)
assert.Empty(t, repo.finalized)
assert.Zero(t, gitr.calls)
assert.Empty(t, disp.msgs)
}
func TestWorktreePrune_CASLostSkipsSilently(t *testing.T) {
t.Parallel()
id := uuid.New()