refactor(router): extract platformClients god module into focused sub-modules#542
Conversation
|
🤖 Just a sec, looking into that PR refactor Progress: [███░░░░░░░] 31% (iteration 22/70) 🔧 CI Fix Update (1 min) I've identified the root cause of the CI failure: the Last updated: iteration 22 · respond-to-ci |
|
🤖 Just a sec, looking into that PR refactor Progress: [███░░░░░░░] 30% (iteration 21/70) 🔧 CI Fix Update (1 min) I've identified that Last updated: iteration 21 · respond-to-ci |
…xtraction The adapter test files were mocking the old monolith path 'platformClients.js' instead of the new 'platformClients/index.js', causing dispatchWithCredentials to receive undefined credentials. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CI Failures ResolvedFixes Applied
Root CauseWhen the PR updated consumer imports from Verification
|
CI Failures ResolvedRoot CauseThe Fixes Applied
Verification
|
|
🤖 Just a sec, looking into that PR for you |
nhopeatall
left a comment
There was a problem hiding this comment.
LGTM — clean mechanical extraction of a god module into focused sub-modules. Verified:
- All 10 previously-public symbols are re-exported from the barrel (
index.ts) - No stale imports to the old
platformClients.jspath remain anywhere in the codebase - All 6 consumer import paths and 3 test mock paths updated correctly
- New file contents are character-for-character identical to original (modulo adjusted relative import paths)
- CI passes (lint, typecheck, all tests)
- Directory structure follows the existing pattern (similar to
pm/layer mentioned in the PR)
Summary
Refactors
src/router/platformClients.ts— a 367-line god module mixing 5 unrelated concerns — into a focused directory structure following the existingpm/layer pattern.PlatformCommentClientinterface andJiraCredentialsWithAuthtype intoplatformClients/types.tsresolveTrelloCredentials,resolveJiraCredentials,resolveGitHubHeaders) intoplatformClients/credentials.tsTrelloPlatformClientclass intoplatformClients/trello.tsGitHubPlatformClientclass intoplatformClients/github.tsJiraPlatformClient+_jiraCloudIdCache+_resetJiraCloudIdCacheintoplatformClients/jira.tsplatformClients/index.tsbarrel that re-exports every previously-public symbolsrc/router/platformClients.tsmonolith./platformClients/index.js(required by TypeScript NodeNext module resolution)tests/unit/router/platformClients.test.tsZero behavioral changes — public API surface is fully preserved via the barrel export.
Test plan
platformClients.test.tstests pass unchangednpm run typecheckpasses with zero errorsnpm run lintpasses (pre-existing warning in unrelated file)Trello card: https://trello.com/c/uAgPL8o1/114-find-top-candidate-for-refactoring-and-plan-clean-refactoring-of-it-look-for-god-classes-modules-functions-files-code-duplicatio
🤖 Generated with Claude Code