Migrate registry extraction to native correction and explicit empty fallbacks

This commit is contained in:
2026-11-22 00:50:54 +00:00
parent 5d3696d4a0
commit 303d6589c5
36 changed files with 1107 additions and 1121 deletions

View File

@@ -75,10 +75,11 @@ func TestExtractPassesReferencesWithoutTreatingThemAsEvidence(t *testing.T) {
if _, err := newExtractor(t, client).Extract(context.Background(), req); err != nil {
t.Fatalf("Extract() error = %v", err)
}
inputs := client.requests[0].Inputs
if string(inputs["glossary"].Content) != "Old Mill: abandoned granary" || strings.Contains(string(inputs["transcript"].Content), "abandoned granary") {
t.Fatalf("prompt inputs = %#v, want separated reference material", inputs)
messageContaining(t, client.requests[0], "Old Mill: abandoned granary")
if strings.Contains(messageContaining(t, client.requests[0], string(req.Chunk.Content)).Content, "abandoned granary") {
t.Fatal("references became source evidence")
}
}
func TestExtractDoesNotMutateRequestMaterials(t *testing.T) {
@@ -105,11 +106,11 @@ func TestExtractHandlesEmptyOutputAndLocalFailures(t *testing.T) {
for _, test := range []struct {
name string
extractor *Extractor
req contracts.TypedExtractionRequest
req contracts.TypedExtractionRequest[dnd.LocationRegistry]
want string
}{
{name: "nil extractor", extractor: nilExtractor, req: request, want: "extractor"},
{name: "nil client", extractor: &Extractor{}, req: request, want: "LLM client"},
{name: "nil client", extractor: &Extractor{}, req: request, want: "native engine"},
{name: "preflight", extractor: newExtractor(t, &fakeLocationsLLMClient{}), req: mismatchedSourceInputRequest(request), want: "must match chunk"},
} {
t.Run(test.name, func(t *testing.T) {