Skip to content

refactor(arch): introduce JournalController interface, break barrel cycle - #213

Merged
pajoma merged 3 commits into
developfrom
feat/207-interface-journal-controller
May 17, 2026
Merged

refactor(arch): introduce JournalController interface, break barrel cycle#213
pajoma merged 3 commits into
developfrom
feat/207-interface-journal-controller

Conversation

@pajoma

@pajoma pajoma commented May 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Introduces JournalController and seven sub-interfaces (ILogger, IConfiguration, IParser, IWriter, IReader, IInject, IDialogues) in src/model/interfaces.ts
  • Removes import * as J from '../.' barrel from logger.ts, parser.ts, writer.ts, reader.ts, inject.ts, dialogues.ts
  • Migrates EntryGranularity, NavigationMode, ScopeDefinitionLite, InputDetailsTimeFormat to src/model/config.ts; ext/conf.ts re-exports them for backward compat
  • Ctrl declares implements JournalController — TypeScript validates coverage at compile time
  • ScanEntries constructor updated to JournalController (minimal change; barrel stays for its other usages pending Phase 2.3 cleanup)

Related

Test plan

  • npm run compile — zero errors
  • npm run lint — zero warnings
  • npm test — 126/126 pass, no regressions
  • grep -rn "import \* as J from" in the 6 updated modules — no output

🤖 Generated with Claude Code

pajoma added 3 commits May 17, 2026 21:28
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
@pajoma

pajoma commented May 17, 2026

Copy link
Copy Markdown
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:

  • Type Migration: Moving InputDetailsTimeFormat to model/config.ts was a correct course correction to handle the complex moment.js return type while maintaining layer purity.
  • ScanEntries Refactor: Updating the ScanEntries constructor to accept JournalController is a necessary step to support the refactored Dialogues class and further weakens the concrete Ctrl coupling.

Key Achievements:

  • Barrel Cycle Broken: The core action and UI modules are now decoupled from the root barrel.
  • Interface Foundation: We now have a clean suite of interfaces (IConfiguration, ILogger, etc.) that will simplify unit testing and future refactoring.
  • Contract Validation: The Ctrl class now explicitly implements the JournalController interface, ensuring the God Object doesn't drift during further decomposition.

Great work on this foundational refactoring.


Note: Gemini was involved in creating this comment (but not without consulting me).

@pajoma
pajoma merged commit c012a48 into develop May 17, 2026
2 checks passed
@pajoma
pajoma deleted the feat/207-interface-journal-controller branch May 17, 2026 19:55
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.

Arch: Break ubiquitous circular coupling via Interface Extraction (Namespace J)

1 participant