fix(pm): consolidate PM registration to single canonical path in integrations/bootstrap.ts#1078
fix(pm): consolidate PM registration to single canonical path in integrations/bootstrap.ts#1078
Conversation
…grations/bootstrap.ts
…test After removing the side-effect registration from src/pm/index.ts, the pm-provider-switching integration test no longer had pmRegistry populated, causing the pmRegistry assertions and createPMProvider calls to fail. Add the canonical bootstrap import (matching integration-validation.test.ts). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CI Failures ResolvedFixes Applied
Root CauseThe The fix mirrors the pattern already used in Verification
🕵️ claude-code · claude-sonnet-4-6 · run details |
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
Clean consolidation of PM integration registration to a single canonical path. The change correctly removes redundant registration code that was already a no-op at runtime, and the documentation updates accurately reflect the new state. All CI checks pass. LGTM.
Should Fix (non-blocking)
Stale JSDoc on IntegrationRegistry class (src/integrations/registry.ts:1-9)
The class-level JSDoc still says "Populated at import time by each integration module" — this contradicts the updated singleton comment on line 77 ("populated at bootstrap time by src/integrations/bootstrap.ts"). Only the singleton export comment was updated; the class-level comment was missed.
4 test files still import src/pm/index.js for (now-dead) side-effect registration
These files were not updated in this PR and still have import '../../../src/pm/index.js' with a comment "Register PM integrations in the registry":
tests/unit/triggers/label-added.test.ts:25tests/unit/triggers/status-changed.test.ts:26tests/unit/triggers/merged-status-changed.test.ts:32tests/unit/triggers/backlog-status-changed.test.ts:26
Since registration side effects were removed from src/pm/index.ts, these imports are now no-ops. The tests still pass because they don't actually need the pmRegistry to be populated (they mock the clients directly and test trigger matching logic). However, having some tests import integrations/bootstrap.js and others still import the dead pm/index.js for "registration" is inconsistent — a future developer might copy the wrong pattern.
Not blocking because tests pass and it's a consistency issue, not a correctness one.
🕵️ claude-code · claude-opus-4-6 · run details
Summary
src/pm/index.ts(lines 30-44) — eliminates the redundant registration of Trello/Jira integrations at import timesrc/pm/bootstrap.ts— dead file (never imported in production, only mocked in one test)src/pm/registry.tsandsrc/integrations/registry.tsto accurately reflect the single registration pathCLAUDE.mddocumentation to describe the canonical registration pointsrc/integrations/bootstrap.jsinstead of relying onsrc/pm/index.jsside effectsDetails
There were three registration paths for PM integrations:
src/pm/index.ts— side-effect registration at import time (removed)src/pm/bootstrap.ts— dead duplicate file (deleted)src/integrations/bootstrap.ts— the canonical registration path (kept, now the only one)Both router and worker already import
src/integrations/bootstrap.tsat the top level, so the idempotent guards already made the side-effect registrations insrc/pm/index.tsinto no-ops at runtime. This change makes the code reflect that reality.The following test files were updated to import
src/integrations/bootstrap.js(with necessary mocks) instead of relying on the now-removed side effects fromsrc/pm/index.js:tests/unit/pm/factory.test.tstests/unit/pm/lifecycle.test.tstests/unit/cli/credential-scoping.test.tstests/unit/triggers/jira-label-added.test.tstests/unit/triggers/pr-merged.test.tstests/unit/triggers/pr-ready-to-merge.test.tstests/unit/router/webhook-signature.test.ts(removed dead mock for deleted file)Test plan
npm run test:unit)npm run typecheck)npm run lint)Card: https://trello.com/c/69ce1c1d12d7f6885bbd9ca0
🤖 Generated with Claude Code
🕵️ claude-code · claude-sonnet-4-6 · run details