[EPAC-1872]: Add integration tests for /api/v1/members/{id}/speeches handler#454
Merged
riddim-developer-bot[bot] merged 5 commits intoMay 14, 2026
Conversation
There was a problem hiding this comment.
ReviewAutonomousPR
- Verdict:
request_changes - Reviewer boundary:
review_only - Acceptance criteria coverage: covered=5, missing=1, unclear=0
Summary
Found blockers: a compiled binary artifact is introduced in the handler module, and the per-page-bound test does not match the stated acceptance criteria around max clamping.
Actionable findings
- required / required_autonomous_fix — Remove committed build artifact from repository (
/Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/member-speeches)backend/member-speeches/member-speechesis a 22MB Mach-O executable added as a tracked file. This is a generated build artifact and should not be committed; it materially bloats the PR and can be accidentally executed in packaging/CI contexts.- Actionability:
required_autonomous_fix
- required / required_autonomous_fix —
TestMemberSpeechesPerPageBounddoes not validate the documented max behavior (/Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:159)- The acceptance criteria require asserting the handler clamps
per_pageto its declared max (100). The test currently assertsper_pagefalls back to default 20 for999, which codifies the current implementation quirk rather than guarding the AC contract. If the handler regresses to another behavior, this test won’t catch it. - Actionability:
required_autonomous_fix
- The acceptance criteria require asserting the handler clamps
Acceptance criteria coverage
- covered — TestMemberSpeechesHappyPath_ReturnsPagedResults — seed 25 speeches..., assert total/pages/len and 10 newest IDs
- Happy-path pagination assertions for total, pages, length, and descending ID order are present.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:60-88
- covered — TestMemberSpeechesPagination_LastPagePartial — page=3/per_page=10 -> len=5, pages=3
- Assertion set for both result length and computed pages.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:91-104
- covered — TestMemberSpeechesPagination_PageBeyondLast_ReturnsEmpty — page=10/per_page=10 -> HTTP 200, len=0, total remains real count
- Status, empty results, and total retention are asserted.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:107-124
- covered — TestMemberSpeechesUnknownMember_ReturnsEmptyShape — unknown member returns HTTP 200, total=0, pages=0, len=0, stats non-nil object
- Assertions cover status and all required shape fields; stats non-null is checked via response-content guard.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:127-151
- missing — TestMemberSpeechesPerPageBound — verifies declared per_page cap is enforced
- Test currently verifies fallback-to-default=20 behavior for
per_page=999; it does not assert the declared max limit value from the source. - Actionability:
required_autonomous_fix - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:154-167
- Suggested follow-up: Align test with explicit max-clamp contract
- Test currently verifies fallback-to-default=20 behavior for
- covered — TestMemberSpeechesStats_AggregatesCorrectly — seeds 3 dates/2 topics and asserts aggregated stats
- Test seeds distinct dates/topics and asserts aggregate totals plus top topic result, matching available handler stats surface.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:170-192
Human gate reason
Requesting changes because acceptance criteria are not fully satisfied and a generated executable artifact was added to version control.
added 3 commits
May 14, 2026 18:52
…mp per_page, remove binary - Extract handler DB logic into queryMemberSpeeches(ctx, conn, ...) so integration tests call it directly with the WithTx connection, bypassing getDBConn/Ping - Change per_page handling from silent-fallback to clamp: values >maxPerPage (100) are clamped to 100 rather than falling back to the default 20 - Rewrite integration tests to use queryMemberSpeeches; remove dbConn override - TestMemberSpeechesPerPageBound now seeds >100 speeches and asserts len==maxPerPage - Remove committed Mach-O build artifact backend/member-speeches/member-speeches
d2afe65 to
28b45d6
Compare
- Fix queryMemberSpeeches to scan filename and content as *string so NULL values from test fixtures don't crash with "cannot scan NULL into *string" - Remove re-committed Mach-O binary backend/member-speeches/member-speeches - Add .gitignore to prevent future WIP recovery sessions from re-committing it
There was a problem hiding this comment.
ReviewAutonomousPR
- Verdict:
request_changes - Reviewer boundary:
review_only - Acceptance criteria coverage: covered=5, missing=1, unclear=0
Summary
The PR is blocked because the per-page boundary test no longer verifies the documented handler contract and can miss regressions in request-time clamping.
Actionable findings
- required / required_autonomous_fix — Per-page bound test bypasses request parsing and does not assert clamp behavior (
/Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:160)TestMemberSpeechesPerPageBoundinvokesqueryMemberSpeechesdirectly withmaxPerPage, so it never exercises theper_pagerequest parsing path that applies clamping inHandleRequest. A regression in clamp behavior (e.g. fallback behavior or changed max) would not be caught. The test should call the handler withper_page=999(or equivalent) and assert the response/page value is capped atmaxPerPageand response length matches that cap.- Actionability:
required_autonomous_fix
Acceptance criteria coverage
- covered — TestMemberSpeechesHappyPath_ReturnsPagedResults
- Covers seeding 25 rows, page=1/per_page=10, validates total/pages/len and newest-10 ordering assumption.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:31-58
- covered — TestMemberSpeechesPagination_LastPagePartial
- Covers last-page partial result and page-count assertions with seeded 25-row dataset.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:61-81
- covered — TestMemberSpeechesPagination_PageBeyondLast_ReturnsEmpty
- Covers out-of-range page returns with retained total and empty page payload.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:84-103
- covered — TestMemberSpeechesUnknownMember_ReturnsEmptyShape
- Covers zero-count shape assertions and zero-value stats checks for unknown member.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:106-141
- missing — TestMemberSpeechesPerPageBound
- The test currently does not invoke
HandleRequestwithper_page=999; it passes the already-clamped constant into the query helper, so declared max-clamp contract is not validated. - Actionability:
required_autonomous_fix - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:144-166
- Suggested follow-up: Rewrite this test to assert
per_pageclamp through handler request parsing
- The test currently does not invoke
- covered — TestMemberSpeechesStats_AggregatesCorrectly
- Validates multi-date/ multi-topic fixture and expected aggregated totals/top topic behavior.
- Actionability:
none - Evidence: /Users/sunny/code/epac/.symphony/workspaces/EPAC-1872/backend/member-speeches/main_integration_test.go:169-195
Human gate reason
request_changes because the per-page-bound acceptance criterion is not enforced at the handler/query-contract level, leaving a regression risk in clamping behavior uncaught.
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.
Why
The member-speeches handler's pagination math, stats aggregation, and DB query ordering were not exercised against a real schema. Off-by-one paging errors and aggregation bugs could ship silently. This PR adds 6 DB-backed integration tests using the shared `_testdb` harness from EPAC-1869.
What changed
Tests implemented
Trade-offs not taken
Verification
Integration tests require Postgres sidecar; validated by CI `test-integration` job.
Definition of Done evidence
Flipping `ORDER BY sitting_date DESC` to `ASC` fails `TestMemberSpeechesHappyPath_ReturnsPagedResults` (IDs would be `sp-001..sp-010` instead of `sp-025..sp-016`).
Resolves EPAC-1872
Reviewer-Boundary: review-only