Verify the reliability sprint and guard release checkout validation

This commit is contained in:
2026-11-16 15:19:59 +00:00
parent 11f314d995
commit a355f05a27
15 changed files with 322 additions and 334 deletions

View File

@@ -7,7 +7,6 @@ import (
"os"
"path/filepath"
"reflect"
"strconv"
"strings"
"sync"
"testing"
@@ -451,34 +450,6 @@ func TestRunnerProposalsExecutePerChunkSection(t *testing.T) {
}
}
func waitForRunnerEntries(t *testing.T, entered <-chan struct{}, want int, label string) {
t.Helper()
deadline := time.After(350 * time.Millisecond)
got := 0
for got < want {
select {
case <-entered:
got++
case <-deadline:
t.Fatalf("timed out waiting for %d entries (%s), got %d", want, label, got)
}
}
}
func waitForRunnerSectionIDs(t *testing.T, started <-chan int, want map[int]struct{}) {
t.Helper()
deadline := time.After(350 * time.Millisecond)
seen := map[int]struct{}{}
for len(seen) < len(want) {
select {
case id := <-started:
seen[id] = struct{}{}
case <-deadline:
t.Fatalf("timed out waiting for section IDs %v, got %v", mapKeys(want), mapKeys(seen))
}
}
}
func mapKeys(values map[int]struct{}) []int {
keys := make([]int, 0, len(values))
for key := range values {
@@ -563,60 +534,6 @@ func TestRunnerValidationStartsBeforeAllSectionProposalsComplete(t *testing.T) {
}
}
type stageAwareStructuredClient struct {
startedSection chan int
releaseValidation <-chan struct{}
eventSink chan<- string
}
type captureContractStructuredClient struct {
lastRequest contracts.StructuredCompletionRequest
}
func (c *captureContractStructuredClient) CompleteStructured(ctx context.Context, req contracts.StructuredCompletionRequest, out any) (contracts.StructuredCompletionResponse, error) {
_ = ctx
c.lastRequest = req
if target, ok := out.(*validators.LLMValidationResponse); ok {
*target = validators.LLMValidationResponse{
Validations: []validators.LLMValidationDecision{
{CorrectionIndex: "1", Approved: true, Reason: "ok"},
},
}
}
return contracts.StructuredCompletionResponse{}, nil
}
func (c *stageAwareStructuredClient) CompleteStructured(ctx context.Context, req contracts.StructuredCompletionRequest, out any) (contracts.StructuredCompletionResponse, error) {
section := 0
if req.Context.SectionIndex != nil {
section = *req.Context.SectionIndex
}
if c.startedSection != nil {
select {
case c.startedSection <- section:
default:
}
}
if c.eventSink != nil {
c.eventSink <- "v" + strconv.Itoa(section)
}
if c.releaseValidation != nil {
select {
case <-c.releaseValidation:
case <-ctx.Done():
return contracts.StructuredCompletionResponse{}, ctx.Err()
}
}
target := out.(*validators.LLMValidationResponse)
*target = validators.LLMValidationResponse{
Validations: []validators.LLMValidationDecision{
{CorrectionIndex: "1", Approved: true, Reason: "ok"},
},
}
return contracts.StructuredCompletionResponse{}, nil
}
func TestRunnerSkippedRecorded(t *testing.T) {
transcript := &schema.Transcript{Segments: []schema.Segment{{ID: 1, Speaker: "A", Start: 0, End: 1, Text: "word word"}}}
r := New(fakeFactory{modules: map[string]contracts.TranscriptModule{