Plan: Extract hardcoded constants (org, labels) to TenantConfig#
Summary#
Replace hardcoded GH_ORG constant and label strings ('in-refinement', 'refined', 'in-review', 'agent-blocked') with lookups from TenantConfigService. This makes org and label names configurable per tenant (Wave 2 config extraction). Depends on #348 (TenantConfigService must exist).
Files#
| File | Action | Description |
|---|---|---|
src/config/constants.ts | modify | Remove GH_ORG; inline ARTEFACTS_REPO value |
src/hooks/phase-hooks.service.ts | modify | Inject TenantConfigService; replace 5 hardcoded label strings + any org refs |
src/hooks/phase-hooks.service.spec.ts | modify | Provide TenantConfigService mock in test module |
src/webhook/adapters/github.adapter.ts | modify | Inject TenantConfigService; replace 3 'in-refinement' comparisons with config lookup |
src/webhook/adapters/github.adapter.spec.ts | modify | Provide TenantConfigService mock in test module |
src/artefacts/artefacts.service.ts | modify | Inject TenantConfigService; replace GH_ORG usages (lines 79, 254, 288, 373, 419) with tenantConfig.org |
src/artefacts/artefacts.service.spec.ts | modify | Provide TenantConfigService mock; update assertions referencing GH_ORG |
src/hooks/hooks.module.ts | modify | Add TenantConfigService to module providers/imports if not already present |
src/webhook/webhook.module.ts | modify | Add TenantConfigService to module providers/imports if not already present |
Steps#
- Remove
GH_ORGfromconstants.ts: Delete theGH_ORGexport. ChangeARTEFACTS_REPOto use inline string'AgentSDE/agent-core-artefacts'(infrastructure constant, not tenant-specific per issue scope). - Update
phase-hooks.service.ts: InjectTenantConfigServicevia constructor. Replace'agent-blocked'→tenantConfig.labels.agentBlocked,'in-refinement'→tenantConfig.labels.inRefinement,'refined'→tenantConfig.labels.refined,'in-review'→tenantConfig.labels.inReviewat lines 123, 216, 224, 238, 252, 256, 290. - Update
github.adapter.ts: InjectTenantConfigService. Replace'in-refinement'string comparisons at lines 136, 567, 638 withtenantConfig.labels.inRefinement. - Update
artefacts.service.ts: InjectTenantConfigService. Replace allGH_ORGreferences (lines 79, 254, 288, 373, 419) withthis.tenantConfig.getConfig().org. - Update unit tests: Add
TenantConfigServicemock (returning default config values) to test modules forphase-hooks.service.spec.ts,github.adapter.spec.ts, andartefacts.service.spec.ts. - Verify: Run
tsc --noEmit,npm run lint,npm run test. Grep for remainingGH_ORGand hardcoded label strings insrc/.
Verification#
grep -r "GH_ORG" src/returns zero results (excluding test assertions that reference the default value'AgentSDE')grep -rn "'in-refinement'\|'refined'\|'in-review'\|'agent-blocked'" src/hooks/phase-hooks.service.ts src/webhook/adapters/github.adapter.tsreturns zero resultsnpm run testandnpm run lintpass clean
Risks#
- Dependency on #348:
TenantConfigServicemust be merged first. If the interface shape changes, config accessor calls in this PR will need updating. ARTEFACTS_REPOinlining: Changing from${GH_ORG}/...to a hardcoded string is safe since ARTEFACTS_REPO is infrastructure-scoped, but creates a second'AgentSDE'hardcoded string in constants.ts — acceptable per issue scope.