Skip to content

refactor(source-control): reference parsing and project matching are host resolvers - #17770

Merged
juliusmarminge merged 1 commit into
t3/sc-web-clientsfrom
t3/sc-reference-parsing
Oct 10, 2026
Merged

juliusmarminge merged 1 commit into
t3/sc-web-clientsfrom
t3/sc-reference-parsing

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

After #17757 the last real host switches in client code were these:

  • pullRequestReference.ts turned a pasted reference into a PR. It used one URL regex per host (GitHub, GitLab, Forgejo, Azure) and one CLI form per host (gh pr checkout, glab mr checkout, tea pr checkout, az repos pr checkout). It feeds the Link PR and PR-thread dialogs and the branch selector.
  • openPullRequestLink.ts matched a change request link to a project, with a Forgejo webUrl special case, kind === "azure-devops" branches, and an early dev.azure.com return.
  • pullRequestDetail.logic.ts made two GitHub/Forgejo checks: which host form a cached URL uses, and which hosts can fill in a missing reference host from the checkout.

These rules differ per host, so they become resolvers that every definition answers, not shared helpers:

Resolver Replaces
checkoutCommandArgument(input) the four CLI regexes and Azure's --id/-i parsing
isChangeRequestReference(url) the four URL regexes, kept exactly as strict as before
isChangeRequestInRepository(identity, link) findProjectForChangeRequest's Forgejo-webUrl, Azure canonical-key and path/host branches
canReadChangeRequestOnHost(identity, link) findProjectOnChangeRequestHost's Forgejo mount check, Azure's "never host-wide" rule and the shared host match
changeRequestUrlHost(url) provider === "forgejo" ? url.host : url.hostname
checkoutChangeRequestHost(identity) identity?.provider !== "github" in resolvePullRequestReferenceHost

The parts every host shares live as plain helpers in core and are used by the definitions: the authority/port check, the path match and the pullRequestHostOf host match. The Azure early return in the web helper is gone, because canReadChangeRequestOnHost returning false for Azure says the same thing per project.

No behavior change. Bitbucket and GitCafe answer null and false for the two parsing resolvers, because the old parser accepted neither their URLs nor a cafe pr checkout command. Accepting them would be a feature, and that should be its own PR.

Verification

  • I ran a throwaway parity test comparing the new parsePullRequestReference with the old one on 34 inputs. They covered every host's URL and CLI form, flags, casing, empty input, branch names and Bitbucket/GitCafe URLs, and all 34 produced identical output. The test is not committed.
  • The existing pullRequestReference.test.ts and openPullRequestLink.test.ts pass unchanged.
  • npx tsc --noEmit -p . is clean in all seven source-control-* packages, client-runtime, web, mobile and server.
  • vp test run passes on client-runtime, apps/web/src/lib, components/pullRequest, hooks and the reference consumers: 95 files, 1,311 tests.
  • vp lint on the touched files reports 0 errors, knip is clean, and the Effect-shortcut grep over the added lines finds nothing.

🤖 Generated with Claude Code

@juliusmarminge
juliusmarminge added this pull request to stack #17747 October 10, 2026 08:37
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 10, 2026
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 10, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR centralizes change-request parsing, host resolution, and project matching behind a new shared source-control resolver contract used across all providers. Although intended as a behavior-preserving refactor, its cross-package impact on link handling and cached pull-request selection warrants human review.

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

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 5.0 KiB — 6.8 KiB ✅
Codex Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Codex Live turn WebSocket decoded — 20.9 KiB — 29.3 KiB ✅
Codex Live turn messages — 2 — 8 ✅
Claude Total thread wire — 5.0 KiB — 6.8 KiB ✅
Claude Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Claude Live turn WebSocket decoded — 21.2 KiB — 29.3 KiB ✅
Claude Live turn messages — 2 — 8 ✅

Baseline: unavailable · PR result: cd33ae9 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Team
  • Run ID: adbbf936-ee4f-423d-8435-8ba73143136c

📥 Commits

Reviewing files that changed from the base of the PR and between f6baca3 and cd33ae9.


📒 Files selected for processing (7)
  • packages/source-control-azure-devops/src/client/definition.ts
  • packages/source-control-bitbucket/src/client/definition.ts
  • packages/source-control-core/src/client/definition.ts
  • packages/source-control-forgejo/src/client/definition.ts
  • packages/source-control-gitcafe/src/client/definition.ts
  • packages/source-control-github/src/client/definition.ts
  • packages/source-control-gitlab/src/client/definition.ts

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



📝 Walkthrough

Walkthrough

Source-control client definitions now handle provider-specific change-request parsing, host resolution, and project matching. Web reference parsing, project lookup, and pull request detail host resolution use these client definitions.

Changes

Provider-Aware Matching

Layer / File(s) Summary
Shared client matching contract
packages/source-control-core/src/client/definition.ts
The shared client definition adds callbacks and helpers for parsing change-request references and matching project authority, host, and repository paths.
Provider callbacks and matching rules
packages/source-control-*/src/client/definition.ts
Azure DevOps, Bitbucket, Forgejo, GitCafe, GitHub, and GitLab definitions add provider-specific parsing, host resolution, and project-matching callbacks.
Web reference parsing and project lookup
apps/web/src/pullRequestReference.ts, apps/web/src/lib/openPullRequestLink.ts, apps/web/src/components/pullRequest/pullRequestDetail.logic.ts
Web code delegates reference parsing and project matching to source-control clients. Pull request detail host resolution uses the cached detail provider’s host resolver.

Priority: ⬇️ Low

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

Change: Refactor


Merge Risk: ⚪ Minimal · up to cd33a

This refactor moves host-specific reference parsing and project matching into per-host definitions. No concrete regression was identified, so it appears safe to merge after normal checks.

Pre-merge checks | Passed 3 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check Warning The description explains the refactor and provides detailed verification results, but it does not include the required Scope and approval information. It also does not clearly separate the Problem and… Add the required Problem, Change, and Scope and approval sections. Include a link to the triaged issue or maintainer approval, or explain why this focused refactor qualifies for the small obvious fix exemption. Keep the existing detailed Ve…
✅ Passed checks (3 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main refactor: moving source-control reference parsing and project matching into host resolvers.
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: Description check

Explanation

The description explains the refactor and provides detailed verification results, but it does not include the required Scope and approval information. It also does not clearly separate the Problem and Change sections.

Resolution

Add the required Problem, Change, and Scope and approval sections. Include a link to the triaged issue or maintainer approval, or explain why this focused refactor qualifies for the small obvious fix exemption. Keep the existing detailed Verification section.


  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR





🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@juliusmarminge
juliusmarminge force-pushed the t3/sc-reference-parsing branch from 509298c to f6baca3 Compare October 10, 2026 17:25
…host resolvers

The last host switches in web parsed pasted references with one regex per
host and one CLI form per host, and matched change request links to
projects with Forgejo and Azure DevOps special cases. Each is now a resolver
every definition answers: checkoutCommandArgument, isChangeRequestReference,
isChangeRequestInRepository, canReadChangeRequestOnHost,
changeRequestUrlHost and checkoutChangeRequestHost.

No behavior change: Bitbucket and GitCafe still accept no pasted URLs or
checkout commands, which is what the old parser did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the t3/sc-reference-parsing branch from f6baca3 to cd33ae9 Compare October 10, 2026 18:50
@juliusmarminge
juliusmarminge merged commit b0249ac into main Oct 10, 2026
30 checks passed
@juliusmarminge
juliusmarminge deleted the t3/sc-reference-parsing branch October 10, 2026 19:07
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Oct 10, 2026
## What's Changed
* feat(server): stop Claude subagents without stopping their owner by @Yash-Singh1 in pingdotgg/t3code#17826
* fix(server): stopped native subagents no longer read as Running by @im-kvijay in pingdotgg/t3code#17223
* perf(server): t3_thread_list reads only the listed project's threads by @only21mil in pingdotgg/t3code#17843
* fix(server): show diffs for projects outside the server cwd by @maria-rcks in pingdotgg/t3code#17724
* fix(server): check the specific scope for scripts, preview input, and full-access MCP grants by @juliusmarminge in pingdotgg/t3code#17772
* fix(source-control): stop Forgejo status refresh from scanning every pull request by @loispostula in pingdotgg/t3code#12223
* refactor(contracts): source control provider kind is an open branded slug by @juliusmarminge in pingdotgg/t3code#17739
* feat(source-control): each host package ships a client definition by @juliusmarminge in pingdotgg/t3code#17746
* refactor(client-runtime): add project clone sources come from host definitions by @juliusmarminge in pingdotgg/t3code#17756
* refactor(web): host presentation and behavior come from client definitions by @juliusmarminge in pingdotgg/t3code#17757
* refactor(source-control): reference parsing and project matching are host resolvers by @juliusmarminge in pingdotgg/t3code#17770
* feat(pull-requests): quick actions follow each host's capabilities, not GitHub by @juliusmarminge in pingdotgg/t3code#17774
* feat(projects): new projects can be published to any ready host by @juliusmarminge in pingdotgg/t3code#17860
* fix(server): send Claude MCP servers over the control channel by @juliusmarminge in pingdotgg/t3code#17898
* fix(web): a finished reply replaced by a steer is no longer labeled partial by @juliusmarminge in pingdotgg/t3code#17761
* fix(client-runtime): queued runs that start after a steer show up in the thread by @juliusmarminge in pingdotgg/t3code#17764
* feat(mobile): choose the microphone order for voice input by @juliusmarminge in pingdotgg/t3code#17896
* feat(source-control): host settings live on each host's definition, with a GitCafe token by @juliusmarminge in pingdotgg/t3code#17901

## New Contributors
* @only21mil made their first contribution in pingdotgg/t3code#17843
* @loispostula made their first contribution in pingdotgg/t3code#12223

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261010.2935...v0.0.46-nightly.20261010.2948

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261010.2948
github-actions Bot added a commit to davidvanderklay/t3code-flake that referenced this pull request Oct 10, 2026
## What's Changed
* feat(server): stop Claude subagents without stopping their owner by @Yash-Singh1 in pingdotgg/t3code#17826
* fix(server): stopped native subagents no longer read as Running by @im-kvijay in pingdotgg/t3code#17223
* perf(server): t3_thread_list reads only the listed project's threads by @only21mil in pingdotgg/t3code#17843
* fix(server): show diffs for projects outside the server cwd by @maria-rcks in pingdotgg/t3code#17724
* fix(server): check the specific scope for scripts, preview input, and full-access MCP grants by @juliusmarminge in pingdotgg/t3code#17772
* fix(source-control): stop Forgejo status refresh from scanning every pull request by @loispostula in pingdotgg/t3code#12223
* refactor(contracts): source control provider kind is an open branded slug by @juliusmarminge in pingdotgg/t3code#17739
* feat(source-control): each host package ships a client definition by @juliusmarminge in pingdotgg/t3code#17746
* refactor(client-runtime): add project clone sources come from host definitions by @juliusmarminge in pingdotgg/t3code#17756
* refactor(web): host presentation and behavior come from client definitions by @juliusmarminge in pingdotgg/t3code#17757
* refactor(source-control): reference parsing and project matching are host resolvers by @juliusmarminge in pingdotgg/t3code#17770
* feat(pull-requests): quick actions follow each host's capabilities, not GitHub by @juliusmarminge in pingdotgg/t3code#17774
* feat(projects): new projects can be published to any ready host by @juliusmarminge in pingdotgg/t3code#17860
* fix(server): send Claude MCP servers over the control channel by @juliusmarminge in pingdotgg/t3code#17898
* fix(web): a finished reply replaced by a steer is no longer labeled partial by @juliusmarminge in pingdotgg/t3code#17761
* fix(client-runtime): queued runs that start after a steer show up in the thread by @juliusmarminge in pingdotgg/t3code#17764
* feat(mobile): choose the microphone order for voice input by @juliusmarminge in pingdotgg/t3code#17896
* feat(source-control): host settings live on each host's definition, with a GitCafe token by @juliusmarminge in pingdotgg/t3code#17901

## New Contributors
* @only21mil made their first contribution in pingdotgg/t3code#17843
* @loispostula made their first contribution in pingdotgg/t3code#12223

**Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261010.2935...v0.0.46-nightly.20261010.2948

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261010.2948
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:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant