Skip to content

fix(forgejo): fork pull requests are found whatever letter case the remote URL uses - #49358

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/forgejo-fork-pr-lookup-case-insensitive
Dec 5, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
only21mil:fix/forgejo-fork-pr-lookup-case-insensitive

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

When a local git remote URL uses different letter casing than Forgejo or Gitea's canonical owner name (for example alice vs Alice), the owner:branch lookup drops the fork pull request on both head=-filtered servers and servers that ignore head= (Gitea and older Forgejo). A lone pull request on that branch is still found through GitManager's bare-branch fallback. The miss shows when another pull request with the same branch name was updated more recently, because the open lookup asks for one result (limit: 1). This was found by code inspection of ForgejoSourceControlProvider.listChangeRequests alongside the existing case-insensitive owner and repository comparisons in GitManager, forgejoPullRequests.ts, and createRepository.

ForgejoSourceControlProvider.listChangeRequests now normalizes expected and returned head repository full names and owner logins with .toLowerCase() before comparing, while keeping branch names (headRefName) case-sensitive.

Verification

  • Updated the fork fixture in the existing reads only the changed front of a Gitea pull request list it has read before test in packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts to use mixed-case Alice/renamed / Alice against the existing alice:feature lookups.
  • Before fix on 5a0ef1a848 (vp test run packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts -t "reads only the changed front of a Gitea pull request list it has read before"): failed at find("alice:feature") with AssertionError: expected [] to deeply equal [ [ 5, 'open' ] ].
  • After fix on b00b3e25e5 (vp test run packages/source-control-forgejo): passed (7 test files, 41 tests).
  • vp run check:changed on b00b3e25e5: passed (format, lint, knip, i18n, typecheck across 12 packages, test across 2 files / 23 tests).
  • Tests kept: updated existing fixture casing in packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts (0 added cases, 0 net test lines).

Generated with Gemini 4 Neon in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Dec 5, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at b00b3e2

Macroscope's review found this PR approvable — Forgejo fork pull requests can now match remote repository and owner names regardless of letter case. The change is limited to listing filters and preserves existing branch and state constraints.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b00b3e2 and d524b38.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

listChangeRequests now matches source repository and owner names without regard to case. Branch matching remains case-sensitive, and repository and owner checks remain conditional on their source values being present.

Changes: Forgejo source matching

Layer / File(s) Summary
Case-insensitive source matching
packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.ts, packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts
listChangeRequests compares lowercased source repository and owner names. The test fixture uses uppercase Alice while retaining the alice:feature selector assertions.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · previous review b00b3

Fork pull requests are now matched even when the owner or repository name differs in casing from the server's canonical form. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the Forgejo fix: fork pull requests are now found regardless of the letter case in the remote URL. This matches the main change in ForgejoSourceControlProvider.listChangeRequests, whic…
Description check Passed The description follows the template structure with Problem, Change, Scope, and Verification sections, and it fills in each one. The Problem section explains the casing mismatch and the limit: 1 looku…
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.
Full details: Title check

Explanation

The title names the Forgejo fix: fork pull requests are now found regardless of the letter case in the remote URL. This matches the main change in ForgejoSourceControlProvider.listChangeRequests, which compares source repository and owner names case-insensitively. The title follows conventional commit style and is specific.

Full details: Description check

Explanation

The description follows the template structure with Problem, Change, Scope, and Verification sections, and it fills in each one. The Problem section explains the casing mismatch and the limit: 1 lookup miss. The Change section states the case-insensitive owner and repository comparison with branch names kept case-sensitive. The Scope section does not link an issue or state why no issue is needed, and the template asks for that. The Verification section gives before/after test results, check results, and the tests kept. Minor gaps: no linked issue or explanation for its absence, and the template's note on agent model and harness is partly covered by the 'Generated with' line.

Resolution

Optional: add a Scope note that links the bug report or explains why no issue is needed. Verification is otherwise complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6124e54 and b00b3e2.

Files selected for processing: 2

  • packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.test.ts
  • packages/source-control-forgejo/src/server/ForgejoSourceControlProvider.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 5, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Seeded real Forgejo maria/project and Alice/project and Bob/project forks; both forks have feature branches. Opened Alice PR #1, then 21 newer Bob PRs (#2–#22), closing #2–#21 and leaving #22 open. On each commit, created a fresh app project, fetched upstream and the lowercase alice/project.git remote, checked out feature tracking alice/feature, seeded one Replay thread, opened it directly, and inspected Version Control. Base displayed Create PR; head displayed #1: Alice feature.

Environment: scenarios:prove drove the real web dev app and server on both commits with fresh isolated databases, a 1280×800 browser viewport and light theme. Real Docker Forgejo 14.0.5, real Gitea CLI 2.1.0 authenticated as Alice, identical seeded forge data, and Replay (dev) for the thread. No mocked forge responses. Final runner exit 0; screenshots and recordings inspected.

Scenario: Fork PR lookup tolerates lowercase remote owner behind 21 newer fork PRs

Proven: the scenario fails on base f200e72a30 and passes on head d524b3852e.

Base f200e72a30 Head d524b3852e
Result ❌ failed
ASSERTION_FAILED: expect.toBeVisible failed
locator: getByRole("button", name: "Pull request #1, open: Alice feature")
expected: visible
observed: no node (match count 0)
✅ passed
fork pr lowercase owner Base f200e72a30: fork pr lowercase owner Head d524b3852e: fork pr lowercase owner
failure Base f200e72a30: failure

Scenario · Forgejo seed script

Before recording · After recording

Not shown:

  • Repository-name casing was not varied; this scenario proves owner casing (alice versus Alice).
  • Create PR duplicate-detection/HTTP 409 and after-push View PR toast were not exercised; the captured proof covers Version Control status lookup.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Dec 5, 2026
@juliusmarminge
juliusmarminge merged commit 00599a7 into pingdotgg:main Dec 5, 2026
57 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants