Require one source control connection per environment - #840
Open
daniel-lxs wants to merge 1 commit into
Open
Conversation
…ment Environments already had to keep all repositories on a single GitHub App installation, but nothing enforced the analogous invariant for the other providers: task launch resolves one provider token and one base URL per run, so an environment mixing providers or self-managed instances could never authenticate against all of its repositories. Replace getEnvironmentRepositoryInstallationError with getEnvironmentRepositoryConnectionError, which checks in order that all environment repositories share the same source control provider, the same GitHub App installation, and the same instance host. Provider and host comparisons ignore null/undefined values so historical rows that predate host backfill keep validating. All existing enforcement sites (web environment commands, MCP create/update environment handlers, environment-definition task launch, declarative environments) now query sourceControlProvider and host and run the broader check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Contributor
|
I reviewed RooCodeInc/Roomote#840 on GitHub and found no code issues. All CI checks are passing. |
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.
Problem
Environments already enforce that all repositories belong to the same GitHub App installation, but there was no analogous rule for the other providers. Task launch resolves a single provider token and base URL per run, so an environment mixing providers — or mixing self-managed instances of the same provider (e.g. two Gitea hosts) — could never authenticate against all of its repositories. Today a single instance per provider makes the host rule vacuous, but it becomes load-bearing groundwork once multiple connections per provider are supported.
Change
getEnvironmentRepositoryInstallationErrorwithgetEnvironmentRepositoryConnectionErrorin@roomote/types, checking in order:repositories.host).null/undefinedvalues, matching the existing installation check, so historical rows that predate the host backfill keep validating.sourceControlProvider+hostand run the broader check: web environment create/update/validate commands and repository selection, MCPcreateEnvironment/updateEnvironmenthandlers, environment-definition task launch (requireSingleInstallationoption renamed torequireSingleConnection), and declarative environments.Testing
packages/types/src/__tests__/environment-repository-connection.test.tscovering provider/installation/host mismatches, null-host backfill tolerance, and check precedence.apps/web/.../environments/index.test.ts(multi-host create rejection, mixed-providervalidateConfigCommanderror).pnpm check-types,pnpm lint,pnpm knipall pass; targeted vitest runs for@roomote/types,@roomote/webenvironments commands,@roomote/apilaunchTask + environment write auth, and the DB-backed declarative-environments suite all green.🤖 Generated with Claude Code