-
Notifications
You must be signed in to change notification settings - Fork 496
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 issue comment unfurl #929
Conversation
Closes #928 This commmit fixes unfurling of private and public issue comments. When the `octokit/rest.js` changed [their rounting arguments](octokit/rest.js@c62b2bc) from `id` to `<resource>_id`, unfurling issue comments stopped working. This PR adjusts the argument name and thus fixes the problem. In addition I added new fixtures to allow tests that have less context. This should make it clear, that for public unfurls, the user of the repo and the comment does not matter and it decouples the fixture and subscription setup. This was mainly helpful to myself to make sure the tests only require, what they should require.
Codecov Report
@@ Coverage Diff @@
## master #929 +/- ##
==========================================
+ Coverage 97.04% 97.04% +<.01%
==========================================
Files 157 157
Lines 2639 2640 +1
Branches 361 361
==========================================
+ Hits 2561 2562 +1
Misses 74 74
Partials 4 4 |
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #929 +/- ##
==========================================
+ Coverage 97.04% 97.04% +<.01%
==========================================
Files 157 157
Lines 2639 2640 +1
Branches 361 361
==========================================
+ Hits 2561 2562 +1
Misses 74 74
Partials 4 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work ✨
I wonder how we can spot something like this earlier when we next upgrade Probot or Octokit. Should Octokit have thrown errors/warnings when passing old arguments that no longer work? cc @gr2m
Instead of logging with `warn`, I decided to make sure we are not creating lots of noise at our log provider and instead use `debug` which is excluded by default. We can adjust the level via ENV vars to analyse the data in a short time window.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wilhelmklopp thanks for your review ❤️ 🙏
I wonder how we can spot something like this earlier when we next upgrade Probot or Octokit. Should Octokit have thrown errors/warnings when passing old arguments that no longer work?
Better error detection
I am not sure how to prevent this except than by adding a regression test as I did.
I made sure the unfurl test causes the exact same error we are seeing in production before fixing it.
Other than that, I have no idea.
We might also need to improve our logging/alerting because this error was visible in production and we did not notice it for quite some time. I will create and issue for that.
Better update management
With regards to the Update itself. The linked commit is part of this major version bump to 8.0. The big problem here is, that we might have just jumped over all the versions that had deprecation warnings if there were any.
I am also unsure about how to avoid this issue in the future. I hope @gr2m
has an idea.
Ocotkit is logging warnings. The commit you linked shows that the previous URL parameter For breaking versions I usually try to only remove previously deprecated changes. So make sure to update to the latest version of the previous major version, run your tests, address all deprecations, then upgrading should be simple. |
Closes #928
Problem
This commit fixes unfurling of private and public issue comments.
When the
octokit/rest.js
changed their routing arguments fromid
to<resource>_id
, unfurling issue comments stopped working.Solution
This PR adjusts the argument name and thus fixes the problem.
Example (from linked issue)
URL:
https://github.com/rust-lang/rust/issues/63997#issuecomment-526118914
Error:
Offending code:
We are passing
id: id
(shorthand version) instead ofcomment_id: id
.slack/lib/unfurls/comment.js
Lines 8 to 13 in 8aa8e7b
Additional fixtures
In addition, I added new fixtures to allow tests that have less context.
This should make it clear, that for public unfurls, the user of the repo
and the comment does not matter and it decouples the fixture and
subscription setup.
This was mainly helpful to me to make sure the tests only require, what they should require.
ℹ️ These fixtures are very similar to the existing ones and can be ignored during the review if that helps.