chore: Phase 2c - Insomnia facade, consumed via React Router context - #10340
Draft
gatzjames wants to merge 1 commit into
Draft
chore: Phase 2c - Insomnia facade, consumed via React Router context#10340gatzjames wants to merge 1 commit into
gatzjames wants to merge 1 commit into
Conversation
Replaces the ad-hoc per-use-case bootstrap exports (one bound function per use-case) with a single Insomnia facade, namespaced by aggregate (insomnia.workspace.renameById(...)), constructed once and threaded through apps via dependency injection rather than imported piecemeal. - application/src/insomnia.ts - the Insomnia class + InsomniaDependencies interface. Framework-agnostic: takes repository ports (from domain), never a concrete infrastructure class, so application stays usable by any app. - application/src/workspace/workspace.module.ts - WorkspaceModule wraps the existing renameWorkspace use-case as a method. One module per aggregate; renameWorkspace itself is unchanged and still independently exported/unit-tested. - apps/desktop/src/common/application-bootstrap.ts - constructs the one Insomnia instance (wiring nedbWorkspaceRepository in), and defines the InsomniaContext React Router context token. The token lives here, not in application: react-router is a desktop-specific framework dependency, and application must stay usable by apps/cli and any future app that isn't built on react-router at all. - apps/desktop/src/entry.client.tsx - wires the Insomnia instance into <HydratedRouter> via getContext, using RouterContextProvider. This works today under clientLoader/clientAction (SPA mode) because react-router.config.ts already has future.v8_middleware: true enabled - confirmed by reading react-router's own type definitions before building on it, since context/middleware is a relatively new, easy-to-get-wrong API. No SSR or Phase 6 dependency. - workspace.update.tsx - reads the facade via context.get(InsomniaContext).workspace.renameById(...) instead of importing a bound function. apps/cli has no router at all, so none of the context plumbing applies there - it would construct `new Insomnia(...)` once in its own bootstrap and call methods on it directly from command handlers, same as any other plain object. Verified: lint, type-check, check-boundaries, and the full test suite all pass clean (application now has 2 test files / 3 tests, including a dedicated test for the facade's delegation). Re-ran the actual desktop app via the project's Playwright/Electron smoke-test harness - dashboard-interactions.test.ts's rename test passed again, confirming the context wiring works end-to-end in the real running app, not just against fakes.
✅ Circular References ReportGenerated at: 2026-08-06T11:17:25.703Z Summary
Click to view all circular references in PR (13)Click to view all circular references in base branch (13)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
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.
No description provided.