Skip to content

Commit 4bbe0cb

Browse files
authored
Fix broken UI by setting FinishedAt again (#550)
This was a left-in "debug removal" that I added in 348c49a#diff-e7d4e9760b2767b61760170f3620004882b9fa493251c3619f15d68534891e75L142 It broke the UI. I'll release a new version right after merging this.
1 parent 4655b98 commit 4bbe0cb

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All notable changes to `src-cli` are documented in this file.
1818
### Fixed
1919

2020
- The step-wise caching for `src batch [apply|preview]` introduced in 3.28.1 could break if a cached diff contained quoted. This fixes the application by disabling any unquoting/expansion.
21+
- A regression was introduced in 3.28.1 that broke the UI for `src batch [apply|preview]` and lead to the execution of steps looking like it got stuck in the first repository.
2122

2223
### Removed
2324

internal/batches/executor/executor.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func (x *executor) do(ctx context.Context, task *Task, status taskStatusHandler)
140140
// Ensure that the status is updated when we're done.
141141
defer func() {
142142
status.Update(task, func(status *TaskStatus) {
143+
status.FinishedAt = time.Now()
143144
status.CurrentlyExecuting = ""
144145
status.Err = err
145146
})

internal/batches/executor/executor_test.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func TestExecutor_Integration(t *testing.T) {
340340

341341
executor := newExecutor(opts)
342342

343-
statusHandler := NewTaskStatusCollection([]*Task{})
343+
statusHandler := NewTaskStatusCollection(tc.tasks)
344344

345345
// Run executor
346346
executor.Start(context.Background(), tc.tasks, statusHandler)
@@ -426,6 +426,21 @@ func TestExecutor_Integration(t *testing.T) {
426426
}
427427
}
428428
}
429+
430+
// Make sure that all the TaskStatus have been updated correctly
431+
statusHandler.CopyStatuses(func(statuses []*TaskStatus) {
432+
for i, status := range statuses {
433+
if status.StartedAt.IsZero() {
434+
t.Fatalf("status %d: StartedAt is zero", i)
435+
}
436+
if status.FinishedAt.IsZero() {
437+
t.Fatalf("status %d: FinishedAt is zero", i)
438+
}
439+
if status.CurrentlyExecuting != "" {
440+
t.Fatalf("status %d: CurrentlyExecuting not reset", i)
441+
}
442+
}
443+
})
429444
})
430445
}
431446
}

0 commit comments

Comments
 (0)