feat(devtools-connect): emit tunnel error events on the logger COMPASS-8355#774
Merged
Conversation
…S-8355 Add devtools-connect:tunnel-error and devtools-connect:tunnel-forwarding-error events to ConnectEventMap, wired from the Tunnel object's 'error' and 'forwardingError' events respectively. This allows callers to observe tunnel failures without needing to hold a direct reference to the tunnel object. It is the prerequisite for removing the duplicate SSH tunnel management code in Compass (connect-mongo-client.ts, ssh-tunnel-helpers.ts, data-service.ts) in the next step.
addaleax
approved these changes
Jun 3, 2026
addaleax
reviewed
Jun 3, 2026
Co-authored-by: Anna Henningsen <anna.henningsen@mongodb.com>
|
coverage: 78.927% (+0.2%) from 78.718% — COMPASS-8355-devtools-connect into main |
…OMPASS-8355 Use Object.defineProperty to replace the getter-based createSocks5Tunnel export (sinon.stub cannot replace non-writable getters) with a fake tunnel, then verify that tunnel 'error' and 'forwardingError' events are forwarded as devtools-connect:tunnel-error and devtools-connect:tunnel-forwarding-error on the logger.
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.
Description
Adds two new events to
ConnectEventMapand wires them from theTunnelobject inconnectMongoClient:devtools-connect:tunnel-error— fires when the tunnel emits an'error'event (session-level, e.g. SSH connection lost)devtools-connect:tunnel-forwarding-error— fires when the tunnel emits a'forwardingError'event (individual forwarding failure)This is step 2 of the SSH tunnel cleanup for COMPASS-8355 (step 1 was devtools-shared#772 — transparent SSH reconnect in
devtools-proxy-support).Previously, Compass held a direct reference to the
Tunnelobject in order to listen to these events and react to post-connection SSH failures. With these events now surfaced on the logger, callers no longer need to create or hold the tunnel themselves. Step 3 (a follow-up Compass PR) will remove the duplicate tunnel management code fromconnect-mongo-client.ts,ssh-tunnel-helpers.ts, anddata-service.ts.Open Questions
None.
Checklist