Skip to content

PR status not shown for fork-based pull requests #37

@zhuwenxing

Description

@zhuwenxing

Bug Description

PR status badges in the sidebar and CI/CD check ring in the toolbar do not appear for pull requests created from forks. The toolbar shows motivational messages instead of PR status.

Root Cause

In GithubGraphQLPullRequestResponse.swift, the pullRequestsByBranch method filters PR candidates using the matches(owner:repo:) function, which requires headRepository.owner.login to match the upstream repository owner.

For fork-based PRs, headRepository.owner is the fork owner (e.g. "zhuwenxing"), not the upstream owner (e.g. "milvus-io"). This causes all fork PRs to be filtered out, resulting in no PR data being returned.

// Current filtering — only matches PRs pushed directly to upstream
let candidates = connection.nodes.filter { $0.matches(owner: normalizedOwner, repo: normalizedRepo) }

Additionally, errors in the PR fetch flow are silently swallowed (case .failure: return), making it impossible to diagnose issues.

Expected Behavior

  • Fork-based PRs should be displayed when no upstream-owner match exists (fallback logic)
  • Upstream PRs should still be preferred when both exist (priority matching)
  • PR fetch failures should be logged for debugging

Proposed Fix

  1. Add fork PR fallback in pullRequestsByBranch: Try upstream-owner match first; if empty, fall back to any PR with a non-nil headRepository
  2. Add debug logging in RepositoriesFeature.swift for the PR fetch flow (isAvailable, remoteInfo, success/failure)
  3. Update tests in GithubBatchPullRequestsTests.swift: rename ignoresForkOnlyMatches to reflect new fallback behavior, add mixed-scenario tests

Affected Files

  • supacode/Clients/Github/GithubGraphQLPullRequestResponse.swift
  • supacode/Features/Repositories/Reducer/RepositoriesFeature.swift
  • supacodeTests/GithubBatchPullRequestsTests.swift

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