refactor: remove net-stubbing->server->net-stubbing cycle#33394
Merged
cacieprins merged 5 commits intodevelopfrom Feb 20, 2026
Merged
refactor: remove net-stubbing->server->net-stubbing cycle#33394cacieprins merged 5 commits intodevelopfrom
cacieprins merged 5 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
cypress
|
||||||||||||||||||||||||||||||||||||||||
| Project |
cypress
|
| Branch Review |
refactor/net-server-errors-cycle
|
| Run status |
|
| Run duration | 18m 55s |
| Commit |
|
| Committer | Cacie Prins |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
10
|
|
|
1112
|
|
|
0
|
|
|
27185
|
| View all changes introduced in this branch ↗︎ | |
UI Coverage
61.04%
|
|
|---|---|
|
|
28
|
|
|
47
|
Accessibility
99%
|
|
|---|---|
|
|
0 critical
3 serious
1 moderate
0 minor
|
|
|
18
|
chrisbreiding
approved these changes
Feb 20, 2026
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.
Additional details
Small refactor to break the
@packages/server<>@packages/net-stubbingcycle, informed by SOLID principles (dependency inversion,@packages/net-stubbingnow depends directly on@packages/errors, rather than importing@packages/errorsvia@packages/serverre-exporting itCyServer.Socketdefinition is removed, andSocketBroadcasteris added as a type that@packages/socketexports@packages/net-stubbingand@packages/proxyimportSocketBroadcasterfrom@packages/socketinstead ofCyServer.Socketfrom `@packagbes/server@packages/serveris dropped as a dependency of@packages/net-stubbingDependency Inversion - rather than
net-stubbingandproxydepending onserverto define their public interface,serverpurely depends on them.serverdepends onproxyfor the same interface, to ensure that classes it implements conform to the contract.Interface Segregation guides us to limit the scope of that interface to the "send message to driver" functionality: it is the bare minimum that
net-stubbingandproxyneed. It also guided us to import@packages/errorsdirectly, so that it is not depending on the entirety of@packages/serverwhen all it's using is thecloneErrutility method from@packages/errors.Single Responsibility guided us to move the
SocketBroadcasterinterface to a neutral thematically-appropriate package;@packages/serverimplements it inSocketBase, andnet-stubbing/proxyconsume it.Potential extensions:
socket-baseinto a separate functionsocket-baseto a single responsibility: initializing and broadcasting to a tuple of socket.io connectionsCDPSocketServerso that it implementssocket-io.Server, so that the tuple is not two different typessocket-baseto@packages/socket, slim down its public interfacenet-stubbingandproxydepend onsocket-iofor the socket interface, rather than@packages/socket.SocketBaseinSocketCtandSocketE2E.This is composition over inheritence. CT/E2E sockets implement a small interface and use the SocketBroadcaster instead of being a subtype of a large base class (single responsibility).
net-stubbingandproxyreceive theSocketBroadcasterimplementation of the interface/contract (liskov substitution). If CT/E2E sockets implement a small interface (likeTestCoordinatoror similar) and holdSocketBroadcasterinternally, server depends on that interface only. No inheritence from a large base class means no forced dependency on methods not used (interface segregation). Server can also depend on an abstraction (TestCoordinator) instead of the concreteSocketBasehierarchy. High level (server) depends on the interface; low-level (CT/E2E sockets) implement it and use the shared broadcaster (dependency inversion).Note that in the case of this codebase and its constraints, SOLID principles should be a guide rather than a requirement/constraint. Going whole-hog on them can make things more difficult to grok; it's a balance. Using them to address circular dependencies helps to not create bigger issues in the future, while breaking circular dependencies.
Note
Low Risk
Type-only refactor to decouple packages; risk is mainly compile/runtime wiring mismatches around
toDriverevent emission.Overview
Breaks the
@packages/server↔@packages/net-stubbingcircular dependency by replacingCyServer.Socketwith a newSocketBroadcasterinterface exported from@packages/socket.Updates
net-stubbingandproxyto type theirsocketdependency asSocketBroadcaster, makesserver’sSocketBaseimplement that interface, and removes theCyServer.Sockettype frompackages/server/index.d.ts.net-stubbingalso stops importing server re-exported errors by switching its middleware to import@packages/errorsdirectly, and bothnet-stubbingandproxyadd@packages/socketas a dependency (withnet-stubbingdropping@packages/server).Written by Cursor Bugbot for commit e96107f. This will update automatically on new commits. Configure here.
Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation?type definitions?