Title#
feat: tenant config routing — platform → service triple (BJ-11)
Problem#
Dispatch-path services (PhaseRouterService, PhaseHooksService, CompoundService) import GitHubService directly, making it impossible to route multi-platform events to the correct concrete service. This blocks Bitbucket/Jira dispatch in Wave 3.
Task / Link#
Closes #551 (BJ-11: Tenant config routing — platform → service triple)
Changes#
- New
src/tenant/platform-services.ts—PLATFORM_SERVICESinjection token +PlatformServicesMaptype - New
src/tenant/tenant-config.service.spec.ts— unit tests forgetPlatformServices()(happy path, unknown platform, missing platform) - Extend
TenantConfigService.getPlatformServices(platform)— returns{ service, adapter, authProvider }triple; throwsBadRequestExceptionon empty platform,NotFoundExceptionon unknown platform - Promote
AdapterRegistrytoPlatformModule(providers + exports), removing it fromWebhookModuleto break potential circular dependency - Update
TenantModule— registersPLATFORM_SERVICESfactory{ github: GitHubService }, importsPlatformModule - Refactor
PhaseRouterService— dropsGitHubServiceinjection; routesvalidateCompoundScopethroughtenantConfig.getPlatformServices('github').service - Refactor
PhaseHooksServiceandCompoundService— replace directGitHubServiceinjection withTenantConfigService; all GitHub calls now routed throughgetPlatformServices() - Update all three spec files to inject a
TenantConfigServicestub returning the service triple
Notes#
postFeedbackCommentinPhaseRouterServicecontinues to usePlatformServiceResolver(the minimalPlatformProviderinterface), which handles the platform-agnosticpostCommentcall already established in BJ-11 (PR #587).getPlatformServices()is complementary: it exposes the full concrete service for GitHub-specific methods not covered byPlatformProvider.- Typing
serviceasGitHubServicein the return type is intentional and temporary —PlatformProviderexpansion to cover more methods is deferred to Wave 3 sibling tickets.
Testing#
npm run lint— zero warningsnpm run test— 994/994 passing (154 new/updated assertions in 4 spec files)- Grep audit:
grep -r "from '../github/github.service'" src/phase-router src/hooks→ zero matches