(t *testing.T)
| 5413 | } |
| 5414 | |
| 5415 | func TestTaskStatusFromPolicySnapshotPrecedence(t *testing.T) { |
| 5416 | t.Parallel() |
| 5417 | |
| 5418 | base := time.Date(2026, 4, 14, 16, 0, 0, 0, time.UTC) |
| 5419 | tests := []struct { |
| 5420 | name string |
| 5421 | currentStatus Status |
| 5422 | unresolvedDependencies bool |
| 5423 | approvalBlocked bool |
| 5424 | pausedBlocked bool |
| 5425 | openBlocks bool |
| 5426 | needsAttention bool |
| 5427 | attemptsExhausted bool |
| 5428 | runs []Run |
| 5429 | want Status |
| 5430 | }{ |
| 5431 | { |
| 5432 | name: "Should keep terminal task status above needs attention", |
| 5433 | currentStatus: TaskStatusCompleted, |
| 5434 | openBlocks: true, |
| 5435 | needsAttention: true, |
| 5436 | want: TaskStatusCompleted, |
| 5437 | }, |
| 5438 | { |
| 5439 | name: "Should keep exhausted failed terminal run above needs attention", |
| 5440 | currentStatus: TaskStatusReady, |
| 5441 | needsAttention: true, |
| 5442 | attemptsExhausted: true, |
| 5443 | runs: []Run{{ |
| 5444 | ID: "run-failed", |
| 5445 | Status: TaskRunStatusFailed, |
| 5446 | Attempt: 2, |
| 5447 | QueuedAt: base, |
| 5448 | }}, |
| 5449 | want: TaskStatusFailed, |
| 5450 | }, |
| 5451 | { |
| 5452 | name: "Should put needs attention above open blocks and queued readiness", |
| 5453 | currentStatus: TaskStatusReady, |
| 5454 | openBlocks: true, |
| 5455 | needsAttention: true, |
| 5456 | runs: []Run{{ |
| 5457 | ID: "run-queued", |
| 5458 | Status: TaskRunStatusQueued, |
| 5459 | Attempt: 1, |
| 5460 | QueuedAt: base, |
| 5461 | }}, |
| 5462 | want: TaskStatusNeedsAttention, |
| 5463 | }, |
| 5464 | { |
| 5465 | name: "Should put blocked above ready", |
| 5466 | currentStatus: TaskStatusReady, |
| 5467 | openBlocks: true, |
| 5468 | want: TaskStatusBlocked, |
| 5469 | }, |
| 5470 | { |
| 5471 | name: "Should derive ready when no blocking inputs remain", |
| 5472 | currentStatus: TaskStatusBlocked, |
nothing calls this directly
no test coverage detected