Require route evidence in displayed snippets
CI / test (push) Successful in 1m38s
CI / test (pull_request) Failing after 55s

This commit is contained in:
m
2026-08-25 23:57:50 +03:00
parent d7afd5be34
commit 24916aa8f7
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -1838,8 +1838,11 @@ func researchFindingMatchesIntent(query string, finding epistemics.ResearchFindi
if len(routeTerms) < 2 {
return true
}
// A route-looking URL or page title alone is not enough for a human-facing
// answer: the displayed excerpt itself must support both endpoints.
excerptEvidence := strings.ToLower(finding.Excerpt.Text)
for _, term := range routeTerms {
if !strings.Contains(evidence, term) {
if !strings.Contains(excerptEvidence, term) {
return false
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ func TestNearestFlightEvidenceRequiresBothRouteEndpointsWhenKnown(t *testing.T)
if !researchFindingMatchesIntent(query, matched) {
t.Fatal("route evidence with both endpoints was rejected")
}
unrelated := epistemics.ResearchFinding{Source: epistemics.Source{Title: "Ближайшие города к Казани"}, Excerpt: epistemics.SourceExcerpt{Text: "Авиабилеты и расстояние до Казани."}}
unrelated := epistemics.ResearchFinding{Source: epistemics.Source{Title: "Рейсы Москва — Казань", Locator: "https://example.test/moscow-kazan"}, Excerpt: epistemics.SourceExcerpt{Text: "Ближайшие к Казани города и расстояние до них."}}
if researchFindingMatchesIntent(query, unrelated) {
t.Fatal("one-ended travel evidence was accepted")
}