Skip to content
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

Fix panic on edit events in issue_comment handler #379

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

bluekeyes
Copy link
Member

For an unknown reason, GitHub Enterprise 3.2.7 is not including the
'changes" field in issue_comment payloads for edited comments. This
causes the handler to panic when it tried to access the previous body of
the comment. This field is still included on GitHub.com, so hopefully it
will be fixed in some future release.

For now, fix the panic by using the "safe" accessors, but at the cost of
not actually auditing the edit correctly. Hard failing if the old body
is missing will break a lot of legitimate workflows, particularly our
internal changelog generation app.

A quick survey of the API suggests you can only look up comment history
using the GraphQL API, and it gives you a diff instead of the previous
content. I'm not sure if the edit auditing functionality is important
enough to justify a fallback if the payload is missing fields. Now that
the 'ignore_edited_comments' property exists, users who really care
about this should probably use that instead.

For an unknown reason, GitHub Enterprise 3.2.7 is not including the
'changes" field in issue_comment payloads for edited comments. This
causes the handler to panic when it tried to access the previous body of
the comment. This field is still included on GitHub.com, so hopefully it
will be fixed in some future release.

For now, fix the panic by using the "safe" accessors, but at the cost of
not actually auditing the edit correctly. Hard failing if the old body
is missing will break a lot of legitimate workflows, particularly our
internal changelog generation app.

A quick survey of the API suggests you can only look up comment history
using the GraphQL API, and it gives you a diff instead of the previous
content. I'm not sure if the edit auditing functionality is important
enough to justify a fallback if the payload is missing fields. Now that
the 'ignore_edited_comments' property exists, users who really care
about this should probably use that instead.
@bluekeyes bluekeyes requested a review from a team February 5, 2022 00:27
@bluekeyes bluekeyes merged commit 3e22bd4 into develop Feb 7, 2022
@bluekeyes bluekeyes deleted the bkeyes/fix-comment-panic branch February 7, 2022 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants