D4b: a row that a candidate taken out ends its check with a named cause, so the asker drops its asks (ADR 0664 §5, issue 1748)

Claude-Session: https://claude.ai/code/session_01JG73KEq4zoDfM9WtYpcQgZ
This commit is contained in:
2026-11-09 23:17:05 +01:00
parent 8195da08e8
commit c072a271e5
@@ -3,6 +3,7 @@ package check
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"sync"
@@ -362,6 +363,20 @@ func TestARepositoryWithNoTrunkCannotBeJudgedLoudlyUntilItsTrunkIsKnown(t *testi
}
})
}
// ADR 0664 §5 (issue 1748): a candidate taken out (its pull request merged or closed) ends the check running for it with a
// cause its asks' wait names, never a plain cancel, so its asker drops the asks it put on the build nodes.
t.Run("a candidate taken out ends its check with a named cause", func(t *testing.T) {
ch := &Checker{}
ch.init()
run, end := context.WithCancelCause(context.Background())
ch.live["g.heads"] = liveCheck{group: "g", end: end}
ch.Forget("g")
var s superseded
if cause := context.Cause(run); !errors.As(cause, &s) || s.by != "" || errors.Is(cause, context.Canceled) {
t.Errorf("the check was ended with %v, want superseded with no heads, not a plain cancel", cause)
}
})
}
func countWith(lines []string, words string) int {