Skip to content

refactor(backends): decompose adapter.ts into sidecarManager, progressLifecycle, secretOrchestrator#1014

Merged
aaight merged 1 commit intodevfrom
feature/decompose-backends-adapter
Mar 23, 2026
Merged

refactor(backends): decompose adapter.ts into sidecarManager, progressLifecycle, secretOrchestrator#1014
aaight merged 1 commit intodevfrom
feature/decompose-backends-adapter

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Mar 23, 2026

Summary

  • Extract sidecar management into src/backends/sidecarManager.ts — moves createCompletionArtifacts(), hydrateReviewSidecar(), hydratePrSidecar(), hydrateNativeToolSidecars(), and cleanupTempFile()
  • Extract progress lifecycle into src/backends/progressLifecycle.ts — moves buildProgressMonitorConfig() and isGitHubAckComment()
  • Extract secret orchestration into src/backends/secretOrchestrator.ts — moves buildExecutionPlan(), resolvePartialExecutionPlan(), and adds injectRunLinkSecrets()
  • Thin adapter.ts orchestrator — reduced from 623 lines to 183 lines, importing from the 3 new modules
  • Unit tests added for each new module: sidecarManager.test.ts (24 tests), progressLifecycle.test.ts (19 tests), secretOrchestrator.test.ts (8 tests)

Closes: https://trello.com/c/JE1jx5i8/532-as-a-developer-i-want-backends-adapterts-decomposed-into-focused-modules-so-that-each-concern-is-independently-testable

Test plan

  • All 55 existing adapter.test.ts tests pass
  • 24 new sidecarManager.test.ts tests pass
  • 19 new progressLifecycle.test.ts tests pass
  • 8 new secretOrchestrator.test.ts tests pass
  • Full test suite (6676 tests) passes with zero regressions
  • npm run typecheck passes with no errors
  • npm run lint passes with no errors

🤖 Generated with Claude Code

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 95.59229% with 16 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/backends/secretOrchestrator.ts 95.69% 8 Missing ⚠️
src/backends/sidecarManager.ts 94.44% 7 Missing ⚠️
src/backends/progressLifecycle.ts 97.77% 1 Missing ⚠️

📢 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 decomposition of a 623-line orchestrator into three focused modules with clear responsibility boundaries, no circular dependencies, and comprehensive unit test coverage.

The refactoring is behavior-preserving: every extracted function is a verbatim move with only the necessary visibility changes (functionexport function). The dependency graph flows cleanly: adapter.ts{secretOrchestrator, progressLifecycle, sidecarManager}, and secretOrchestrator{progressLifecycle, sidecarManager} with no cycles.

The one type change in hydrateNativeToolSidecars (from Awaited<ReturnType<AgentEngine['execute']>> to AgentEngineResult) is semantically identical since execute() returns Promise<AgentEngineResult>. The shared isGitHubAckComment utility is correctly placed in progressLifecycle.ts and imported by both consumers. The barrel export (index.ts) remains unchanged, so the public API surface is unaffected.

All 7 CI checks pass. 51 new tests cover the extracted modules well, including edge cases like ackCommentId: 0.

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

@aaight aaight merged commit abcae62 into dev Mar 23, 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