Skip to content

fix: silently skip edited comment events instead of logging errors#2657

Open
majiayu000 wants to merge 3 commits intotektoncd:mainfrom
majiayu000:fix/issue-2652-silent-skip-edited-comments
Open

fix: silently skip edited comment events instead of logging errors#2657
majiayu000 wants to merge 3 commits intotektoncd:mainfrom
majiayu000:fix/issue-2652-silent-skip-edited-comments

Conversation

@majiayu000
Copy link
Copy Markdown

Description of the Change

Fixes #2652

When GitHub sends a webhook for an edited/deleted issue comment, processEvent() was returning an error ("only newly created comment is supported, received: edited"), which propagated up to sinker.processEventPayload() and got logged as s.logger.Errorf("failed to parse event: %v", err). This produced scary-looking error logs for a perfectly normal event.

Changed the error return to a v.Logger.Debugf() log + return nil, nil, which is the established skip pattern already used at lines 190, 309, 419, and 834 of the same file. Updated the corresponding test case to expect a silent skip instead of an error.

Linked GitHub Issue

Fixes #2652

Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

Updated existing test case bad/issue_comment_not_from_createdgood/issue_comment_not_from_created_skip to expect nil return instead of error. make test and make lint pass locally.

AI Assistance

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

Submitter Checklist

  • My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • I have run make test and make lint locally to check for and fix any issues. For an efficient workflow, I have considered installing pre-commit and running pre-commit install to automate these checks.
  • I have added or updated documentation for any user-facing changes.
  • I have added sufficient unit tests for my code changes.
  • I have added end-to-end tests where feasible. See README for more details.
  • I have addressed any CI test flakiness or provided a clear reason to bypass it.

Edited or deleted issue comments on GitHub trigger a webhook that
reaches processEvent(), which returned an error for any non-"created"
action. That error propagated up to sinker and was logged as Errorf,
producing scary log entries for a normal, harmless event.

Replace the error return with a debug log and nil,nil return so these
events are silently skipped, matching the existing skip pattern used
elsewhere in the file.

Signed-off-by: majiayu000 <1835304752@qq.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the GitHub provider to skip issue comment events that are not 'created' instead of returning an error. The logic in processEvent now logs a debug message and returns nil for non-created actions, and the test suite has been updated to reflect this change. I have no feedback to provide.

},
{
name: "bad/issue_comment_not_from_created",
wantErrString: "only newly created comment is supported, received: deleted",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need to test that the debug log has issued, not just skip it!

@chmouel
Copy link
Copy Markdown
Member

chmouel commented Apr 8, 2026

/label ok-to-test

@chmouel
Copy link
Copy Markdown
Member

chmouel commented Apr 8, 2026

/ok-to-test

@pipelines-as-code
Copy link
Copy Markdown

✅ Added labels: ok-to-test.

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.80%. Comparing base (a387d41) to head (ddfb6ca).
⚠️ Report is 3 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2657   +/-   ##
=======================================
  Coverage   58.80%   58.80%           
=======================================
  Files         206      206           
  Lines       20304    20305    +1     
=======================================
+ Hits        11940    11941    +1     
  Misses       7591     7591           
  Partials      773      773           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@majiayu000 majiayu000 marked this pull request as ready for review April 8, 2026 14:01
@majiayu000
Copy link
Copy Markdown
Author

@chmouel Done. Switched the test logger to zap.DebugLevel observer and added FilterMessageSnippet assertion to verify the debug log is actually emitted. Thanks for the review!

@tekton-robot
Copy link
Copy Markdown

@majiayu000: PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Edited comments generate scary error logs instead of being silently ignored

4 participants