Complete the core operation execution cutover
This commit is contained in:
@@ -17,7 +17,7 @@ func TestExtractMapsExactlyOneSceneToTheChunk(t *testing.T) {
|
||||
Kind: dnd.SceneKindCombat, Title: " Fight at the Watchtower ", Summary: " Bandits attack the party. ",
|
||||
}}
|
||||
request := extractionRequest()
|
||||
result, err := newExtractor(t, client).Extract(context.Background(), request)
|
||||
result, err := runExtraction(newExtractor(t, client), context.Background(), request)
|
||||
if err != nil {
|
||||
t.Fatalf("Extract() error = %v, want nil", err)
|
||||
}
|
||||
@@ -43,7 +43,7 @@ func TestExtractMapsExactlyOneSceneToTheChunk(t *testing.T) {
|
||||
func TestExtractPassesOptionalReferencesAndUsesEmptyPlaceholders(t *testing.T) {
|
||||
client := &fakeSceneDescriptionsLLMClient{response: extractionResponse{Kind: dnd.SceneKindNarrative, Title: "Arrival", Summary: "The party arrives."}}
|
||||
req := extractionRequest()
|
||||
if _, err := newExtractor(t, client).Extract(context.Background(), req); err != nil {
|
||||
if _, err := runExtraction(newExtractor(t, client), context.Background(), req); err != nil {
|
||||
t.Fatalf("Extract() error = %v, want nil", err)
|
||||
}
|
||||
req.References = contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
@@ -51,7 +51,7 @@ func TestExtractPassesOptionalReferencesAndUsesEmptyPlaceholders(t *testing.T) {
|
||||
"party": {Slot: contracts.ReferenceSlot{Name: "party"}, Items: []contracts.ReferenceItem{{SlotName: "party", Content: []byte("Mira: ranger")}}},
|
||||
"glossary": {Slot: contracts.ReferenceSlot{Name: "glossary"}, Items: []contracts.ReferenceItem{{SlotName: "glossary", Content: []byte("Greencloak: local title")}}},
|
||||
}}
|
||||
if _, err := newExtractor(t, client).Extract(context.Background(), req); err != nil {
|
||||
if _, err := runExtraction(newExtractor(t, client), context.Background(), req); err != nil {
|
||||
t.Fatalf("Extract() error = %v, want nil", err)
|
||||
}
|
||||
var text string
|
||||
@@ -72,7 +72,7 @@ func TestExtractReturnsSemanticallyInvalidResponseForDeterministicValidation(t *
|
||||
client := &fakeSceneDescriptionsLLMClient{response: extractionResponse{
|
||||
Kind: dnd.SceneKindNarrative, Title: " ", Summary: "",
|
||||
}}
|
||||
result, err := newExtractor(t, client).Extract(context.Background(), extractionRequest())
|
||||
result, err := runExtraction(newExtractor(t, client), context.Background(), extractionRequest())
|
||||
if err != nil {
|
||||
t.Fatalf("Extract() error = %v, want nil", err)
|
||||
}
|
||||
@@ -89,20 +89,20 @@ func TestExtractValidatesRequestsAndSurfacesProviderFailures(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
extractor *extractionFixture
|
||||
req contracts.TypedExtractionRequest[dnd.SceneDescriptionList]
|
||||
req extractionTestInput
|
||||
want string
|
||||
}{
|
||||
{name: "nil extractor", extractor: nilExtractor, req: request, want: "extractor"},
|
||||
{name: "wrapped preflight failure", extractor: extractor, req: mismatchedSourceInputRequest(request), want: "must match chunk"},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if _, err := test.extractor.Extract(context.Background(), test.req); err == nil || !strings.Contains(err.Error(), "dnd scene descriptions") || !strings.Contains(err.Error(), test.want) {
|
||||
if _, err := runExtraction(test.extractor, context.Background(), test.req); err == nil || !strings.Contains(err.Error(), "dnd scene descriptions") || !strings.Contains(err.Error(), test.want) {
|
||||
t.Fatalf("Extract() error = %v, want contextual validation error", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
failure := errors.New("provider unavailable")
|
||||
_, err := newExtractor(t, &fakeSceneDescriptionsLLMClient{err: failure}).Extract(context.Background(), request)
|
||||
_, err := runExtraction(newExtractor(t, &fakeSceneDescriptionsLLMClient{err: failure}), context.Background(), request)
|
||||
if !errors.Is(err, failure) {
|
||||
t.Fatalf("provider Extract() error = %v, want contextual provider error", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user