Unify the backend connect signature on one host-injected shape - #38
Open
aron-cf wants to merge 1 commit into
Open
Unify the backend connect signature on one host-injected shape#38aron-cf wants to merge 1 commit into
aron-cf wants to merge 1 commit into
Conversation
commit: |
The shell and module backend interfaces took different connect signatures: the shell kind a bare connect(), the module kind a connect(host) receiving the storage-layer handles the Workspace owns. The split was historical, not necessary; the host bag exists only because the Workspace builds db and fs after the caller constructs the backends. Give WorkspaceBackend.connect the same host parameter and pass the bag on every connect. Shell and container backends ignore it and reach the host through their own transport; the module backend uses it as before. Method-parameter bivariance lets the existing zero-argument implementations satisfy the wider signature unchanged. Collapse the duplicate WorkspaceModuleBackendHost onto the canonical WorkspaceBackendHost so there is one definition.
aron-cf
force-pushed
the
stack/4-unify-connect-host
branch
from
August 1, 2026 17:32
741f0c9 to
0653c4e
Compare
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.
The two backend interfaces took different
connectsignatures. The shell and container kind took a bareconnect()and reached the host through a transport it captured when it was built. The JavaScript kind took aconnect(host)that received the storage-layer handles the Workspace owns. The split was historical rather than necessary: the host bag exists only because the Workspace builds its database and filesystem handles after the caller has already constructed the backends and passed them in, so a backend cannot capture them at its own construction time.This change gives every backend the same
connect(host)signature and has the Workspace pass its host bag on every connect. Shell and container backends accept the bag and ignore it, reaching the host through their own transport as before; the JavaScript backend uses it as before. Because method parameters are compatible when an implementation ignores arguments the interface declares, the existing zero-argument implementations satisfy the wider signature without edits. The duplicate host type collapses onto one canonical definition.This is internal plumbing.
connectis called only by the Workspace itself, never by an example or other consumer, so there is no public-API impact. No behavior changes.Verify with
npm test --workspace @cloudflare/computerandnpm run typecheck.