refactor(di): decompose Ctrl god object via constructor injection (#208) - #214
Merged
Conversation
Replace `constructor(public ctrl: JournalController)` with narrow sub-interface params in all seven action/UI modules. Ctrl gains a two-phase init: constructor creates Configuration only; initServices(logger) creates all services in dependency order. Tests updated from `ctrl.logger = logger` to `ctrl.initServices(logger)`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
Author
Architecture Review Approval (PR #214)I have reviewed the implementation of PR #214 and it is perfectly aligned with the approved plan. Key Achievements:
This refactoring provides the definitive foundation for independent unit testing and long-term maintainability. Note: Gemini was involved in creating this comment (but not without consulting me). |
This was referenced May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
constructor(public ctrl: JournalController)with narrow sub-interface params in all seven action/UI modules (Inject,Parser,Writer,Reader,Dialogues,ConsoleLogger,ScanEntries)Ctrlbecomes a two-phase object: constructor createsConfigurationonly;initServices(logger: ILogger)creates all services in dependency orderctrl.logger = loggertoctrl.initServices(logger);new J.Actions.Parser(ctrl)calls replaced byctrl.parserTest plan
npm run compile— zero errorsnpm run lint— zero new warningsnpm test— 126 tests pass (verified locally)grep -rn "this\.ctrl" src/actions/ src/ext/dialogues.ts src/util/logger.ts src/provider/features/scan-entries.ts— no output (verified)Related
🤖 Generated with Claude Code