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
- Add fork PR fallback in
pullRequestsByBranch: Try upstream-owner match first; if empty, fall back to any PR with a non-nil headRepository
- Add debug logging in
RepositoriesFeature.swift for the PR fetch flow (isAvailable, remoteInfo, success/failure)
- 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
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, thepullRequestsByBranchmethod filters PR candidates using thematches(owner:repo:)function, which requiresheadRepository.owner.loginto match the upstream repository owner.For fork-based PRs,
headRepository.owneris 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.Additionally, errors in the PR fetch flow are silently swallowed (
case .failure: return), making it impossible to diagnose issues.Expected Behavior
Proposed Fix
pullRequestsByBranch: Try upstream-owner match first; if empty, fall back to any PR with a non-nilheadRepositoryRepositoriesFeature.swiftfor the PR fetch flow (isAvailable,remoteInfo, success/failure)GithubBatchPullRequestsTests.swift: renameignoresForkOnlyMatchesto reflect new fallback behavior, add mixed-scenario testsAffected Files
supacode/Clients/Github/GithubGraphQLPullRequestResponse.swiftsupacode/Features/Repositories/Reducer/RepositoriesFeature.swiftsupacodeTests/GithubBatchPullRequestsTests.swift