fix: make is_valid_issue close-window directional#680
Merged
anderdc merged 4 commits intoentrius:testfrom Apr 21, 2026
Merged
Conversation
The previous abs() check accepted issues closed up to 24h BEFORE the PR merged. GitHub's closingIssuesReferences is keyword-parsed from the PR body and still returns references to already-closed issues, so an unrelated PR could add `Closes #N` pointing to an issue someone else just closed, pass every is_valid_issue gate, and inherit the 1.33x / 1.66x multiplier. Require issue.closed_at >= pr.merged_at - 60s (clock-skew buffer) and <= pr.merged_at + 1d. The legitimate auto-close case (issue closes at or just after merge) still passes; the "already closed by unrelated work" case is rejected.
Collaborator
|
Fix is correct but over-engineered. Should be a one-liner: if days_diff > MAX_ISSUE_CLOSE_WINDOW_DAYS or days_diff < 0:Just drop Tests: 6 separate functions for one boolean check is too much. Either parametrize into a single test or edit the existing close-window assertion in |
Contributor
Author
|
Thanks for your review @anderdc |
Drop the ISSUE_CLOSE_CLOCK_SKEW_SECONDS buffer; GitHub's merge-and-auto-close writes both timestamps in the same transaction, so the skew case is not real. The directional check collapses to a one-liner. Fold close-window coverage into tests/validator/test_is_valid_issue.py as a parametrized class instead of a dedicated file.
anderdc
approved these changes
Apr 21, 2026
plind-junior
added a commit
to plind-junior/gittensor
that referenced
this pull request
Apr 22, 2026
…us#680 Tests set closed_at before merged_at, which entrius#680 now treats as invalid. Flipping the hour offset matches GitHub's real behavior (closing-keyword PRs close linked issues at or after merge time).
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.
The previous abs() check accepted issues closed up to 24h BEFORE the PR merged. GitHub's closingIssuesReferences is keyword-parsed from the PR body and still returns references to already-closed issues, so an unrelated PR could add
Closes #Npointing to an issue someone else just closed, pass every is_valid_issue gate, and inherit the 1.33x / 1.66x multiplier.Require issue.closed_at >= pr.merged_at - 60s (clock-skew buffer) and <= pr.merged_at + 1d. The legitimate auto-close case (issue closes at or just after merge) still passes; the "already closed by unrelated work" case is rejected.
Fixes #676