refactor(cli): define server connection boundary#37133
Merged
Merged
Conversation
Contributor
Author
|
Ran a native compiled lifecycle smoke on macOS using an isolated XDG home:
The full Linux/Windows unit, E2E, typecheck, standards, and compliance matrix is also green. |
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.
What
Keep managed background-service lifecycle operations Effect-native until the actual CLI-to-TUI seam.
ServertoServerConnection.reconnectandrestartcapabilities underserver.service.NodeFileSystem.layer.server.reloadand/reloadbecomeservice.restartand/restart, with no compatibility alias.Before / After
Before
Server.resolve()mixed connection policy with runtime interpretation. Its delayed reconnect and reload callbacks calledEffect.runPromise()themselves and installed a freshNodeFileSystem.layer, even though the outer CLI runtime already providedFileSystem.The resolved shape also exposed two independent optional callbacks and called stop-plus-start “reload”:
After
ServerConnection.resolve()returns endpoint policy plus one optional managed-service capability whose methods return Effects:The CLI default handler is the single adapter. It uses
Effect.runPromiseWithover the existing outerFileSystemcontext and passes grouped Promise callbacks into the TUI.How
packages/cli/src/services/server-connection.tschooses explicit, standalone, or managed connectivity and returns Effect-native managed lifecycle capabilities.packages/cli/src/commands/handlers/default.tsconverts lifecycle Effects to Promises once. Mini, run, and API handlers continue to consume only the endpoint.packages/tui/src/app.tsxandpackages/tui/src/context/client.tsxpreserve the Promise seam and use canonical restart vocabulary./restart;docs/design/service-lifecycle.mdrecords package ownership and the Effect seam with Merman-rendered terminal diagrams.packages/cli/test/server-connection.test.tsuses a real local health endpoint to verify managed resolution, grouped capabilities, and Effect-native reconnect/restart methods.Scope
Service.stop(options)followed byService.start(options).Service.restart()to the client lifecycle module.--serveror--standaloneconnections./reloadandserver.reloadare intentionally removed without aliases. Current V2 users must use/restartandservice.restart.ServerConnectionremains a stateless module; this PR does not add an Effect Context service or Layer.Testing
bun run testinpackages/cli: 32 passed.bun run testinpackages/tui: 249 passed, 1 skipped.bun typecheckinpackages/cli: passed.bun typecheckinpackages/tui: passed.bun run typecheckat workspace root: all 32 tasks passed.git diff --check: passed.The repository-wide Effect-pattern scan still reports seven unrelated pre-existing findings in
packages/coreandpackages/cli/src/mini/runtime.stdin.ts.Flow