Skip to content

[Bug]: Web Pull Requests list applies diff stats from another repository with the same PR number #43556

Done

Description

@AymanKhan9

Description

On the web Pull Requests page (/pull-requests), opening a pull request from another repository that shares a host project (for example, opening a linked cross-repo PR in the detail panel via a borrowed projectId) overwrites the diff line counts (+additions / -deletions) of any same-numbered pull request in the list and prevents its real diff stats from being fetched.

Root Cause

pullRequestDiffStatKey in apps/web/src/components/pullRequest/pullRequestList.logic.ts keys the in-memory statsByRow map only by ${row.environmentId} ${row.projectId} ${row.number}, omitting repository (even though PullRequestDiffStat, pullRequestStatsPersistence, and mobile's pullRequestStatKey all include repository).

When PullRequestsPage merges panelSummary into statsByRow, a cross-repo PR that borrowed projectId (e.g. other/lib#42) is stored under the same key as own/app#42. withDiffStat then applies other/lib#42's counts to own/app#42, and pullRequestStatsKeysToRequest skips fetching own/app#42's real stats because statsByRow.has(key) is already true.

Expected Behavior

pullRequestDiffStatKey and mergePullRequestDiffStats should include the normalized (case-insensitive) repository alongside environmentId, projectId, and number so diff stats from different repositories under the same project never collide.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions