Closed meysam81 closed 5 months ago
r?
r? dev-tools
@Mark-Simulacrum
As you suggested, I refactored the changes into its own module.
You may also see a successful run here: https://github.com/meysam81/triagebot-test/pull/2#issuecomment-1762596593
BTW, there is now a merge conflict.
I'm a bit confused about the approach taken here. It seems to validate the config on every PR opened or pushed. I would expect it to operate like it did before, where it would only validate the config on a PR that is modifying triagebot.toml
. Can you say more about why that is changing? I would also not expect there to be any need to do any caching if it was only checking in the case where triagebot.toml
is added or modified.
I'm a bit confused about the approach taken here. It seems to validate the config on every PR opened or pushed. I would expect it to operate like it did before, where it would only validate the config on a PR that is modifying
triagebot.toml
. Can you say more about why that is changing? I would also not expect there to be any need to do any caching if it was only checking in the case wheretriagebot.toml
is added or modified.
The main driver for the new approach was to address the expensive HTTP round-trips mentioned here: https://github.com/rust-lang/triagebot/pull/1730#discussion_r1349717753
Additionally, at the expense of using a fixed size memory for holding the config (128 total triagebot.toml
ATM), we achieve a speed up in case no new commits has been pushed and only a synchronization is triggered.
The main driver for the new approach was to address the expensive HTTP round-trips mentioned here: https://github.com/rust-lang/triagebot/pull/1730#discussion_r1349717753
My concern in that comment was about using the diff
endpoint which fetches the entire contents of every PR. Would it be possible to use the files()
endpoint instead to check if the PR touches triagebot.toml
, and only download the file in that case? I don't think that approach should need any sort of caching.
In the future, we could potentially cache the files()
output, since I think there are several other handlers that need to check if a PR touches certain files. But that cache would only need to live as long as the loop through the handlers, and then can be immediately discarded. But I think that is something we could consider later, not something I would bother with in this PR.
Hm, so I'm taking a closer look at this, and I need the diff for something else. We're already fetching the diff 3 times in other handlers. I'll try to follow up soon with something that caches that.
Ok, I posted #1749 to implement caching of the diff (since I need it for something else). If/when that PR is merged, I think this PR can be updated to just call the diff()
function to determine if it contains triagebot.toml
, and if it does, fetch the contents and validate it (much like it did before 287b41499331d1828055acdd6ba5fcd00fff92b3).
Sorry about the back and forth on this.
I hope you don't mind, I went ahead and applied some of the changes suggested above. I also made a few other changes:
Thanks for helping with this!
fixes rust-lang/rust#106104
A successful run is visible here: https://github.com/meysam81/triagebot-test/pull/2#issuecomment-1751986969
Some highlights I need to mention here:
hacktoberfest-accepted
to this PR, since the repo is not marked withhacktoberfest
.cargo fmt
, norcargo clippy
not formatting my code? :thinking: