Skip to content

Added handling for cases where the user in a PR review is missing#998

Open
avasconcelos114 wants to merge 1 commit intomasterfrom
missing_review_user_edgecase_fix
Open

Added handling for cases where the user in a PR review is missing#998
avasconcelos114 wants to merge 1 commit intomasterfrom
missing_review_user_edgecase_fix

Conversation

@avasconcelos114
Copy link
Copy Markdown
Contributor

@avasconcelos114 avasconcelos114 commented Apr 27, 2026

Summary

There is an edge case where if an account that previously reviewed the PR is deleted, the list of PRs in the sidebar will fail to load as it attempts to read the user attribute for the review.

This PR combats this by both filtering the PR reviews that don't have an user attached to them, as well as adding some defensive coding on the webapp to also prevent this from affecting the rendering of the sidebar contents

Before After
image image

QA Notes

Reproducing this naturally is somewhat difficult given that you need to have given a review to a PR with a temporary account that is then deleted. The easiest way to confirm that the fix is working would be to use a browser extension to mock the response of /plugins/github/api/v1/prsdetails and remove the user object from one of the reviews.

Once that is done just connect your account and open the "Your Open Pull Requests" sidebar from the LHS menu buttons

Change Impact: 🟡 Medium

Reasoning: These changes span both backend and frontend to handle the edge case of missing review authors, and include a type definition change to optionality. While the changes are isolated to review handling and are purely defensive, the scope across layers and the modification to the data model warrant medium-level scrutiny.

Regression Risk: Low. The changes add null-checking guards before accessing potentially undefined properties and filter invalid reviews server-side before transmission. No existing behavioral logic is modified; these are additive defensive measures that prevent crashes in an edge case (deleted/missing user accounts in PR reviews) without altering normal operation.

QA Recommendation: Light manual QA is recommended. Primary verification: confirm the "Your Open Pull Requests" sidebar loads successfully when a PR contains a review from a deleted/missing user account. The PR provides browser dev tools instructions to mock the edge case. Risk of skipping QA is medium—while changes are defensive and low-regression, the sidebar is user-facing and the edge case being fixed is real. A quick smoke test of sidebar loading with typical PRs is sufficient for low-risk release.

@avasconcelos114 avasconcelos114 self-assigned this Apr 27, 2026
@avasconcelos114 avasconcelos114 requested a review from a team as a code owner April 27, 2026 11:33
@avasconcelos114 avasconcelos114 added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Apr 27, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 730285bf-4323-4618-ad43-ce2dd5d71da7

📥 Commits

Reviewing files that changed from the base of the PR and between b573b96 and 70adc48.

📒 Files selected for processing (3)
  • server/plugin/api.go
  • webapp/src/components/sidebar_right/github_items.tsx
  • webapp/src/types/github_types.ts

📝 Walkthrough

Walkthrough

The changes introduce optional user fields in the Review type and add defensive null-checking mechanisms in both backend and frontend code to safely handle GitHub reviews that lack associated user data.

Changes

Cohort / File(s) Summary
Backend Review Filtering
server/plugin/api.go
Post-processes GitHub API review results by filtering out reviews with nil pointers or missing User fields before returning the list.
Frontend Type Definition & Usage
webapp/src/types/github_types.ts, webapp/src/components/sidebar_right/github_items.tsx
Updates Review type to make user field optional and adds defensive null checks in getReviewText to safely handle reviews without associated users.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

4: Reviews Complete

Suggested reviewers

  • nevyangelova
  • ogi-m

Poem

🐰 A review without a user, oh what a sight,
We check for nil and handle it right,
From server to client, we filter with care,
Optional users now handled everywhere! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change across all three modified files: adding handling for missing user fields in PR reviews.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch missing_review_user_edgecase_fix

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@nang2049 nang2049 left a comment

Choose a reason for hiding this comment

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

LGTM :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants