Skip to content

Hide outdated bot comments#294

Open
ayyoub-afwallah wants to merge 3 commits intosymfony-tools:masterfrom
ayyoub-afwallah:fetaure/add-comment-clean-up
Open

Hide outdated bot comments#294
ayyoub-afwallah wants to merge 3 commits intosymfony-tools:masterfrom
ayyoub-afwallah:fetaure/add-comment-clean-up

Conversation

@ayyoub-afwallah
Copy link
Copy Markdown

@ayyoub-afwallah ayyoub-afwallah commented Jan 22, 2026

Adresses #271 #220 #210

Automatically hides warning comments when the user resolves the reported issue.

@ayyoub-afwallah ayyoub-afwallah force-pushed the fetaure/add-comment-clean-up branch 2 times, most recently from 770b1c3 to eb30234 Compare January 22, 2026 12:24
@ayyoub-afwallah ayyoub-afwallah force-pushed the fetaure/add-comment-clean-up branch from eb30234 to 5c6d957 Compare January 22, 2026 16:23
@ayyoub-afwallah ayyoub-afwallah requested a review from stof January 26, 2026 11:33
@ayyoub-afwallah
Copy link
Copy Markdown
Author

Ping! This is still relevant and would be great to have merged 63749

cc @OskarStark 🙏

@ayyoub-afwallah ayyoub-afwallah changed the title Auto-remove outdated bot comments Hide outdated bot comments Mar 27, 2026
@fabpot fabpot requested a review from Copilot April 1, 2026 06:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds automatic cleanup of previously-posted bot warnings by minimizing outdated bot comments when a pull request is edited and the reported issue is resolved.

Changes:

  • Extend multiple PR subscribers to react to pull_request.edited events and minimize prior bot comments when conditions become valid.
  • Add findBotComment() + minimizeComment() to the Issue API, implemented via GitHub REST comments listing + GraphQL minimizeComment mutation.
  • Add/extend PHPUnit coverage for the new cleanup + idempotency behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Subscriber/UnsupportedBranchSubscriber.php Minimizes the “unsupported branch” warning when the base branch becomes supported/default; avoids duplicates.
src/Subscriber/MismatchBranchDescriptionSubscriber.php Minimizes the mismatch warning when PR template branch matches the base branch; avoids duplicates.
src/Subscriber/AllowEditFromMaintainerSubscriber.php Minimizes the warning when “Allow edits from maintainer” is enabled; avoids duplicates; ignores same-repo PRs.
src/Api/Issue/IssueApi.php Adds new capabilities for locating and minimizing bot comments.
src/Api/Issue/NullIssueApi.php Provides no-op implementations of the new Issue API methods.
src/Api/Issue/GithubIssueApi.php Implements bot comment lookup and GraphQL minimization.
config/packages/github_api.yaml Registers Github\Api\GraphQL service for DI.
tests/Api/Issue/GithubIssueApiTest.php Adds unit tests for comment lookup and minimization.
tests/Subscriber/UnsupportedBranchSubscriberTest.php Adds edited-event cleanup and idempotency tests.
tests/Subscriber/MismatchBranchDescriptionSubscriberTest.php Adds edited-event cleanup and idempotency tests.
tests/Subscriber/AllowEditFromMaintainerSubscriberTest.php New tests for edited-event cleanup and idempotency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ayyoub-afwallah
Copy link
Copy Markdown
Author

Copilot suggestions addressed as follow :

  • findBotComment() will still fetch only the last 100 comment since that logic works fine for exiting functionalities and to avoid the unnecessary complexity of pagination
  • the unnecessary api call suggestion was partially correct, an avoidable call was fired on opened PRs -> Fixed

while doing so i found out that the REST api response included the minimized comments too and doesn't provide a way to tell if a comment is minimized or not, which was breaking this scenario

  1. user introduces an issue
  2. carsonbot comments
  3. user fixes issue
  4. carson minimizes the comment
  5. user edits and re-introduces the issue
  6. carsonbot considers the minimized comment as valid and doesn't post a fresh one

to fix this i switched to using Graphql api, and now it works like this

  1. user re-introduces the issue
  2. carsonbot ignores the minimized comments and posts a new one
  3. user fixes the issue again
  4. carsonbot minimizes the last comment

@ayyoub-afwallah ayyoub-afwallah marked this pull request as draft April 2, 2026 08:55
@ayyoub-afwallah ayyoub-afwallah marked this pull request as ready for review April 2, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants