Files
orca/src/main/ipc/ssh-connection-state-callbacks.ts
T
ff27338299 refactor(ssh): connect fails for hosts orcad can't serve; remove the relay client path (#27214)
* wip: connect fails for hosts the managed server can't serve; remove relay session, deploy and relay UI

* wip: delete relay-only client modules left unreachable, prune their tests and gates

* wip: format

* wip: exhaustive unserved message

* wip: drop relay attestation test for the deleted ownership proof

* fix: prune stale baselines; type the test transport stub

* fix(ssh): census proves leftover relay leases; name the remedy for older terminals; translate every connect-failure surface

* test(ssh): leftover leases defer to the host census

* test(e2e): remove relay-path SSH e2e specs and their CI lanes

* test(e2e): drop the auto-convert case that built its relay era through a live relay

* test(e2e): mark relay-era browser and catalog journeys fixme until they seed a profile

* test(e2e): seed relay-era browser and catalog journeys from a saved profile

The three journeys built their old-version state through a connect without an orcad template, which now refuses the host. They now start from a seeded relay-era profile, so the first connect converts the host as an upgrading user's would.

* chore(ci): drop shard timings for the deleted relay tests

* test(e2e): carry a relay-era login cookie across the browser conversion; own every launch

* test(ci): drop the deleted SSH layout oracle from its route

* test(e2e): open the retained browser after conversion, retrying a pre-connect card

* test(e2e): bind the relay-era browser partition before seeding its cookie

A relay-era build always recorded the partition binding before a page stored
data in it. Seeding the cookie into an unbound partition made the binding store
refuse it (browser_route_partition_binding_store_invalid), so the retained tab
showed the generic routing card and Retry could never clear it.

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: m4air <m4air@Mac.localdomain>
Co-authored-by: Claude <noreply@anthropic.com>
2026-10-10 22:10:33 -07:00

48 lines
1.8 KiB
TypeScript

import type { SshConnectionCallbacks } from '../ssh/ssh-connection'
import type { SshConnectionState } from '../../shared/ssh-types'
import { isSshHostCensusInFlight } from '../ssh/ssh-connection-attribution'
import {
connectInFlight,
credentialRequestedForTarget,
testingTargets
} from './ssh-connect-attempt-registry'
import { getCurrentMainWindow } from './ssh-ipc-context'
import { restoreManagedHostPortForwards } from './ssh-managed-port-forward-restore'
import { requestCredential } from './ssh-passphrase'
import { broadcastSshState } from './ssh-renderer-broadcast'
export function handleSshConnectionStateChange(targetId: string, state: SshConnectionState): void {
if (testingTargets.has(targetId)) {
return
}
if (
state.status === 'connected' &&
(connectInFlight.has(targetId) || isSshHostCensusInFlight(targetId))
) {
// Why: the raw transport reaches 'connected' while the connect is still deciding the host's
// server; forwarding it would let the renderer treat the host as up before anything serves it.
broadcastSshState(getCurrentMainWindow, targetId, {
targetId,
status: 'connecting',
error: state.error,
reconnectAttempt: state.reconnectAttempt
})
return
}
broadcastSshState(getCurrentMainWindow, targetId, state)
// An explicit connect restores through its own publish; this covers a transport that recovered.
if (state.status === 'connected') {
void restoreManagedHostPortForwards(targetId)
}
}
export function createSshConnectionCallbacks(): SshConnectionCallbacks {
return {
onCredentialRequest: (targetId, kind, detail, echo, signal) => {
credentialRequestedForTarget.add(targetId)
return requestCredential(getCurrentMainWindow, targetId, kind, detail, echo, signal)
},
onStateChange: handleSshConnectionStateChange
}
}