AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-349
  5. plan
  6. plan.md
plan.md(2.5 KB)· Apr 8, 2026· 2 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks

Plan: Migrate PhaseHooksService from GitHubService to PlatformProvider#

Summary#

Replace direct GitHubService injection in PhaseHooksService with the PlatformProvider interface (from #345), making phase hooks platform-agnostic. This is a Wave 2 consumer migration in the multi-tenant initiative.

Files#

FileActionDescription
src/hooks/phase-hooks.service.tsmodifySwap GitHubService injection for @Inject(PLATFORM_PROVIDER) PlatformProvider; replace all this.github.* calls with this.platform.*; use optional chaining on setProjectItemStatus
src/hooks/phase-hooks.module.tsmodifyReplace GitHubModule import with PlatformModule
src/hooks/phase-hooks.service.spec.tsmodifyReplace GitHubService mock with PLATFORM_PROVIDER token mock using the PlatformProvider interface type

Steps#

  1. Update phase-hooks.service.ts constructor injection — Replace private readonly github: GitHubService with @Inject(PLATFORM_PROVIDER) private readonly platform: PlatformProvider. Remove GitHubService import, add PlatformProvider and PLATFORM_PROVIDER imports from the platform module.
  2. Replace all this.github.* call sites — Rename every this.github.addLabel, removeLabel, postComment, mergePR, closePR, closeIssue, getCheckStatus, getReviewStatus to this.platform.*. Change this.github.setProjectItemStatus(...) to this.platform.setProjectItemStatus?.(...) with optional chaining.
  3. Update phase-hooks.module.ts — Replace GitHubModule import with PlatformModule. Remove GitHubModule import statement.
  4. Update phase-hooks.service.spec.ts — Change the mock provider from { provide: GitHubService, useValue: {...} } to { provide: PLATFORM_PROVIDER, useValue: {...} }. Update the mock retrieval from module.get(GitHubService) to module.get(PLATFORM_PROVIDER). Update the type annotation from jest.Mocked<GitHubService> to jest.Mocked<PlatformProvider>.

Verification#

  • tsc --noEmit passes with no errors
  • npm run lint passes with zero warnings
  • npm run test -- --testPathPattern=phase-hooks — all existing tests pass with PlatformProvider mock

Risks#

  • Blocked by #345: PlatformProvider interface and PlatformModule must land on rc/multi-tenant first. Do not merge this PR until #345 is merged.
  • setProjectItemStatus optional chaining: If PlatformProvider types setProjectItemStatus as required (not optional), the ?. syntax may need adjustment to match the interface definition.
ContextPrd