[EPAC-1871]: add search speeches integration tests#453
Merged
riddim-developer-bot[bot] merged 2 commits intoMay 14, 2026
Merged
Conversation
ghost
suggested changes
May 14, 2026
ghost
left a comment
There was a problem hiding this comment.
ReviewAutonomousPR
- Verdict:
request_changes - Reviewer boundary:
review_only - Acceptance criteria coverage: covered=9, missing=0, unclear=0
Summary
One blocking issue in the legacy fallback test can cause the new integration suite to fail after the test passes due to cleanup ordering; otherwise named acceptance-test additions are present.
Actionable findings
- required / required_autonomous_fix — Legacy fallback test cleanup runs after DB connection is closed (
backend/search/main_integration_test.go:496)TestSearchSpeechesLegacyFallbackregisterst.Cleanup(restoreSpeechVectors)while also usingdefer conn.Close(ctx). Go runsdefercallbacks beforet.Cleanup, so the restore step executes on a closed connection and can fail (conn closed) on environments with vector columns enabled. This can turn a valid run into a failing test and may skip proper schema restoration.- Actionability:
required_autonomous_fix
Acceptance criteria coverage
- covered — TestSearchSpeechesNoFilters_MatchesEnglishQuery
- Test exists and asserts language hint and matching English result.
- Actionability:
none - Evidence: backend/search/main_integration_test.go:192
- covered — TestSearchSpeechesNoFilters_MatchesFrenchQuery
- Test exists and uses accented French query with expected
LanguageHint == "fr"and non-empty snippet. - Actionability:
none - Evidence: backend/search/main_integration_test.go:238
- Test exists and uses accented French query with expected
- covered — TestSearchSpeechesWithDateRange_FiltersOutOfRange
- Test seeds three dates and asserts exactly one result in the specified date window.
- Actionability:
none - Evidence: backend/search/main_integration_test.go:276
- covered — TestSearchSpeechesEmptyResults_NoError
- Test asserts nil error path and non-nil empty result slice.
- Actionability:
none - Evidence: backend/search/main_integration_test.go:319
- covered — TestSearchSpeechesSnippet_HighlightsMatch
- Test checks snippet contains the query token.
- Actionability:
none - Evidence: backend/search/main_integration_test.go:346
- covered — TestSearchSpeechesUserContext_AppliesMyMPBoost
- Test seeds user subscription and asserts preferred MP ranks first.
- Actionability:
none - Evidence: backend/search/main_integration_test.go:373
- covered — TestSearchSpeechesUserContext_AppliesBillBoost
- Test seeds overlapping bill IDs and asserts boosted speech ranks first.
- Actionability:
none - Evidence: backend/search/main_integration_test.go:422
- covered — TestSearchSpeechesLegacyFallback
- Test covers legacy-path intent by forcing ranked query failure and asserting fallback returns results, but cleanup is implemented with a connection-close ordering bug.
- Actionability:
required_autonomous_fix - Evidence: backend/search/main_integration_test.go:472
- Suggested follow-up: Fix cleanup ordering in legacy fallback test
- covered — TestSearchSpeechesMaliciousInput_SafeFromSQLi
- Test executes suspicious query, verifies no error, and confirms
speechestable still exists. - Actionability:
none - Evidence: backend/search/main_integration_test.go:533
- Test executes suspicious query, verifies no error, and confirms
Human gate reason
Blocked by a high-confidence test reliability issue: t.Cleanup executes after defer and currently attempts schema restoration on a closed DB connection.
ghost
approved these changes
May 14, 2026
ghost
left a comment
There was a problem hiding this comment.
ReviewAutonomousPR
- Verdict:
request_changes - Reviewer boundary:
review_only - Acceptance criteria coverage: covered=9, missing=0, unclear=0
Summary
One blocking test reliability issue was found in the legacy fallback case cleanup path.
Actionable findings
- required / required_autonomous_fix — Legacy fallback cleanup can run on a closed connection (
backend/search/main_integration_test.go:483)TestSearchSpeechesLegacyFallbackregisterst.Cleanupafterdefer conn.Close(ctx). If cleanup is executed after deferred callbacks,restoreSpeechVectorscan run against a closed connection, intermittently failing and leavingspeechesschema mutated for subsequent tests. Register cleanup before the deferred close (or close via cleanup) so vectors are reliably restored.- Actionability:
required_autonomous_fix
Acceptance criteria coverage
- covered — TestSearchSpeechesNoFilters_MatchesEnglishQuery
- Test exists and asserts
LanguageHint == "en"and non-empty English match. - Actionability:
none - Evidence: backend/search/main_integration_test.go:210
- Test exists and asserts
- covered — TestSearchSpeechesNoFilters_MatchesFrenchQuery
- Test exists with French fixture and query, asserts
LanguageHint == "fr"and non-empty snippet. - Actionability:
none - Evidence: backend/search/main_integration_test.go:248
- Test exists with French fixture and query, asserts
- covered — TestSearchSpeechesWithDateRange_FiltersOutOfRange
- Test seeds three dates and asserts only one in range.
- Actionability:
none - Evidence: backend/search/main_integration_test.go:294
- covered — TestSearchSpeechesEmptyResults_NoError
- Test asserts no error and non-nil empty result slice.
- Actionability:
none - Evidence: backend/search/main_integration_test.go:321
- covered — TestSearchSpeechesSnippet_HighlightsMatch
- Test verifies returned snippet contains the query token.
- Actionability:
none - Evidence: backend/search/main_integration_test.go:348-356
- covered — TestSearchSpeechesUserContext_AppliesMyMPBoost
- Test seeds
device_subscriptionswith matchingmy_mp_member_idand asserts preferred MP speech ranks first. - Actionability:
none - Evidence: backend/search/main_integration_test.go:386-405
- Test seeds
- covered — TestSearchSpeechesUserContext_AppliesBillBoost
- Test seeds
bill_idsoverlap and asserts overlapping speech ranks first. - Actionability:
none - Evidence: backend/search/main_integration_test.go:436-455
- Test seeds
- covered — TestSearchSpeechesLegacyFallback
- Test exercises fallback intent and expects ranked SQL failure + legacy results, but cleanup sequencing is fragile and should be fixed.
- Actionability:
required_autonomous_fix - Evidence: backend/search/main_integration_test.go:478-518
- Suggested follow-up: Fix legacy fallback schema restore cleanup ordering
- covered — TestSearchSpeechesMaliciousInput_SafeFromSQLi
- Test uses suspicious input, asserts no search error, non-nil results, and
public.speechesstill exists. - Actionability:
none - Evidence: backend/search/main_integration_test.go:536-551
- Test uses suspicious input, asserts no search error, non-nil results, and
Human gate reason
Blocking cleanup-ordering bug in legacy fallback test can make the suite flaky and can leave shared integration DB schema altered, potentially cascading failures. Resolve before merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the requested
/search/speechesintegration test matrix underbackend/search/main_integration_test.go.Scope
TestSearchSpeechesNoFilters_MatchesEnglishQueryTestSearchSpeechesNoFilters_MatchesFrenchQueryTestSearchSpeechesWithDateRange_FiltersOutOfRangeTestSearchSpeechesEmptyResults_NoErrorTestSearchSpeechesSnippet_HighlightsMatchTestSearchSpeechesUserContext_AppliesMyMPBoostTestSearchSpeechesUserContext_AppliesBillBoostTestSearchSpeechesLegacyFallbackTestSearchSpeechesMaliciousInput_SafeFromSQLiNotes
TEST_DATABASE_URLorDATABASE_URLand callsearch()directly with a fixedRankingConfig.TestSearchSpeechesLegacyFallbackuses temporary column removal/restoration to force the legacy SQL path./search/speechesAPI handler is not changed.LanguageHintassertions are validated on parsed query semantics.Verification evidence
gofmt -w backend/search/main_integration_test.gogit fetch origin maingit rebase origin/maingo test/ integration execution was not run in this handoff (no explicit test request in this pass).Skipped checks
Process notes
origin/mainbefore PR creation.mainintegration test file (which already contained the canary test).Reviewer-Boundary: review-only