Separate runner working state from returned results

This commit is contained in:
2026-11-26 02:04:05 +00:00
parent b0dc84a479
commit d1421a710f
15 changed files with 72 additions and 47 deletions

View File

@@ -199,7 +199,7 @@ func TestRunnerPropagatesLaneFallbackWithoutCountingDependents(t *testing.T) {
}
profile := typedResolutionProfile()
profile.Artifacts = map[string]ArtifactLaneProfile{"affected": affected, "unrelated": unrelated}
output, err := New().Run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input"), Workers: 1})
output, err := New().run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input"), Workers: 1})
if err != nil {
t.Fatal(err)
}
@@ -264,7 +264,7 @@ func TestRunnerAssessesNativeRevisionsWithoutOuterRevalidation(t *testing.T) {
profile.LLMProfile = "chosen"
turns := 1
profile.MaxAdditionalTurns = &turns
output, err := New().Run(context.Background(), RunInput{
output, err := New().run(context.Background(), RunInput{
Prepared: prepareRunnerProfile(t, catalog, profile, engine), RawInput: []byte("input"), SessionID: "runner-session",
Execution: contracts.ExecutionOptions{Execution: &promptkit.ExecutionTargetOverride{Model: "runner-model"}},
})
@@ -298,7 +298,7 @@ func TestRunnerGeneratedFallbackReferencesTaintOnlyActualConsumers(t *testing.T)
{ID: "build", Artifacts: map[string]ArtifactLaneProfile{"producer": producer, "earlier": earlier}},
{ID: "consume", Artifacts: map[string]ArtifactLaneProfile{"consumer": consumer, "later": unrelated}},
}
output, err := New().Run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input"), Workers: 1})
output, err := New().run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input"), Workers: 1})
if err != nil {
t.Fatal(err)
}
@@ -342,7 +342,7 @@ func TestRunnerChunkFallbackTaintsEveryDerivedOperation(t *testing.T) {
permissive := contracts.ModePermissive
profile.Chunk.Mode = &permissive
profile.Artifacts = map[string]ArtifactLaneProfile{"notes": lane}
output, err := New().Run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input")})
output, err := New().run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input")})
if err != nil {
t.Fatal(err)
}
@@ -380,7 +380,7 @@ func TestRunnerDoesNotAcceptModuleFallbackUnderStrictControls(t *testing.T) {
profile := typedResolutionProfile()
profile.Chunk = Binding("fallback-chunk")
profile.Artifacts = map[string]ArtifactLaneProfile{"notes": registerRunnerNotes(t, catalog, runnerNotesProducer{name: "notes", probe: probe})}
output, err := New().Run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input")})
output, err := New().run(context.Background(), RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input")})
if err == nil || output.FallbackCount != 0 || len(output.normalizeOutputs) != 0 || probe.calls["notes/extract"] != 0 {
t.Fatalf("strict controls accepted module fallback: %#v %v", output, err)
}
@@ -394,7 +394,7 @@ func TestRunnerDiscardsDeterministicOutputReturnedAfterCancellation(t *testing.T
lane := registerRunnerNotes(t, catalog, runnerNotesProducer{name: "notes", probe: probe, cancel: cancel})
profile := typedResolutionProfile()
profile.Artifacts = map[string]ArtifactLaneProfile{"notes": lane}
output, err := New().Run(ctx, RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input")})
output, err := New().run(ctx, RunInput{Prepared: prepareRunnerProfile(t, catalog, profile, nil), RawInput: []byte("input")})
if !errors.Is(err, context.Canceled) || output.FallbackCount != 0 || len(output.normalizeOutputs) != 0 || probe.calls["notes/merge"] != 0 || probe.calls["notes/extract/fallback"] != 0 {
t.Fatalf("cancellation = %#v %v, calls %#v", output, err, probe.calls)
}