test(github-personas): integration coverage for self-directed review requests#1482
Merged
aaight merged 1 commit intoJul 10, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
nhopeatall
approved these changes
Jul 10, 2026
nhopeatall
left a comment
Collaborator
There was a problem hiding this comment.
Summary
APPROVE — a clean, well-scoped test-only change that adds a genuine regression guard for the self-directed review-request path (MNG-1747), fully satisfying the work item's acceptance criteria.
Verification
- Backward compatibility:
makeReviewRequestedPayloadgainedsenderLogin: string = prAuthor. The default reproduces the priorsender: { login: prAuthor }behavior, so all three pre-existing 2-arg call sites are unchanged. - Meaningful guard (traced through
src/triggers/github/review-requested.ts): withsender === requested_reviewer === TEST_PERSONAS.reviewer,isSelfDirectedReviewRequestistrue, so the loop-prevention guard (isCascadeBot(sender) && !isSelfDirectedReviewRequest) does not skip and the handler dispatchesreview. If MNG-1746's&& !isSelfDirectedReviewRequestwere reverted,handle()would return a skip (agentType: null) and theexpect(result?.agentType).toBe('review')assertion would fail — exactly the intended regression net. - No cross-test dedup interference: both dispatch tests share the same Redis dedup key (
owner/repo:42:abc123) andtruncateAll()only clears Postgres, buthandle()callsreleaseReviewDispatch()beforeclaimReviewDispatch(), making the tests order-independent. - AC + CI: all five MNG-1747 acceptance criteria met; 7/7 checks green.
No blocking, should-fix, or noteworthy nitpick findings.
🕵️ claude-code · claude-opus-4-8 · run details
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.
Summary
Adds integration test coverage for the self-directed review-request path — where a human contributor whose GitHub account also holds the shared
GITHUB_TOKEN_REVIEWERre-requests their own review (sender === requested_reviewer). This locks in the shared-reviewer-token behavior (MNG-1746) end-to-end against a real Postgres + Redis-backed project so it cannot silently regress.Test-only change — no production code is modified.
Issue: https://linear.app/issue/MNG-1747
(Full URL: https://linear.app/mongrel/issue/MNG-1747/as-a-developer-i-want-integration-test-coverage-for-self-directed)
What changed
tests/integration/github-personas.test.ts:New test case in the
ReviewRequestedTriggerdescribe block:triggers review for a self-directed request (sender === requested_reviewer, shared reviewer token).It seeds the
reviewagent + an enabledscm:review-requestedtrigger config, builds a payload wheresender === requested_reviewer === TEST_PERSONAS.reviewer, and assertsresult?.agentType === 'review'.makeReviewRequestedPayloadgained an explicitsenderoverride — a new optional third parametersenderLoginthat defaults toprAuthor, so all three existing call sites keep their current behavior unchanged. Passing it explicitly lets the payload model a self-directed request (sender === requested_reviewer).Why this is a meaningful regression guard
The existing positive-dispatch test (
triggers review when enabled via DB and persona is requested) uses a non-personasender(external-user), so it never exercises theisCascadeBot(senderLogin) === truebranch. This new case does: the sender is a CASCADE persona, so the naive loop-prevention guard would skip it. Only the self-directed exemption (sender === requested_reviewer) lets it fall through to dispatch. If MNG-1746's relaxed guard were reverted,handle()would return a loop-prevention skip andresult?.agentTypewould no longer be'review', failing this assertion.Testing
ReviewRequestedTriggercases still pass with the modified helper)npx biome check tests/integration/github-personas.test.ts— cleannpm run typecheck— cleanOut of scope
senderoverrideDependencies
Depends on MNG-1746 (self-directed review requests dispatch the review agent) — already merged; the relaxed guard is present in
src/triggers/github/review-requested.ts, which is why theagentType === 'review'assertion holds.🤖 Generated with Claude Code
🕵️ claude-code · claude-opus-4-8 · run details