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: PR lookup for PRs with no backports #34

Merged
merged 1 commit into from
Dec 15, 2023
Merged

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Dec 15, 2023

This PR fixes an issue where the user would incorrectly be redirected to the homepage when trying to look up certain PRs. This was happening because of an incorrect assumption being made that the base ref would be main if it was merged to the default branch, which wouldn't be true for older branches merged to master before the rename.

@codebytere codebytere requested review from a team as code owners December 15, 2023 19:18
@@ -1,7 +1,6 @@
const Handlebars = require('handlebars');
const { Router } = require('express');
const semver = require('semver');
const MarkdownIt = require('markdown-it');
Copy link
Member Author

Choose a reason for hiding this comment

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

Left from previous PR

@@ -132,7 +128,6 @@ async function getPRReleaseStatus(prNumber) {

// This is the primary PR, we can scan from here for backports
return {
highlightPR: prNumber,
Copy link
Member Author

Choose a reason for hiding this comment

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

This was unused

Copy link
Member

@dsanders11 dsanders11 left a comment

Choose a reason for hiding this comment

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

Beyond the stated fix, this PR also makes data fetching more consistent and adds error logging in event of failure. This caused an issue for me while i was debugging as I'd not properly authenticated with octokit and was getting rate limited without realizing it.

I'm not a fan of wrapping these in try/catch with empty results since they're memoized and the empty results will be cached. Especially for getReleasesOrUpdate, I wouldn't want a transient error causing an empty response which is then cached. Users hitting those endpoints should get some kind of error so that they know the response is not valid.

Can we find a middle ground with extra logging but still throwing the errors there?

@codebytere
Copy link
Member Author

@dsanders11 fair enough - i can at minimum split it into another PR

@codebytere codebytere force-pushed the fix-data-fetching branch 3 times, most recently from 4c5fd05 to 2133501 Compare December 15, 2023 21:08
@codebytere codebytere merged commit 3528518 into main Dec 15, 2023
2 checks passed
@codebytere codebytere deleted the fix-data-fetching branch December 15, 2023 22:31
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