feat(arch): introduce IFileSystem seam for testability (#212) - #218
Conversation
Defines IFileSystem interface, VscodeFileSystem adapter, InMemoryFileSystem test double, and injection points in Writer/ScanEntries/fileExists. #212
Address review feedback: IFileSystem now uses string paths + JFileType/JFileStat (no vscode.Uri leak). Writer delegates openDocument to IDialogues. Push back on WorkspaceEdit seam (separate concern) and full TextDocument removal (Phase 2.1). #212
Define JFileType/JFileStat (no vscode types) and IFileSystem interface. VscodeFileSystem wraps vscode.workspace.fs; InMemoryFileSystem enables headless unit tests. Writer/Reader/ScanEntries/fileExists/LoadNotes/ SyncDailyLinks injected through IFileSystem via Ctrl. DocumentOpener type injected into Writer so openTextDocument is stubbable independently of IDialogues (preserving the #51 invariant). 7 unit tests added. #212
Architecture Review: Final Approval (PR #218)I have performed a comprehensive architectural and implementation review of this PR. This is an exceptionally clean execution of a foundational infrastructure refactor. Key Achievements:
This refactoring successfully transitions our infrastructure from a "pseudo-abstraction" to a robust, testable seam. LGTM. Note: Gemini was involved in creating this comment (but not without consulting me). |
Architecture Review: Withdrawal of Approval (PR #218)I have performed a deep architectural autopsy of this PR, and I am withdrawing my approval. While the surface looks clean, the implementation contains critical "stealth regressions" and structural flaws that violate both the approved specification and our core architectural goals. 🔴 Critical Regressions & Flaws:
Recommendation:Reject. Please align the implementation with the remote-URI requirements of the spec, purge Note: Gemini was involved in creating this comment (but not without consulting me). |
…ntOpener (#212) - DocumentOpener takes string path (not vscode.Uri) — writer-unit.test.ts no longer imports vscode - scan-entries-unit.test.ts imports SCOPE_DEFAULT from model (not vscode barrel) - Ctrl passes vscode.Uri.file(path) at the wiring site (correct for OS paths) - Spec corrected: Uri.file documented as intentional (extensionKind workspace places extension on remote host; OS paths are remote-local) #212
Architecture Review: Final Approval (PR #218)I have performed a final critical review of the updated implementation. This revision successfully addresses all previous concerns and delivers a robust, high-confidence infrastructure seam. Key Achievements:
This refactor is a major milestone in our transition to a clean architecture. LGTM. Note: Gemini was involved in creating this comment (but not without consulting me). |
Summary
JFileType/JFileStatinsrc/model/fs.ts— zerovscode.*importsIFileSysteminterface insrc/model/interfaces.ts— string OS paths, novscode.UriVscodeFileSystemadapter insrc/vscode/vscode-fs.tswrapsvscode.workspace.fsDocumentOpenertype injected intoWriter(separate fromIDialogues, preserves Error opening/creating journal files over remote connection #51 invariant)InMemoryFileSystemtest double insrc/test/in-memory-fs.ts— zerovscodeimportsfileExistssignature changed to(fs: IFileSystem, path: string)— no vscode couplingWriter,Reader,ScanEntries,LoadNotes,SyncDailyLinksinjected throughctrl.fswriter-unit.test.ts(3) +scan-entries-unit.test.ts(4) usingInMemoryFileSystemTest plan
npm test→ 159 passing, 0 failingnpm run compile-tests→ cleangrep vscode.workspace.fs src/journal/writer.ts src/util/fs-exists.ts src/features/entries/scan-entries.ts→ emptygrep vscode src/model/fs.ts src/test/in-memory-fs.ts→ emptyCloses #212
🤖 Generated with Claude Code