Skip to content

Commit 8793d80

Browse files
fix(server): a repository on an unrecognized host no longer fails every PR status lookup
For a repository whose remote is on a host no source control provider recognizes (or that has no remote), the status poller asks the stand-in provider for change requests, gets an error and logs "PR lookup failed." on every refresh. A host no provider recognizes has no change requests T3 could know about, so the stand-in for "unknown" now answers listChangeRequests with an empty list; every other operation still fails as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 6524a8d commit 8793d80

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎apps/server/src/sourceControl/SourceControlProviderRegistry.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,21 @@ it.effect("includes the request cwd when an unregistered provider is used", () =
181181
}),
182182
);
183183

184+
it.effect("lists no change requests for a repository on an unrecognized host", () =>
185+
Effect.gen(function* () {
186+
const registry = yield* makeRegistry({
187+
remotes: [{ name: "origin", url: "https://git.example.internal/team/repo.git" }],
188+
});
189+
const provider = yield* registry.resolve({ cwd: "/repo" });
190+
191+
assert.strictEqual(provider.kind, "unknown");
192+
assert.deepStrictEqual(
193+
yield* provider.listChangeRequests({ cwd: "/repo", headSelector: "master", state: "all" }),
194+
[],
195+
);
196+
}),
197+
);
198+
184199
it.effect("retains VCS detection failures with structured cwd context", () =>
185200
Effect.gen(function* () {
186201
const cause = new VcsRepositoryDetectionError({

‎apps/server/src/sourceControl/SourceControlProviderRegistry.ts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,18 @@ function unsupportedProvider(
6767
): SourceControlProvider.SourceControlProvider["Service"] {
6868
return SourceControlProvider.SourceControlProvider.of({
6969
kind,
70+
// A remote on a host no provider recognizes (or no remote at all) has no change
71+
// requests T3 could know about. Answering with none keeps the status poller from
72+
// failing, and warning, on every refresh of such a repository.
7073
listChangeRequests: (input) =>
71-
new SourceControlProviderError({
72-
provider: kind,
73-
operation: "listChangeRequests",
74-
cwd: input.cwd,
75-
detail: `No ${kind} source control provider is registered.`,
76-
}),
74+
kind === "unknown"
75+
? Effect.succeed([])
76+
: new SourceControlProviderError({
77+
provider: kind,
78+
operation: "listChangeRequests",
79+
cwd: input.cwd,
80+
detail: `No ${kind} source control provider is registered.`,
81+
}),
7782
getChangeRequest: (input) =>
7883
new SourceControlProviderError({
7984
provider: kind,

0 commit comments

Comments
 (0)