fix(coderd)!: only show task status for current build (#19966)

This changes the task get endpoint to omit app statuses for previous
'lifetimes' of a workspace.

It also introduces a [breaking
change](https://github.com/coder/coder/blob/release/2.26/codersdk/aitasks.go#L83)
to bring `TaskStateComplete` in line with
`WorkspaceAppStatusStateComplete`. I can alternatively revert this
change and add a conversion function between the two SDK types.
This commit is contained in:
Cian Johnston
2025-09-26 10:14:37 +01:00
committed by GitHub
parent 930bbaf035
commit eb55f0ab19
5 changed files with 71 additions and 27 deletions
+6 -6
View File
@@ -96,9 +96,9 @@ func Test_TaskStatus(t *testing.T) {
STATE CHANGED STATUS STATE MESSAGE
4s ago running
3s ago running working Reticulating splines...
2s ago running completed Splines reticulated successfully!
2s ago stopping completed Splines reticulated successfully!
2s ago stopped completed Splines reticulated successfully!`,
2s ago running complete Splines reticulated successfully!
2s ago stopping complete Splines reticulated successfully!
2s ago stopped complete Splines reticulated successfully!`,
hf: func(ctx context.Context, now time.Time) func(http.ResponseWriter, *http.Request) {
var calls atomic.Int64
return func(w http.ResponseWriter, r *http.Request) {
@@ -143,7 +143,7 @@ STATE CHANGED STATUS STATE MESSAGE
CreatedAt: now.Add(-5 * time.Second),
UpdatedAt: now.Add(-4 * time.Second),
CurrentState: &codersdk.TaskStateEntry{
State: codersdk.TaskStateCompleted,
State: codersdk.TaskStateComplete,
Timestamp: now.Add(-2 * time.Second),
Message: "Splines reticulated successfully!",
},
@@ -155,7 +155,7 @@ STATE CHANGED STATUS STATE MESSAGE
CreatedAt: now.Add(-5 * time.Second),
UpdatedAt: now.Add(-1 * time.Second),
CurrentState: &codersdk.TaskStateEntry{
State: codersdk.TaskStateCompleted,
State: codersdk.TaskStateComplete,
Timestamp: now.Add(-2 * time.Second),
Message: "Splines reticulated successfully!",
},
@@ -167,7 +167,7 @@ STATE CHANGED STATUS STATE MESSAGE
CreatedAt: now.Add(-5 * time.Second),
UpdatedAt: now,
CurrentState: &codersdk.TaskStateEntry{
State: codersdk.TaskStateCompleted,
State: codersdk.TaskStateComplete,
Timestamp: now.Add(-2 * time.Second),
Message: "Splines reticulated successfully!",
},