Skip to content

Key the prgate comment marker on the reason alone - #2

Open
zzzeek wants to merge 1 commit into
mainfrom
prgate_marker_no_sha
Open

Key the prgate comment marker on the reason alone#2
zzzeek wants to merge 1 commit into
mainfrom
prgate_marker_no_sha

Conversation

@zzzeek

@zzzeek zzzeek commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Follows up on CaselIT's review of eed2480.

The hidden marker the gate leaves on a pull request was <!-- prgate:<reason>:<sha> -->, carrying the head sha, so _already_commented() only suppressed a repeat when the reason and the commit both matched. The number argument passed alongside it is only the API scope for get_issue_comments(), not part of the marker — so within a PR the dedup identity was (reason, sha).

The gate runs on opened/reopened, so a plain push to a closed pull request doesn't re-comment. But a contributor who is closed, pushes a commit and reopens gets a second copy of the same rejection.

The sha isn't part of the decision: the gate reads the pull request title and body and the state of the issue they name, never the code, so a new head commit cannot change the outcome without also changing the reason — and the reason is in the marker already. This drops it. The pull request number doesn't need to be in the marker either, since the comments are fetched per pull request to begin with.

Matching is done against the unterminated <!-- prgate:<reason> prefix so that comments already posted in the old format are still recognized and don't draw a duplicate on their next reopen. No close reason is a prefix of another, so that stays unambiguous.

One consequence worth naming: the comment is now strictly once-per-reason-per-pull-request forever. A pull request closed for issue_unlabeled, reopened, and closed again a month later for the same reason gets no second explanation. The close itself still happens every time.

The hidden marker the gate leaves on a pull request was
"<!-- prgate:<reason>:<sha> -->", carrying the head sha, so
_already_commented() only suppressed a repeat when the reason *and* the
commit both matched.  The gate runs on opened/reopened, which means a
contributor who is closed, pushes a commit and reopens gets a second
copy of the same rejection.

The sha isn't part of the decision: the gate reads the pull request
title and body and the state of the issue they name, never the code, so
a new head commit cannot change the outcome without also changing the
reason, which is in the marker already.  Drop it.  The pull request
number doesn't need to be in the marker either, since the comments are
fetched per pull request to begin with.

Matching is done against the unterminated "<!-- prgate:<reason>"
prefix so that comments already posted in the old format are still
recognized and don't draw a duplicate on their next reopen.
@zzzeek
zzzeek requested a review from CaselIT August 11, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants