refactor!: waiting_human becomes waiting_approval, with the approval kind on each task
This commit is contained in:
1 parent
1f8a9964c1
commit
e8a60c4abd
29 files changed
+229
-183
No files matched your search
@@ -30,13 +30,13 @@ const (
|
||||
// Task lifecycle statuses. The store persists these strings, so they are
|
||||
// part of the on-disk format: renaming one is a migration, not a rename.
|
||||
const (
|
||||
Queued = "queued"
|
||||
Running = "running"
|
||||
WaitingHuman = "waiting_human"
|
||||
PROpen = "pr_open"
|
||||
Merged = "merged"
|
||||
Parked = "parked"
|
||||
Dead = "dead"
|
||||
Queued = "queued"
|
||||
Running = "running"
|
||||
WaitingApproval = "waiting_approval"
|
||||
PROpen = "pr_open"
|
||||
Merged = "merged"
|
||||
Parked = "parked"
|
||||
Dead = "dead"
|
||||
|
||||
// Rejected means the forge closed the pull request without merging it.
|
||||
// It is an outcome archie observed, not a decision an operator made --
|
||||
@@ -61,7 +61,7 @@ func Actions(status string) []Action {
|
||||
actions = []Action{ActionCancel, ActionReject}
|
||||
case Running:
|
||||
actions = []Action{ActionStop, ActionReject}
|
||||
case WaitingHuman:
|
||||
case WaitingApproval:
|
||||
actions = []Action{ActionApprove, ActionReject, ActionRereview}
|
||||
case Parked:
|
||||
actions = []Action{ActionRetry, ActionAbandon, ActionReject}
|
||||
@@ -98,14 +98,35 @@ func CheckAction(status string, action Action) error {
|
||||
return fmt.Errorf("action %q is not available while task is %s", action, status)
|
||||
}
|
||||
|
||||
// CheckApprove allows approval only from WaitingHuman.
|
||||
// CheckApprove allows approval only from WaitingApproval.
|
||||
func CheckApprove(status string) error {
|
||||
if status != WaitingHuman {
|
||||
if status != WaitingApproval {
|
||||
return fmt.Errorf("task is %s, not awaiting approval", status)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Approval kinds: what a task in WaitingApproval asks the operator to decide.
|
||||
const (
|
||||
// ApprovalPlan is a plan from a human.approve step, read as task.plan.
|
||||
ApprovalPlan = "plan"
|
||||
// ApprovalReview is a review gate's findings.
|
||||
ApprovalReview = "review"
|
||||
)
|
||||
|
||||
// ApprovalKind is what a task waits on the operator to approve, or "" when it
|
||||
// is not waiting for approval.
|
||||
func ApprovalKind(status, reviewGate string) string {
|
||||
switch {
|
||||
case status != WaitingApproval:
|
||||
return ""
|
||||
case reviewGate != "":
|
||||
return ApprovalReview
|
||||
default:
|
||||
return ApprovalPlan
|
||||
}
|
||||
}
|
||||
|
||||
// RetryMode is the worktree mode for a retried task's next dispatch. Stored
|
||||
// on the task row.
|
||||
type RetryMode string
|
||||
@@ -203,7 +224,7 @@ func Statuses() []StatusMeta {
|
||||
return []StatusMeta{
|
||||
{ID: Queued, Label: "Queued", Kind: "idle"},
|
||||
{ID: Running, Label: "Running", Kind: "info"},
|
||||
{ID: WaitingHuman, Label: "Waiting on operator", Kind: "warn", NeedsYou: true},
|
||||
{ID: WaitingApproval, Label: "Waiting for approval", Kind: "warn", NeedsYou: true},
|
||||
{ID: PROpen, Label: "In review", Kind: "ok"},
|
||||
{ID: Merged, Label: "Merged", Kind: "ok"},
|
||||
{ID: Completed, Label: "Done", Kind: "ok"},
|
||||
|
||||
@@ -24,11 +24,11 @@ const (
|
||||
// executionTransitions lists every legal execution status move. Terminal
|
||||
// statuses have empty rows.
|
||||
var executionTransitions = map[string][]string{
|
||||
Queued: {Running, Declined},
|
||||
Running: {Queued, WaitingHuman, PROpen, Completed, Parked, Declined},
|
||||
WaitingHuman: {Queued, Declined},
|
||||
Parked: {Queued, Dead, Declined},
|
||||
PROpen: {Merged, Rejected, Queued, Declined},
|
||||
Queued: {Running, Declined},
|
||||
Running: {Queued, WaitingApproval, PROpen, Completed, Parked, Declined},
|
||||
WaitingApproval: {Queued, Declined},
|
||||
Parked: {Queued, Dead, Declined},
|
||||
PROpen: {Merged, Rejected, Queued, Declined},
|
||||
|
||||
Merged: nil,
|
||||
Rejected: nil,
|
||||
|
||||
Reference in new issue
Block a user