Repository navigation
feat(vcs): expose the installation's organization URL - #13875
Merged
Merged
Conversation
Brings getOrganizationUrl, which resolves an owner's browser URL from the adapter's configured host. The constraint already allowed it, so only the lock moves.
The installation response carried the provider name and the organization name but no URL, so a client linking to the organization had to assemble one from a hardcoded provider domain. That is wrong for every self-hosted GitLab and Gitea instance, where the host is whatever the install is configured with. Add organizationUrl to the installation model, resolved through the adapter, which already knows the configured host. Reading it needs no credentials or network, so the list endpoint builds it per row from the provider registry rather than from the installation's stored tokens. Providers that are no longer configured leave the field at its empty default rather than failing the read.
Contributor
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
ArnabChatterjee20k
approved these changes
Sep 24, 2026
Gitea can be reachable on a different host from the browser than from the server, which is what _APP_VCS_GITEA_BROWSER_ENDPOINT exists for. Resolving the adapter through fromProvider() picked the server-side endpoint, so the organization link could point at a host only the server can reach, such as an internal Docker name. Resolve browser-facing links through their own endpoint, kept in the provider registry next to the API one, and cover the field on both the get and list routes.
The expectation rebuilt the URL from the same environment variables and trimming as the endpoint under test, so it asserted that the test agreed with the implementation rather than that the response was right. Ask Gitea for the owner's page instead, which it derives from its own configured root, so a hardcoded provider domain or a mangled host fails the assertion.
…ames Expecting the html_url from Gitea's API tied the assertion to the server-side root, so a deployment whose browser host differs would fail the test even though the response was right. Assert what holds under either arrangement: the link addresses the owner, it answers, and both routes agree on it.
Fetching the organization URL from the e2e test assumed the browser-facing host is reachable from the container running the tests, which is the one thing a separate browser endpoint exists to allow. That test could fail on a correct response. Cover which host is chosen in FactoryTest, where both endpoints can be set and neither has to be reachable, and leave the e2e asserting what holds under any arrangement: the link addresses the owner and both routes agree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The installation response carries
providerandorganizationbut no URL, so anything linking to the organization has to assemble one from a hardcoded provider domain. On a self-hosted GitLab or Gitea that produces agitlab.comlink for an organization that only exists on the customer's own instance.The console does exactly this today:
getProviderOwnerUrl()in vibes'src/lib/vcs/providers.tsxbuildshttps://gitlab.com/${organization}, and both of its callers,GitConfigurationCard.tsxandGitInstallationContextMenu.tsx, already hold the installation, so they can read this field instead.This adds
organizationUrltoMODEL_INSTALLATION, built by the adapter from the configured host:Browser-facing host
The link is opened by a browser, which can reach the provider on a different host from the server. Gitea already models this with
_APP_VCS_GITEA_BROWSER_ENDPOINT, used byGitea/Authorize/Get.phpfor the login redirect. Resolving the adapter withfromProvider()would pick the server-side endpoint and hand the console a link such ashttp://gitea:3000/appwrite, which only the server can reach.Factory::fromProviderForBrowser()builds the adapter asfromProvider()does, then applies the provider'sbrowserEndpointfrom the registry when one is set. Only Gitea declares one; every other provider falls through to its API endpoint unchanged.Building the adapter this way needs no credentials and makes no network call, so the list endpoint does it per row without touching stored tokens. A provider that is no longer configured leaves the field at its empty default rather than failing the read.
Depends on
utopia-php/vcs5.5.1 forgetOrganizationUrl()(utopia-php/monorepo#345). The existing5.5.*constraint already allowed it, so only the lock moves.Test Plan
tests/unit/Vcs/FactoryTest.php— which host is chosen. With both endpoints set,fromProvider()yieldshttp://gitea:3000/ownerandfromProviderForBrowser()yieldshttps://git.example.com/owner; a provider with no browser endpoint falls back to its API endpoint. Ran locally: 14 tests, 55 assertions, passing.tests/e2e/Services/VCSGitea/VCSGiteaConsoleClientTest.php::testInstallationOrganizationUrl— against the real Gitea in CI, both the list and get routes return the field, it addresses the installation's owner, and the two routes agree. It deliberately does not assert or fetch the host: the browser-facing host need not be reachable from the container running the tests, which is the case a separate browser endpoint exists for.composer lintand PHPStan level 4 clean on the changed files.Related PRs and Issues
gitlab.comowner link.gitlab.comfor commit, branch and merge request links, and several deployment views detect the provider by matchinggitlab.comin a URL; neither is addressed here.