Never prune queued/running builds; dedup manual triggers
Two defects seen live on vm4006 when a merged branch was deleted from origin while its last build still ran: - The result prune removed the PENDING/RUNNING entries of branches gone from origin, so the executing build vanished from UI and history and the queue looked stuck. Prune now never touches a PENDING or RUNNING entry (worktrees were already protected). The startup recovery closes out an orphaned PENDING of a gone branch as INTERRUPTED, so the new immunity cannot leak entries. - The apparent hang invited restart clicks, and each click stacked another build of the same commit. startBuild now returns the already queued or executing build of the same branch and commit instead of a duplicate; cancel-requested builds do not block re-queueing, and re-running a finished build stays possible. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -420,6 +420,20 @@ class WatcherTest : FunSpec() {
|
||||
harness.startedBuilds shouldContainExactly listOf("main" to "commit-2")
|
||||
}
|
||||
|
||||
test("startup recovery closes out an orphaned PENDING build of a branch gone from origin") {
|
||||
val harness = Harness()
|
||||
val orphan = harness.seed("gone", BuildStatus.PENDING, commit = "commit-1")
|
||||
|
||||
harness.watcher.recoverOnStartup(harness.workingDir)
|
||||
|
||||
// PENDING is prune-immune; left as-is, the gone branch could never be pruned
|
||||
harness.startedBuilds.shouldBeEmpty()
|
||||
harness.repository
|
||||
.history()
|
||||
.first { it.artifactKey == orphan.artifactKey }
|
||||
.status shouldBe BuildStatus.INTERRUPTED
|
||||
}
|
||||
|
||||
test("poll prunes results, artifacts, and worktrees of branches gone from origin") {
|
||||
val harness = Harness()
|
||||
harness.seed("main", BuildStatus.SUCCESS, commit = "commit-1")
|
||||
|
||||
Reference in New Issue
Block a user