channable / hoff

A gatekeeper for your commits
Apache License 2.0
41 stars 3 forks source link

Prevent feedback loops through parser errors #224

Closed robbert-vdh closed 1 year ago

robbert-vdh commented 1 year ago

The new parser repeats part of the comment in its error messages so it can highlight the syntax error. This is great, except for the fact that in production the comment posted by Hoff also comes in as a webhook event. And since the error message contains the repeated merge command, Hoff would enter a feedback loop where it complains about parsing errors in its own comments. The tests now also simulate this webhook event to make sure this doesn't happen again.

Hoff being able to respond to itself is a feature since it's used to automate deployments in certain repositories. This approach uses a simple HTML comment that is added to parser error messages. If the comment is found in any message, Hoff won't try to parse it for commands. This is also useful in other situations where Hoff may post arbitrary output that could contain its command prefix.

This fixes #223.

robbert-vdh commented 1 year ago

Thanks for the review! @OpsBotPrime merge

OpsBotPrime commented 1 year ago

Pull request approved for merge by @robbert-vdh, rebasing now.

OpsBotPrime commented 1 year ago

Rebased as ada7263777fe8b54f0f46456ec7bb84e14bb52ff, waiting for CI …

OpsBotPrime commented 1 year ago

CI job :yellow_circle: started.