Skip to content

feat(devtools-connect): emit tunnel error events on the logger COMPASS-8355#774

Merged
ivandevp merged 6 commits into
mainfrom
COMPASS-8355-devtools-connect
Jun 3, 2026
Merged

feat(devtools-connect): emit tunnel error events on the logger COMPASS-8355#774
ivandevp merged 6 commits into
mainfrom
COMPASS-8355-devtools-connect

Conversation

@ivandevp
Copy link
Copy Markdown
Collaborator

@ivandevp ivandevp commented Jun 3, 2026

Description

Adds two new events to ConnectEventMap and wires them from the Tunnel object in connectMongoClient:

  • 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 Tunnel object 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 from connect-mongo-client.ts, ssh-tunnel-helpers.ts, and data-service.ts.

Open Questions

None.

Checklist

…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.
@ivandevp ivandevp requested a review from addaleax June 3, 2026 15:23
@ivandevp ivandevp self-assigned this Jun 3, 2026
Comment thread packages/devtools-connect/src/connect.ts Outdated
@coveralls
Copy link
Copy Markdown

coveralls commented Jun 3, 2026

Coverage Status

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.
@ivandevp ivandevp merged commit 344419e into main Jun 3, 2026
36 checks passed
@ivandevp ivandevp deleted the COMPASS-8355-devtools-connect branch June 3, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants