Skip to content

refactor(integrations): migrate integration checker to registry, delete legacy functions#1077

Merged
aaight merged 1 commit intodevfrom
feature/migrate-integration-checker-to-registry
Apr 3, 2026
Merged

refactor(integrations): migrate integration checker to registry, delete legacy functions#1077
aaight merged 1 commit intodevfrom
feature/migrate-integration-checker-to-registry

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Apr 3, 2026

Summary

  • Migrates createIntegrationChecker to use integrationRegistry — Replaces three hardcoded dynamic import() calls for legacy functions with a registry-based loop over integrationRegistry.getByCategory(cat).hasIntegration(projectId)
  • Makes SentryAlertingIntegration.hasIntegration() self-contained — Inlines logic by calling getSentryIntegrationConfig directly instead of delegating to the now-deleted hasAlertingIntegration()
  • Deletes standalone legacy functions — Removes hasScmIntegration(), hasScmPersonaToken(), hasAlertingIntegration(), hasPmIntegration() and their test files; deletes src/github/integration.ts entirely

Changes

Source

  • src/agents/capabilities/resolver.ts — Replaces dynamic imports + 3 hardcoded function calls with static import of integrationRegistry and a loop over categories
  • src/sentry/alerting-integration.ts — Inlines hasIntegration() to call getSentryIntegrationConfig() directly
  • src/sentry/integration.ts — Removes hasAlertingIntegration() standalone function
  • src/pm/integration.ts — Removes hasPmIntegration() standalone function + cleans up unused imports
  • src/pm/index.ts — Removes hasPmIntegration re-export
  • src/github/integration.tsDeleted (all logic already present in GitHubSCMIntegration)
  • src/github/scm-integration.ts — Updates file-level comment
  • docs/architecture/04-agent-system.md — Updates mermaid diagram to reference registry pattern

Tests

  • tests/unit/agents/capabilities/resolver.test.ts — Adds describe('createIntegrationChecker') with 8 tests mocking integrationRegistry.getByCategory()
  • tests/unit/sentry/integration.test.ts — Removes hasAlertingIntegration tests (function deleted)
  • tests/unit/sentry/alerting-integration.test.ts — Updates hasIntegration tests for inlined logic
  • tests/unit/github/integration.test.tsDeleted (functions deleted)
  • tests/unit/pm/integration.test.tsDeleted (function deleted)
  • tests/integration/integration-validation.test.ts — Replaces direct legacy function imports with registry-based helpers

Test plan

  • npm test — all 7241 unit tests pass
  • npm run typecheck — no errors
  • npm run lint — no errors (2 pre-existing warnings unrelated to this PR)

Notes

  • No circular dependency introduced — integrationRegistry is a lightweight Map singleton
  • getSentryIntegrationConfig() is preserved (still used by trigger handlers)

Trello: https://trello.com/c/69ce1c0bed6950f676d4cc39

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

LGTM — clean migration from hardcoded standalone functions to the existing integrationRegistry pattern. All deleted functions are fully covered by their class-method equivalents, no remaining consumers of the removed exports, and the new createIntegrationChecker implementation correctly uses integrationRegistry.getByCategory() with OR semantics across registered providers.

Verified:

  • hasAlertingIntegration() inlined into SentryAlertingIntegration.hasIntegration() is logically identical (both call getSentryIntegrationConfig and check !== null)
  • hasPmIntegration() and hasScmIntegration() logic already lived in TrelloIntegration/JiraIntegration and GitHubSCMIntegration respectively — no behavioral change
  • No dangling imports of deleted src/github/integration.ts, hasPmIntegration, or hasAlertingIntegration in production code
  • The IntegrationCategory type ('pm' | 'scm' | 'alerting') exactly matches the hardcoded categories array in createIntegrationChecker
  • Integration test helper functions correctly replicate the registry-based pattern
  • Unit tests for createIntegrationChecker cover all key scenarios (per-category, empty registry, OR logic, projectId passthrough)
  • All CI checks pass

🕵️ claude-code · claude-opus-4-6 · run details

@aaight aaight merged commit 47aaeb9 into dev Apr 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants