refactor!: waiting_human becomes waiting_approval, with the approval kind on each task

This commit is contained in:
sam committed 2026-10-24 23:45:20 +11:00
1 parent 1f8a9964c1
commit e8a60c4abd
29 files changed
+229 -183

No files matched your search

@@ -0,0 +1,12 @@
-- A task waiting on an operator decision is waiting_approval; the kind of
-- approval is derived from what it waits on (a plan or a review gate).
-- +goose Up
UPDATE tasks SET status = 'waiting_approval' WHERE status = 'waiting_human';
UPDATE transitions SET from_status = 'waiting_approval' WHERE from_status = 'waiting_human';
UPDATE transitions SET to_status = 'waiting_approval' WHERE to_status = 'waiting_human';
-- +goose Down
UPDATE tasks SET status = 'waiting_human' WHERE status = 'waiting_approval';
UPDATE transitions SET from_status = 'waiting_human' WHERE from_status = 'waiting_approval';
UPDATE transitions SET to_status = 'waiting_human' WHERE to_status = 'waiting_approval';
@@ -31,7 +31,7 @@ func recordTransition(ctx context.Context, q *postgresdb.Queries, p postgresdb.I
// needsHuman reports whether a task in status, parked with class, is waiting
// on an operator's decision.
func needsHuman(status, class string) bool {
return status == workflow.StatusWaitingHuman || (status == workflow.StatusParked && class == taskstate.ParkNeedsHuman)
return status == workflow.StatusWaitingApproval || (status == workflow.StatusParked && class == taskstate.ParkNeedsHuman)
}
// failed reports whether a task in status, parked with class, will not
@@ -41,8 +41,8 @@ func failed(status, class string) bool {
}
func syncTaskAlerts(ctx context.Context, q *postgresdb.Queries, p postgresdb.InsertTransitionParams) error {
leaving := p.FromStatus == workflow.StatusWaitingHuman || p.FromStatus == workflow.StatusParked
if !leaving && p.ToStatus != workflow.StatusWaitingHuman && p.ToStatus != workflow.StatusParked && p.ToStatus != workflow.StatusDead {
leaving := p.FromStatus == workflow.StatusWaitingApproval || p.FromStatus == workflow.StatusParked
if !leaving && p.ToStatus != workflow.StatusWaitingApproval && p.ToStatus != workflow.StatusParked && p.ToStatus != workflow.StatusDead {
return nil
}
info, err := q.TaskAlertInfo(ctx, p.TaskID)