Skip to content

Conversation

danwinship
Copy link
Contributor

@danwinship danwinship commented Oct 10, 2025

If a user misuses /test or /retest and gets a 50-page-long help message from prow, and then triggers a test correctly afterward, delete the help message so as to de-spam the PR.

Fixes #374

I don't know this codebase at all and probably did stuff wrong. Also, I'm not sure how to actually test it. (I assume I need to add a unit test to pkg/plugins/trigger/ too, but I was having a hard time figuring out if I could actually figure out which test cases should result in comment deletion correctly just from the info already in the testcase struct, so I gave up on it for now since you might request large rewrites anyway...)

/assign @petr-muller
since you 👍 'd the idea on #374...

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/plugins Issues or PRs related to prow's plugins for the hook component labels Oct 10, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 10, 2025
Copy link

netlify bot commented Oct 10, 2025

Deploy Preview for k8s-prow ready!

Name Link
🔨 Latest commit 0301d43
🔍 Latest deploy log https://app.netlify.com/projects/k8s-prow/deploys/68ea5e197d74350008819640
😎 Deploy Preview https://deploy-preview-525--k8s-prow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Some tests were described as "<COMMENT-TEXT> results in <BOT-ACTION>"
and some were described as "<COMMENT-TEXT> in <CONTEXT> [has no
effect]", but some of the latter erroneously had the word "results" in
them as though that was part of the comment text.
@danwinship danwinship force-pushed the delete-help-comments branch from ed19a16 to 0301d43 Compare October 11, 2025 13:39
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: danwinship
Once this PR has been reviewed and has the lgtm label, please ask for approval from petr-muller. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@petr-muller
Copy link
Contributor

I'll let GH copilot review this as a resource but so far I do not have great experience with the result so feel free to just ignore whatever it says unless its a clear slam dunk.

@petr-muller petr-muller requested a review from Copilot October 13, 2025 11:24
Copy link

@Copilot 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

This PR implements functionality to automatically delete old help messages from the /test and /retest commands after a successful test invocation, preventing spam in pull requests when users initially misuse the commands and then trigger tests correctly.

Key changes:

  • Added ShouldRespondByPruningHelp and IsHelpComment functions to identify when to prune help comments
  • Modified handleGenericComment to accept a comment pruner and call it when appropriate
  • Updated test infrastructure to validate comment pruning behavior

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/plugins/trigger/trigger.go Modified to get comment pruner and pass it to handleGenericComment
pkg/plugins/trigger/generic-comment.go Added commentPruner interface and logic to prune help comments on successful triggers
pkg/plugins/trigger/generic-comment_test.go Added fake comment pruner and test validation for pruning behavior
pkg/pjutil/help.go Added functions to identify help comments and determine when to prune them
pkg/pjutil/help_test.go Added comprehensive tests for help comment identification and pruning logic
Comments suppressed due to low confidence (1)

pkg/pjutil/help.go:1

  • Incorrect variable used in optional test commands section. Should use optionalTestCommands instead of requiredTestCommands.
/*

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@danwinship
Copy link
Contributor Author

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Ship it! 😎

(I'm not sure what the "Comments suppressed due to low confidence" is even referring to? It seems like it hallucinated a non-existent incorrect comment and then explained how to fix it and then realized that it couldn't find the comment it was trying to explain how to fix?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/plugins Issues or PRs related to prow's plugins for the hook component cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collapse test list in a response to /test ? or /test unknown-test because it is too long

3 participants