Skip to content

Commit 71cb5f1

Browse files
authored
fix(integrations): namespace GitHub connect DI tokens to avoid collision (#2579)
1 parent 2fc1920 commit 71cb5f1

6 files changed

Lines changed: 25 additions & 5 deletions

File tree

apps/code/src/renderer/desktop-contributions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { billingCoreModule } from "@posthog/core/billing/billing.module";
22
import { inboxCoreModule } from "@posthog/core/inbox/inbox.module";
3+
import { githubConnectModule } from "@posthog/core/integrations/githubConnect.module";
34
import { onboardingModule } from "@posthog/core/onboarding/onboarding.module";
45
import { setupCoreModule } from "@posthog/core/setup/setup.module";
56
import { CONTRIBUTION } from "@posthog/di/contribution";
@@ -30,6 +31,7 @@ export function registerDesktopContributions(): void {
3031
connectivityUiModule,
3132
fileWatcherUiModule,
3233
focusUiModule,
34+
githubConnectModule,
3335
inboxCoreModule,
3436
notificationsUiModule,
3537
onboardingModule,

apps/code/src/renderer/desktop-services.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import {
1818
} from "@posthog/core/inbox/identifiers";
1919
import { selectModelFromOptions } from "@posthog/core/inbox/reportTaskCreation";
2020
import {
21+
GITHUB_CONNECT_CLIENT as INTEGRATIONS_GITHUB_CONNECT_CLIENT,
22+
type GithubConnectClient as IntegrationsGithubConnectClient,
2123
REPOSITORIES_CLIENT,
2224
REPOSITORIES_SERVICE,
2325
type RepositoriesClient,
@@ -52,7 +54,10 @@ import {
5254
type FileWatcherClient,
5355
} from "@posthog/ui/features/file-watcher/identifiers";
5456
import { GIT_CACHE_KEY_PROVIDER } from "@posthog/ui/features/git-interaction/gitCacheProvider";
55-
import { UiRepositoriesClient } from "@posthog/ui/features/integrations/integrationsClientImpl";
57+
import {
58+
UiGithubConnectClient,
59+
UiRepositoriesClient,
60+
} from "@posthog/ui/features/integrations/integrationsClientImpl";
5661
import { NAVIGATION_TASK_BINDER } from "@posthog/ui/features/navigation/taskBinder";
5762
import { navigationTaskBinder } from "@posthog/ui/features/navigation/taskBinderImpl";
5863
import {
@@ -134,6 +139,9 @@ container
134139
.toConstantValue(new OnboardingGithubConnectClient());
135140

136141
// integrations
142+
container
143+
.bind<IntegrationsGithubConnectClient>(INTEGRATIONS_GITHUB_CONNECT_CLIENT)
144+
.toConstantValue(new UiGithubConnectClient());
137145
container
138146
.bind<RepositoriesClient>(REPOSITORIES_CLIENT)
139147
.toConstantValue(new UiRepositoriesClient());

apps/code/src/renderer/di/bindings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ import {
4242
type ReportModelResolver,
4343
} from "@posthog/core/inbox/identifiers";
4444
import {
45+
GITHUB_CONNECT_CLIENT as INTEGRATIONS_GITHUB_CONNECT_CLIENT,
46+
type GithubConnectClient as IntegrationsGithubConnectClient,
4547
REPOSITORIES_CLIENT,
4648
REPOSITORIES_SERVICE,
4749
type RepositoriesClient,
@@ -268,6 +270,7 @@ export interface RendererBindings {
268270
[REPORT_MODEL_RESOLVER]: ReportModelResolver;
269271
[LINEAR_OAUTH_FLOW]: LinearOAuthFlow;
270272
[GITHUB_CONNECT_CLIENT]: GithubConnectClient;
273+
[INTEGRATIONS_GITHUB_CONNECT_CLIENT]: IntegrationsGithubConnectClient;
271274
[REPOSITORIES_CLIENT]: RepositoriesClient;
272275
[REPOSITORIES_SERVICE]: RepositoriesService;
273276
[HEDGEHOG_MODE_HOST]: HedgehogModeHost;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { ContainerModule } from "inversify";
2+
import { GithubConnectService } from "./githubConnectService";
3+
import { GITHUB_CONNECT_SERVICE } from "./identifiers";
4+
5+
export const githubConnectModule = new ContainerModule(({ bind }) => {
6+
bind(GITHUB_CONNECT_SERVICE).to(GithubConnectService).inSingletonScope();
7+
});

packages/core/src/integrations/identifiers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export interface GithubConnectClient {
3838
}
3939

4040
export const GITHUB_CONNECT_CLIENT = Symbol.for(
41-
"posthog.core.githubConnectClient",
41+
"posthog.core.integrations.githubConnectClient",
4242
);
4343

4444
export const GITHUB_CONNECT_SERVICE = Symbol.for(
45-
"posthog.core.githubConnectService",
45+
"posthog.core.integrations.githubConnectService",
4646
);

packages/core/src/onboarding/identifiers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ export interface GithubConnectClient {
33
}
44

55
export const GITHUB_CONNECT_CLIENT = Symbol.for(
6-
"posthog.core.githubConnectClient",
6+
"posthog.core.onboarding.githubConnectClient",
77
);
88

99
export const GITHUB_CONNECT_SERVICE = Symbol.for(
10-
"posthog.core.githubConnectService",
10+
"posthog.core.onboarding.githubConnectService",
1111
);

0 commit comments

Comments
 (0)