@@ -50,24 +50,28 @@ function cloudEnvironmentCompatibility(
5050 saved ?: SavedCloudEnvironmentConnection ,
5151) {
5252 const descriptor = status === undefined ? undefined : Option . getOrNull ( status ) ?. descriptor ;
53+ // The runtime owns a saved server's compatibility. It knows which route a
54+ // rejection came from and keeps a newer socket rejection over replayed discovery.
55+ if ( saved !== undefined ) {
56+ const updatable = saved . entry ?. serverUpdateRequired === true ;
57+ const unsupported = updatable || saved . connection . phase === "unsupported" ;
58+ return {
59+ descriptor,
60+ unsupported,
61+ updatable,
62+ blocked : unsupported && ! updatable ,
63+ detail : unsupported ? saved . connection . error : null ,
64+ } ;
65+ }
5366 const error =
5467 descriptor === undefined ? null : orchestrationProtocolCompatibilityError ( descriptor ) ;
55- // Relay discovery cannot clear a rejection from another route to the same environment.
56- const useSavedCompatibility =
57- descriptor === undefined ||
58- ( error === null && ( saved ?. entry ?. alternateRoutes ?. length ?? 0 ) > 0 ) ;
59- const unsupported = useSavedCompatibility
60- ? saved ?. connection . phase === "unsupported"
61- : error !== null ;
62- const updatable = useSavedCompatibility
63- ? saved ?. entry ?. serverUpdateRequired === true
64- : error ?. serverUpdateRequired === true ;
68+ const updatable = error ?. serverUpdateRequired === true ;
6569 return {
6670 descriptor,
67- unsupported,
71+ unsupported : error !== null ,
6872 updatable,
69- blocked : unsupported && ! updatable ,
70- detail : error ?. message ?? ( unsupported ? saved ?. connection . error : null ) ?? null ,
73+ blocked : error !== null && ! updatable ,
74+ detail : error ?. message ?? null ,
7175 } ;
7276}
7377
@@ -98,9 +102,7 @@ export interface SavedCloudEnvironmentConnection {
98102 readonly connection : EnvironmentConnectionPresentation ;
99103 readonly relayManaged : boolean ;
100104 readonly serverConfig ?: Pick < ServerConfig , "environment" > | null ;
101- readonly entry ?: Partial <
102- Pick < ConnectionCatalogEntry , "serverUpdateRequired" | "enabled" | "alternateRoutes" >
103- > ;
105+ readonly entry ?: Partial < Pick < ConnectionCatalogEntry , "serverUpdateRequired" | "enabled" > > ;
104106}
105107
106108function RemoteEnvironmentRowsSkeleton ( ) {
@@ -368,11 +370,7 @@ export function CloudEnvironmentConnectRows({
368370 traceId : null ,
369371 } )
370372 : savedEnvironment
371- ? presentSavedCloudEnvironmentConnection (
372- savedEnvironment . connection . phase === "unsupported"
373- ? { phase : "available" , error : null , traceId : null }
374- : savedEnvironment . connection ,
375- )
373+ ? presentSavedCloudEnvironmentConnection ( savedEnvironment . connection )
376374 : null ;
377375 const relayStatus = status === undefined ? null : Option . getOrNull ( status ) ;
378376 const updateAction =
@@ -439,13 +437,7 @@ export function CloudEnvironmentConnectRows({
439437 if ( checked && ! savedEnvironment ) {
440438 const connected = await connectEnvironment ( environment ) ;
441439 if ( ! connected ) selection . onChange ( environment . environmentId , false ) ;
442- } else if (
443- checked &&
444- ! unsupported &&
445- savedEnvironment ?. connection . phase !== "unsupported" &&
446- ! savedEnvironment ?. entry ?. serverUpdateRequired &&
447- savedEnvironment ?. entry ?. enabled === false
448- ) {
440+ } else if ( checked && ! unsupported && savedEnvironment ?. entry ?. enabled === false ) {
449441 const result = await setEnvironmentEnabled ( {
450442 environmentId : environment . environmentId ,
451443 enabled : true ,
0 commit comments