Skip to content

fix(server): recognize partial-clone remotes in git remote -v output - #15172

Open
TinBane wants to merge 1 commit into
pingdotgg:mainfrom
TinBane:fix/partial-clone-remotes
Open

TinBane wants to merge 1 commit into
pingdotgg:mainfrom
TinBane:fix/partial-clone-remotes

Conversation

@TinBane

@TinBane TinBane commented Oct 3, 2026

Copy link
Copy Markdown

What Changed

Git prints the partial-clone filter after the fetch direction on promisor remotes:

origin	https://github.com/pingdotgg/t3code (fetch) [blob:none]
origin	https://github.com/pingdotgg/t3code (push)

Five server parsers anchored their regex right after (fetch)/(push) and dropped that line. They now share one parser, parseGitRemoteVerbose in apps/server/src/git/remoteRefs.ts (with a parseRemoteFetchUrls wrapper for the two fetch-only callers), that accepts Git's optional trailing […] annotations and keeps the name, URL and direction captures as they were. Lines without an annotation parse exactly as before.

The sites: RepositoryIdentityResolver (repository identity), GitVcsDriver.listRemotes (source-control provider detection), GitVcsDriverCore.ensureRemote (reusing an existing remote), GitHubCli.selectGitHubBaseRepository (which repo gh reads), and the Forgejo remote lookup.

Why

Fixes #12764. On a partial clone the fetch remote vanished from every one of those paths, so:

  • repository identity was null, the Pull Requests view skipped the project, and linked-PR sync logged Source control provider unknown … pull request sync skipped;
  • with "Group by repository", a partial clone and a normal clone of the same repository showed as two projects;
  • ensureRemote added a second remote instead of reusing origin, and gh base-repository selection could skip origin for a fork remote.

Julius's triage asked for one suffix-tolerant helper shared by all parsers, with synthetic-stdout tests rather than tests that depend on the installed Git printing the annotation. #7499 (open) covers the identity resolver only; #12776 and #14913 covered three and four of the sites and were closed in the V2 transition and by their author respectively. This covers all five on current main.

Verification

To reproduce: git clone --filter=blob:none <any repo>, add it as a project, and open the Pull Requests view (or group the sidebar by repository with a normal clone of the same repo on another environment).

  • In the app on macOS (Git 2.50.1): a partial clone of this repository (git clone --filter=blob:none) added as the only project to a fresh server state, once with a server built from main and once from this branch. On main the Pull Requests view is empty for it, because the project never gets a repository identity. With this branch the same view lists the repository's open pull requests. (Each run started from an empty state so the identity was resolved by the code under test, not reused from an earlier run.)

Before:

Before: Pull Requests view is empty for a partial clone

After:

After: the partial clone's repository pull requests are listed

  • Tests (vp test run … from apps/server): src/git/remoteRefs.test.ts (new, synthetic output: plain lines, [blob:none], [tree:0], two annotations, CRLF, blank and malformed lines), plus one consumer test per site: RepositoryIdentityResolver.test.ts, GitVcsDriver.test.ts (listRemotes), GitVcsDriverCore.test.ts (ensureRemote), GitHubCli.test.ts (selectGitHubBaseRepository), and the Forgejo lookup in SourceControlDiscovery.test.ts. The six files: 231 passed.
  • Red before green: with the source files reverted to main and the new tests kept, the five consumer tests fail (expected undefined to be 'github.com/pingdotgg/t3code', expected [] to deeply equal [ { name: 'origin', … } ], expected 'pingdotgg' to equal 'origin', expected null to deeply equal { owner: 'pingdotgg', name: 't3code' }, and the Forgejo host falling back to https).
  • vp run --filter t3 typecheck, vp lint and vp fmt --check on the changed files: clean.

Not checked: a live Azure DevOps or Forgejo remote; those paths are covered by the synthetic tests only. Windows and Linux runs of the test files are not done yet.

On a partial clone, `git remote -v` appends the filter to the fetch line, as in `origin <url> (fetch) [blob:none]`. The remote parsers anchored right after `(fetch)`, so they dropped that line: repository identity came back empty (no linked PRs, one repo split into two projects), `listRemotes` omitted the remote, `ensureRemote` added a duplicate, and GitHub base-repository and Forgejo host matching skipped it.

All five parse sites now share one parser that accepts trailing bracketed annotations after the direction. Unannotated output parses exactly as before.

Fixes pingdotgg#12764
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 3, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Oct 3, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 63c5313

Macroscope's review found this PR approvable — This is a focused server bug fix that centralizes git remote -v parsing and recognizes partial-clone annotations across the five affected consumers. Existing unannotated output remains supported, and targeted tests cover the parser and each runtime path without changing schemas, defaults, deployment, or static-analysis configuration.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

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

@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 3, 2026 — with ChatGPT Codex Connector
@macroscopeapp
macroscopeapp Bot dismissed their stale review October 3, 2026 12:20

Dismissing prior approval to re-evaluate 63c5313

@coderabbitai

coderabbitai Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
docs/internals/effect-services.md — configured

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 72da6fb4-db3e-440d-be9b-7a62a07b35bd
📥 Commits

Reviewing files that changed from the base of the PR and between 31a9da1 and 63c5313.

📒 Files selected for processing (12)
  • apps/server/src/git/remoteRefs.test.ts
  • apps/server/src/git/remoteRefs.ts
  • apps/server/src/project/RepositoryIdentityResolver.test.ts
  • apps/server/src/project/RepositoryIdentityResolver.ts
  • apps/server/src/sourceControl/ForgejoCli.ts
  • apps/server/src/sourceControl/GitHubCli.test.ts
  • apps/server/src/sourceControl/GitHubCli.ts
  • apps/server/src/sourceControl/SourceControlDiscovery.test.ts
  • apps/server/src/vcs/GitVcsDriver.test.ts
  • apps/server/src/vcs/GitVcsDriver.ts
  • apps/server/src/vcs/GitVcsDriverCore.test.ts
  • apps/server/src/vcs/GitVcsDriverCore.ts

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


📝 Walkthrough

Walkthrough

A shared parser now reads git remote -v entries with trailing bracketed annotations. Repository discovery, provider selection, VCS remote listing, and remote reuse use the shared parsing functions. Tests cover partial-clone filters and fetch-versus-push handling.

Changes

Partial-clone remote handling

Layer / File(s) Summary
Shared remote parsing
apps/server/src/git/remoteRefs.ts, apps/server/src/git/remoteRefs.test.ts
The shared parser extracts remote names, URLs, and directions while allowing trailing bracketed annotations. The fetch URL helper maps remote names to URLs. Tests cover filters, line endings, blank lines, and malformed entries.
Repository and provider discovery
apps/server/src/project/RepositoryIdentityResolver.ts, apps/server/src/project/RepositoryIdentityResolver.test.ts, apps/server/src/sourceControl/ForgejoCli.ts, apps/server/src/sourceControl/GitHubCli.ts, apps/server/src/sourceControl/GitHubCli.test.ts, apps/server/src/sourceControl/SourceControlDiscovery.test.ts
Repository identity and provider discovery use the shared parser. The tests cover annotated fetch URLs and verify that push entries do not determine fetch-based discovery.
VCS remote listing and reuse
apps/server/src/vcs/GitVcsDriver.ts, apps/server/src/vcs/GitVcsDriver.test.ts, apps/server/src/vcs/GitVcsDriverCore.ts, apps/server/src/vcs/GitVcsDriverCore.test.ts
GitVcsDriver parses remote listings with the shared parser. GitVcsDriverCore uses the shared fetch URL helper. Tests cover annotated remote listing and reuse of an existing remote.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: juliusmarminge, maria-rcks

Merge Risk: ⚪ Minimal · up to 63c53

Partial-clone remotes should now be recognized for repository identity, provider detection, and remote reuse. No merge-blocking risk was identified.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 63c53

The change recognizes valid partial-clone remote listings while preserving destination URLs, repository-selection checks, and existing remote-creation behavior. No material security risk was found in the reviewed change.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The security-relevant input remains the working repository's configured remote names and URLs. Newly recognized annotated entries can influence repository identity, provider targeting, and remote reuse, but the annotation text itself supplies neither a destination nor additional authority.

Trust Boundaries and Controls

  • observed — Authority-sensitive consumers retain their downstream checks: repository identity uses normalized fetch URLs, GitHub selection checks the requested host and repository path, and Forgejo selection requires fetch direction, HTTP(S), and a matching host. Accepting annotations does not replace these controls.

Resilience and Maintainability Implications

  • observed — ensureRemote still lists remotes, compares normalized fetch URLs, returns an existing matching name, and adds a remote only when no match exists. Recognizing annotated fetch entries restores reuse. Base/head comparison found the same nontransactional list-then-add sequence and interruption limitations; these are pre-existing, not active PR concerns. Dedicated concurrency testing was not available.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: recognizing partial-clone remotes in git remote output.
Description check ✅ Passed The description explains the problem, change, linked issue and scope, and detailed verification results. It also states which checks were not performed. The template headings differ, and it does not i…
Linked Issues check ✅ Passed #12764 requires T3 to recognize annotated fetch remotes and restore repository-provider and PR integration. parseGitRemoteVerbose accepts bracketed annotations. The identity resolver and `ensureRemo…
Out of Scope Changes check ✅ Passed All changes support #12764. The shared parser, its fetch-only wrapper, updates to the five affected consumers, and synthetic regression tests address annotated remote parsing and its effects. No unrel…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

This branch has not been deployed

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

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Partial-clone remote annotations break repository detection and hide linked PRs

2 participants