refactor(arch): introduce JournalController interface, break barrel cycle - #213
Merged
Conversation
Captures the interface design, type-migration constraint (EntryGranularity etc. must move to model/ to avoid a new cycle), and the six modules whose barrel imports are replaced. #207
Covers 10 ordered steps: type migration, new interfaces.ts, Ctrl implements, then barrel removal in logger/writer/inject/reader/ parser/dialogues. Includes import tables per file and five test scenarios. #207
…ycle (#207) Add JournalController + sub-interfaces (ILogger, IConfiguration, IParser, IWriter, IReader, IInject, IDialogues) in src/model/interfaces.ts. Migrate EntryGranularity, NavigationMode, ScopeDefinitionLite, InputDetailsTimeFormat from ext/conf.ts to model/config.ts; ext/conf.ts re-exports them for backward compat. Replace `import * as J from '../.'` with direct named imports in: - src/util/logger.ts - src/actions/parser.ts, writer.ts, reader.ts, inject.ts - src/ext/dialogues.ts Ctrl now declares `implements JournalController` — compiler validates coverage. ScanEntries constructor updated to JournalController to allow Dialogues (which passes ctrl) to satisfy the type. No behavior changes; all 126 tests pass. #207
Owner
Author
Architecture Review Approval (PR #213)I have reviewed the implementation and the deviations from the original plan. This PR successfully breaks the ubiquitous circular dependency and significantly improves the project's structural integrity. Review of Plan Deviations:
Key Achievements:
Great work on this foundational refactoring. Note: Gemini was involved in creating this comment (but not without consulting me). |
4 tasks
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
JournalControllerand seven sub-interfaces (ILogger,IConfiguration,IParser,IWriter,IReader,IInject,IDialogues) insrc/model/interfaces.tsimport * as J from '../.'barrel fromlogger.ts,parser.ts,writer.ts,reader.ts,inject.ts,dialogues.tsEntryGranularity,NavigationMode,ScopeDefinitionLite,InputDetailsTimeFormattosrc/model/config.ts;ext/conf.tsre-exports them for backward compatCtrldeclaresimplements JournalController— TypeScript validates coverage at compile timeScanEntriesconstructor updated toJournalController(minimal change; barrel stays for its other usages pending Phase 2.3 cleanup)Related
controller.ts— complementary, independent track)docs/specs/2026-05-17-207-interface-journal-controller.mddocs/plans/2026-05-17-207-interface-journal-controller.mdTest plan
npm run compile— zero errorsnpm run lint— zero warningsnpm test— 126/126 pass, no regressionsgrep -rn "import \* as J from"in the 6 updated modules — no output🤖 Generated with Claude Code