Skip to content

Fix/887 self hosted provider resolution - #529

Merged
quentinlebourles-packmind merged 17 commits into
mainfrom
fix/887-self-hosted-provider-resolution
Sep 30, 2026
Merged

quentinlebourles-packmind merged 17 commits into
mainfrom
fix/887-self-hosted-provider-resolution

Conversation

@quentinlebourles-packmind

Copy link
Copy Markdown
Contributor

Explanation

Relates to #

Type of Change

  • Bug fix
  • New feature
  • Improvement/Enhancement
  • Refactoring
  • Documentation
  • Breaking change

Affected Components

  • Domain packages affected:
  • Frontend / Backend / Both:
  • Breaking changes (if any):

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing completed
  • Test coverage maintained or improved

Test Details:

TODO List

  • CHANGELOG Updated
  • Documentation Updated

Reviewer Notes

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[High risk] Refactors how the system matches Git repositories to providers.

The PR appears safe to merge; no outstanding findings or new actionable issues remain.

Summary

The PR resolves CLI repositories against Git connections by host, preserves GitLab subgroup paths, and allows CLI-managed repositories to move to authenticated connections while retaining their targets and history. The only change since the previous review raises the published-CLI version threshold for install-at-version tests.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Remote[Git remote] --> Host[Resolve host and owner]
  Host --> Connection{Authenticated connection has access?}
  Connection -->|Yes| Connected[Use connected repository]
  Connection -->|No| CLI[Use CLI-managed repository]
  CLI --> Adoption[Later addition to connection]
  Adoption --> Retain[Retain repository ID, targets, and history]
Loading

Reviews (7) · Last reviewed commit: "✅ test(cli-e2e): gate install-at-a-versi..."

Comment thread packages/node-utils/src/git/gitHost.ts
Comment thread packages/git/src/application/useCases/addGitRepo/AddGitRepoUseCase.ts Outdated
Comment thread packages/node-utils/src/git/gitHost.ts Outdated
@quentinlebourles-packmind
quentinlebourles-packmind force-pushed the fix/887-self-hosted-provider-resolution branch from 665ff3d to 15c7709 Compare September 29, 2026 15:10
Comment thread packages/git/src/application/GitProviderService.ts Outdated
Comment thread packages/git/src/application/useCases/addGitRepo/AddGitRepoUseCase.ts Outdated
Comment thread packages/deployments/src/application/services/TargetResolutionService.ts Outdated
Comment thread packages/git/src/infra/repositories/GitProviderRepository.ts Outdated
Comment thread packages/git/src/application/GitProviderService.ts
@greptile-apps

greptile-apps Bot commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

…on the same host

gitHostOf reads the host of any remote or provider URL (https, scp-like
or ssh:// SSH, with a user, a port or a path prefix); sameGitHost compares
two of them. extractBaseUrl no longer returns a whole ssh:// remote or keeps
a user, which created one CLI-managed provider per repository.

Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The remote decides which providers are candidates, by host, and the vendor
a CLI sends is only trusted when it sends no remote. A self-hosted remote
now reaches the token provider an admin configured instead of always
falling back to a CLI-managed one, and that fallback warns when a token
provider of the host exists.

Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n provider

Adoption compares hosts instead of sources, since the CLI records a
self-hosted instance under an 'unknown' provider. A CLI-managed provider
emptied by an adoption is removed, so the repository only shows under the
token connection.

Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…emote

Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rded

Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The remote parser kept only its last two path segments, so
promyze/sandbox/quentin-nuxt became sandbox/quentin-nuxt and a repository
tracked from the CLI never matched the one a token connection lists.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…sted adoption spec

It imported @packmind/logger, which the package does not depend on, and
asserting on logger output goes against the backend test standard.

Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checking for repositories and deleting were two calls, so a repository the
CLI added in between was left on a deleted provider.

Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeping the whole group path made a remote of https://host/gitlab/group/app
read as owner gitlab/group, which the provider reports as group. The owner
now drops the path prefix of a provider on the remote's host, and adding a
repository adopts a row the CLI recorded with the prefix, under the owner
the provider reports.

Refs #887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A group read without an installation prefix now only names repositories of
the connection installed under it: tracking lookups, CLI resolution, target
resolution and adoption no longer strip the prefix from another host's group,
nor twice from a group that starts with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… setups

- A web remote of a prefixed instance is read without the prefix, an SSH one
  as is; moving a tracked branch gives the owner as such a remote carries it.
- A prefix naming the GitLab API root (/api/v4) is not part of the groups.
- A repository is found under any CLI-managed provider of its host, as older
  servers kept one per SSH remote.
- GitHub providers always reach github.com, whatever URL they store.
- A remote naming no host is refused instead of adding a provider each call.
- Tracked and known-repository lookups ignore case, as adoption records the
  owner as the provider spells it; per-provider readings are queried scoped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Older CLIs send `github.com/owner/repo`; the whole-path parser refused it and
the distribution notification failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the remote known, tracking no longer finds a repository of another host
at the same path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quentinlebourles-packmind
quentinlebourles-packmind force-pushed the fix/887-self-hosted-provider-resolution branch from 215aaad to b54d30d Compare September 30, 2026 07:30
0.36.1 is published without the feature, so the registry leg ran every
scenario against a binary that answers `*` once pnpm's release-age window let
it install that version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@quentinlebourles-packmind
quentinlebourles-packmind merged commit 78b9d9d into main Sep 30, 2026
23 checks passed
@quentinlebourles-packmind
quentinlebourles-packmind deleted the fix/887-self-hosted-provider-resolution branch September 30, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant