Context
src/queue/review-evasion.ts has six close-enforcement guards. Four of them — closeReviewEvasionSelfCloseIfReviewed (line 752), closeReviewEvasionDraftConversionIfReviewed (line 912), closeRepeatedDraftCyclingIfDetected (line 1081), closeDraftPrIfPolicyEnabled (line 1238) — call terminalizeActiveReviewTracking(env, repoFullName, pr.number, { onlyIfHeadSha: pr.headSha }) right after a successful enforcement close, marking the PR's active-review row terminal so it isn't left dangling.
closeSynchronizeAmendmentIfPolicyEnabled (maybeCloseSynchronizeAmendment, lines 1271-1368, #synchronize-close-policy) closes the PR (line 1321) and records the audit event (line 1357) but never calls terminalizeActiveReviewTracking. Its own doc comment (lines 1241-1245) explicitly says this guard "enforces on the contributor's OWN PR receiving an ADDITIONAL commit... regardless of what CI/review state that push interrupts" — i.e. this is precisely the guard most likely to fire while a review is still actively tracked on the pre-amendment headSha, yet it's the one guard that leaves that tracking row un-terminalized.
(The doc comment explicitly and separately justifies skipping the moderation-strike call for this guard — that omission is intentional and documented. The terminalizeActiveReviewTracking omission has no such justification anywhere in the file.)
⚠️ Required pattern — read any one of the four sibling guards' terminalizeActiveReviewTracking call before starting (e.g. closeDraftPrIfPolicyEnabled, line 1238). Add the identical call, in the same position relative to the close/audit-event calls, to closeSynchronizeAmendmentIfPolicyEnabled — do not invent a different tracking-cleanup mechanism.
Requirements
closeSynchronizeAmendmentIfPolicyEnabled must call terminalizeActiveReviewTracking(env, repoFullName, pr.number, { onlyIfHeadSha: pr.headSha }) after its enforcement close, mirroring its four siblings exactly.
- The existing, intentional omission of the moderation-strike call for this guard is unaffected — this issue only adds the missing
terminalizeActiveReviewTracking call.
Deliverables
Test Coverage Requirements
src/** — 99%+ Codecov patch target, both branches. Mirror however the four sibling guards' own tests assert the terminalizeActiveReviewTracking call.
Expected Outcome
Every close-enforcement guard in review-evasion.ts leaves review tracking in a consistent terminal state on close, closing the one guard that was silently leaving it dangling.
Links & Resources
src/queue/review-evasion.ts (lines 1271-1368 for the guard to fix; lines 752/912/1081/1238 for the four siblings to mirror)
Context
src/queue/review-evasion.tshas six close-enforcement guards. Four of them —closeReviewEvasionSelfCloseIfReviewed(line 752),closeReviewEvasionDraftConversionIfReviewed(line 912),closeRepeatedDraftCyclingIfDetected(line 1081),closeDraftPrIfPolicyEnabled(line 1238) — callterminalizeActiveReviewTracking(env, repoFullName, pr.number, { onlyIfHeadSha: pr.headSha })right after a successful enforcement close, marking the PR's active-review row terminal so it isn't left dangling.closeSynchronizeAmendmentIfPolicyEnabled(maybeCloseSynchronizeAmendment, lines 1271-1368,#synchronize-close-policy) closes the PR (line 1321) and records the audit event (line 1357) but never callsterminalizeActiveReviewTracking. Its own doc comment (lines 1241-1245) explicitly says this guard "enforces on the contributor's OWN PR receiving an ADDITIONAL commit... regardless of what CI/review state that push interrupts" — i.e. this is precisely the guard most likely to fire while a review is still actively tracked on the pre-amendmentheadSha, yet it's the one guard that leaves that tracking row un-terminalized.(The doc comment explicitly and separately justifies skipping the moderation-strike call for this guard — that omission is intentional and documented. The
terminalizeActiveReviewTrackingomission has no such justification anywhere in the file.)Requirements
closeSynchronizeAmendmentIfPolicyEnabledmust callterminalizeActiveReviewTracking(env, repoFullName, pr.number, { onlyIfHeadSha: pr.headSha })after its enforcement close, mirroring its four siblings exactly.terminalizeActiveReviewTrackingcall.Deliverables
closeSynchronizeAmendmentIfPolicyEnabledterminalizes active review tracking on enforcement close, matching its siblings.Test Coverage Requirements
src/**— 99%+ Codecov patch target, both branches. Mirror however the four sibling guards' own tests assert theterminalizeActiveReviewTrackingcall.Expected Outcome
Every close-enforcement guard in
review-evasion.tsleaves review tracking in a consistent terminal state on close, closing the one guard that was silently leaving it dangling.Links & Resources
src/queue/review-evasion.ts(lines 1271-1368 for the guard to fix; lines 752/912/1081/1238 for the four siblings to mirror)