@@ -83,6 +83,42 @@ class GatewayBootstrapAuthTest {
8383 assertNull(runtime.gatewayConnectionDisplay.value.problem)
8484 }
8585
86+ @Test
87+ fun retryableNodePairingProblemSurvivesReconnectStatus () {
88+ val runtime = NodeRuntime (RuntimeEnvironment .getApplication())
89+ val session = readField<GatewaySession >(runtime, " nodeSession" )
90+ val onDisconnected = readField< (String ) -> Unit > (session, " onDisconnected" )
91+ val onConnectFailure = readField< (GatewaySession .ErrorShape , Boolean ) -> Unit > (session, " onConnectFailure" )
92+
93+ onDisconnected(" Gateway error: pairing required" )
94+ onConnectFailure(
95+ GatewaySession .ErrorShape (
96+ code = " NOT_PAIRED" ,
97+ message = " pairing required" ,
98+ details =
99+ GatewayConnectErrorDetails (
100+ code = " PAIRING_REQUIRED" ,
101+ canRetryWithDeviceToken = false ,
102+ recommendedNextStep = " wait_then_retry" ,
103+ reason = " not-paired" ,
104+ requestId = " request-1" ,
105+ retryable = true ,
106+ ),
107+ ),
108+ false ,
109+ )
110+
111+ onDisconnected(" Reconnecting…" )
112+
113+ val reconnectDisplay = runtime.gatewayConnectionDisplay.value
114+ assertEquals(" Reconnecting…" , reconnectDisplay.statusText)
115+ assertEquals(" PAIRING_REQUIRED" , reconnectDisplay.problem?.code)
116+ assertEquals(" request-1" , reconnectDisplay.problem?.requestId)
117+
118+ onDisconnected(" Gateway error: timeout" )
119+ assertNull(runtime.gatewayConnectionDisplay.value.problem)
120+ }
121+
86122 @Test
87123 fun doesNotConnectOperatorSessionWhenOnlyBootstrapAuthExists () {
88124 assertFalse(
0 commit comments