test(webhook): integration test for force-merge-on-MAX_ROUNDS path #145
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!145
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/140"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
src/force-merge.integration.test.tswith 4 integration tests that drive the fullhandleChangesRequested → guardAuthorDispatch → dispatchMerge({ force: true })chain end-to-end⚠️ FORCE MERGE — review-loop terminator, no address-review sent to author, capped comment posted on PRmock.module("./main")harness aswebhook-ci.test.tsCloses #140
Adds src/force-merge.integration.test.ts with 4 tests that drive the full handleChangesRequested → guardAuthorDispatch → dispatchMerge({force: true}) path end-to-end, catching regressions in the MAX_ROUNDS terminator. Closes #140 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>✅ Approved
CI: Green (run #1720, SHA
235a5bf, 3m15s).Round: 1 of 1 (no prior reviews from me).
Acceptance criteria — all met
force-merge.integration.test.tstitledhandleChangesRequested MAX_ROUNDS force-merge pathGET /pulls/:n(mergeable),GET /pulls/:n/reviews(MAX_ROUNDS REQUEST_CHANGES),POST /issues/:n/comments(201)mock.module("./main")capturing dispatch calls"⚠️ FORCE MERGE — review-loop terminator"Code review
Logic is correct end-to-end:
forgejo-api.tsandwebhook-ci.tsboth pick up the spy — consistent with thewebhook-ci.test.tsharness.prMergeableshort-circuit:GET /pulls/:nreturnsmergeable: true, sodispatchRebaseIfNotMergeableexits early without hittingskillForEvent— no skill-file read in the force-merge tests.reviewerForAuthor("dev")→"reviewer"(default); reviews constructed withuser: { login: "reviewer" }— count matches.dispatchMergetask text: production code prepends"⚠️ FORCE MERGE — review-loop terminator"verbatim;toStartWith(...)assertion is exact."Review loop capped","auto-merging","reviewer",String(MAX_ROUNDS)) match whatpostForceMergeCommentactually produces.expect(commentCalls).toHaveLength(0)), not just relying on the missing handler returning 404.Minor nit (non-blocking)
src/force-merge.integration.test.ts, test 3 — the comment// Fence-post: MAX_ROUNDS-1 must NOT trigger force-merge; MAX_ROUNDS mustand the titletriggers at exactly ${MAX_ROUNDS} rounds (not MAX_ROUNDS-1)imply the test verifies both sides of the boundary, but the body only exercises the MAX_ROUNDS side (identical to test 1). The MAX_ROUNDS-1 case is correctly covered in the separatebelow MAX_ROUNDSdescribe block, so overall coverage is complete — the title just over-promises. Consider renaming totriggers at exactly MAX_ROUNDS rounds (fence-post high side)or collapsing tests 1 and 3 into a single parametrised boundary check. Not a correctness issue; will not block merge.