@@ -12,18 +12,15 @@ import { ChildProcessSpawner } from "effect/process";
1212
1313import * as ServerSecretStore from "../auth/ServerSecretStore.ts" ;
1414import { CLOUD_ENDPOINT_RUNTIME_CONFIG } from "./config.ts" ;
15- import {
16- ConnectReachability ,
17- classifyReachability ,
18- layer as connectReachabilityLayer ,
19- type ReachabilityFacts ,
20- } from "./ConnectReachability.ts" ;
15+ import * as ConnectReachability from "./ConnectReachability.ts" ;
2116import * as ManagedEndpointRuntime from "./ManagedEndpointRuntime.ts" ;
2217
2318const checkedAt = "2026-10-19T00:00:00.000Z" ;
2419const connected = { readyConnections : 4 , hostname : "env.example.test" , protocol : "quic" } ;
2520const notConnected = { readyConnections : 0 , hostname : null , protocol : null } ;
26- const facts = ( overrides : Partial < ReachabilityFacts > ) : ReachabilityFacts => ( {
21+ const facts = (
22+ overrides : Partial < ConnectReachability . ReachabilityFacts > ,
23+ ) : ConnectReachability . ReachabilityFacts => ( {
2724 managedTunnelConfigured : true ,
2825 connector : connected ,
2926 endpoint : null ,
@@ -38,21 +35,21 @@ describe("classifyReachability", () => {
3835 [ { kind : "status" , status : 530 } , "no_connector" ] ,
3936 [ { kind : "network_error" } , "timeout" ] ,
4037 ] as const ) ( "maps endpoint result %o to %s" , ( endpoint , cause ) => {
41- expect ( classifyReachability ( facts ( { endpoint , edgeReachable : true } ) , checkedAt ) ) . toMatchObject (
42- { status : "unreachable" , cause } ,
43- ) ;
38+ expect (
39+ ConnectReachability . classifyReachability ( facts ( { endpoint , edgeReachable : true } ) , checkedAt ) ,
40+ ) . toMatchObject ( { status : "unreachable" , cause } ) ;
4441 } ) ;
4542
4643 it ( "keeps the endpoint cause when the TCP edge test cannot explain it" , ( ) => {
4744 // QUIC (UDP) can connect while TCP 7844 is blocked.
4845 expect (
49- classifyReachability (
46+ ConnectReachability . classifyReachability (
5047 facts ( { endpoint : { kind : "status" , status : 502 } , edgeReachable : false } ) ,
5148 checkedAt ,
5249 ) ,
5350 ) . toMatchObject ( { cause : "origin_unreachable" } ) ;
5451 expect (
55- classifyReachability (
52+ ConnectReachability . classifyReachability (
5653 facts ( {
5754 connector : { readyConnections : null , hostname : "env.example.test" , protocol : null } ,
5855 endpoint : { kind : "status" , status : 502 } ,
@@ -63,7 +60,7 @@ describe("classifyReachability", () => {
6360 ) . toMatchObject ( { cause : "origin_unreachable" } ) ;
6461 // Failed DNS also fails the edge lookups.
6562 expect (
66- classifyReachability (
63+ ConnectReachability . classifyReachability (
6764 facts ( {
6865 connector : { readyConnections : null , hostname : "env.example.test" , protocol : null } ,
6966 endpoint : { kind : "dns_failed" } ,
@@ -75,7 +72,7 @@ describe("classifyReachability", () => {
7572 } ) ;
7673
7774 it ( "gives the MCP URL on the host the running tunnel answered on" , ( ) => {
78- const result = classifyReachability (
75+ const result = ConnectReachability . classifyReachability (
7976 facts ( { endpoint : { kind : "status" , status : 200 } } ) ,
8077 checkedAt ,
8178 ) ;
@@ -87,7 +84,10 @@ describe("classifyReachability", () => {
8784
8885 it ( "waits on a connector that has not connected while the edge answers" , ( ) => {
8986 expect (
90- classifyReachability ( facts ( { connector : notConnected , edgeReachable : true } ) , checkedAt ) ,
87+ ConnectReachability . classifyReachability (
88+ facts ( { connector : notConnected , edgeReachable : true } ) ,
89+ checkedAt ,
90+ ) ,
9191 ) . toMatchObject ( { cause : "connector_not_ready" } ) ;
9292 } ) ;
9393} ) ;
@@ -132,7 +132,7 @@ describe("ConnectReachability", () => {
132132 ) ;
133133
134134 return Effect . gen ( function * ( ) {
135- const reachability = yield * ConnectReachability ;
135+ const reachability = yield * ConnectReachability . ConnectReachability ;
136136 yield * reachability . check ;
137137 expect ( Option . getOrNull ( yield * reachability . latest ) ) . toMatchObject ( {
138138 hostname : "env.example.test" ,
@@ -141,7 +141,7 @@ describe("ConnectReachability", () => {
141141 // A relink stores a new tunnel before its connector reports in.
142142 secrets . set ( CLOUD_ENDPOINT_RUNTIME_CONFIG , new TextEncoder ( ) . encode ( "second" ) ) ;
143143 expect ( yield * reachability . latest ) . toEqual ( Option . none ( ) ) ;
144- } ) . pipe ( Effect . provide ( connectReachabilityLayer . pipe ( Layer . provide ( dependencies ) ) ) ) ;
144+ } ) . pipe ( Effect . provide ( ConnectReachability . layer . pipe ( Layer . provide ( dependencies ) ) ) ) ;
145145 } ) ;
146146} ) ;
147147
0 commit comments