-
-
Notifications
You must be signed in to change notification settings - Fork 99
[ci] Disabled auto-close PRs #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -329,6 +329,7 @@ def test_success(self, bot_env): | |
| mock_issue.remove_from_assignees.assert_called_once_with("testuser") | ||
|
|
||
|
|
||
| @pytest.mark.skip(reason="Auto-close temporarily disabled; see close_stale_pr stub.") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not skip the whole close-PR suite; assert disabled behavior instead. Skipping Suggested direction-@pytest.mark.skip(reason="Auto-close temporarily disabled; see close_stale_pr stub.")
class TestCloseStalePR:
- def test_success(self, bot_env):
+ def test_disabled_no_side_effects(self, bot_env):
bot = StalePRBot()
mock_pr = Mock()
+ mock_pr.number = 1
mock_pr.body = "Fixes `#123`"
mock_pr.user.login = "testuser"
mock_pr.state = "open"
- ...
- assert bot.close_stale_pr(mock_pr, 60)
- mock_pr.create_issue_comment.assert_called_once()
- ...
- mock_pr.edit.assert_called_once_with(state="closed")
- ...
+ assert bot.close_stale_pr(mock_pr, 60) is False
+ mock_pr.create_issue_comment.assert_not_called()
+ mock_pr.edit.assert_not_called()🤖 Prompt for AI Agents |
||
| class TestCloseStalePR: | ||
| def test_success(self, bot_env): | ||
| bot = StalePRBot() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Replace unconditional early return with an explicit feature gate.
At Line 217, the unconditional
return Falsemakes Lines 218-280 permanently unreachable. That keeps dead logic in place and increases risk of silent drift while auto-close is disabled.Proposed refactor
class StalePRBot(GitHubBot): def __init__(self): super().__init__() self.DAYS_BEFORE_STALE_WARNING = 7 self.DAYS_BEFORE_UNASSIGN = 14 self.DAYS_BEFORE_CLOSE = 60 + self.ENABLE_AUTO_CLOSE = False # temporary kill-switch def close_stale_pr(self, pr, days_inactive): - # TEMPORARY: auto-close disabled. The stale-detection heuristic - # has been closing PRs that are merely blocked by bot reviews - # (or by reviews the same reviewer later approved). The proper - # fix lives in PR `#668`; until it lands, no PR is auto-closed. - print(f"Auto-close currently disabled, skipping PR #{pr.number}") - return False + if not self.ENABLE_AUTO_CLOSE: + print(f"Auto-close currently disabled, skipping PR #{pr.number}") + return False if pr.state == "closed": print(f"PR #{pr.number} is already closed, skipping") return True📝 Committable suggestion
🤖 Prompt for AI Agents