@@ -272,8 +272,6 @@ describe("DesktopServerExposure", () => {
272272 modeError ,
273273 DesktopServerExposure . DesktopServerExposureModePersistenceError ,
274274 ) ;
275- assert . isTrue ( DesktopServerExposure . isDesktopServerExposureSetModeError ( modeError ) ) ;
276- assert . isTrue ( DesktopServerExposure . isDesktopServerExposureError ( modeError ) ) ;
277275 assert . equal ( modeError . mode , "network-accessible" ) ;
278276 assert . strictEqual ( modeError . cause , settingsFailure ) ;
279277 assert . strictEqual ( modeError . cause . cause , diskFailure ) ;
@@ -290,7 +288,6 @@ describe("DesktopServerExposure", () => {
290288 tailscaleError ,
291289 DesktopServerExposure . DesktopTailscaleServePersistenceError ,
292290 ) ;
293- assert . isTrue ( DesktopServerExposure . isDesktopServerExposureError ( tailscaleError ) ) ;
294291 assert . equal ( tailscaleError . enabled , true ) ;
295292 assert . equal ( tailscaleError . port , 8443 ) ;
296293 assert . strictEqual ( tailscaleError . cause , settingsFailure ) ;
@@ -307,9 +304,9 @@ describe("DesktopServerExposure", () => {
307304 ) ;
308305 } ) ;
309306
310- it . effect ( "resolves advertised endpoints from the scoped runtime state " , ( ) =>
307+ it . effect ( "keeps LAN and Tailscale endpoints distinct when Tailscale is enumerated first " , ( ) =>
311308 withHarness (
312- { ...lanNetworkInterfaces , ...tailnetNetworkInterfaces } ,
309+ { ...tailnetNetworkInterfaces , ...lanNetworkInterfaces } ,
313310 Effect . gen ( function * ( ) {
314311 const serverExposure = yield * DesktopServerExposure . DesktopServerExposure ;
315312 yield * serverExposure . configureFromSettings ( { port : 4173 } ) ;
@@ -324,6 +321,32 @@ describe("DesktopServerExposure", () => {
324321 ) ,
325322 ) ;
326323
324+ it . effect ( "keeps Tailscale-only hosts network-accessible" , ( ) =>
325+ withHarness (
326+ tailnetNetworkInterfaces ,
327+ Effect . gen ( function * ( ) {
328+ const serverExposure = yield * DesktopServerExposure . DesktopServerExposure ;
329+ const settings = yield * DesktopAppSettings . DesktopAppSettings ;
330+ yield * settings . setServerExposureMode ( "network-accessible" ) ;
331+
332+ const state = yield * serverExposure . configureFromSettings ( { port : 4173 } ) ;
333+ assert . equal ( state . mode , "network-accessible" ) ;
334+ assert . equal ( state . advertisedHost , null ) ;
335+ assert . equal ( state . endpointUrl , null ) ;
336+ assert . equal ( ( yield * serverExposure . backendConfig ) . bindHost , "0.0.0.0" ) ;
337+
338+ const endpoints = yield * serverExposure . getAdvertisedEndpoints ;
339+ assert . deepEqual (
340+ endpoints . map ( ( endpoint ) => [ endpoint . reachability , endpoint . httpBaseUrl ] ) ,
341+ [
342+ [ "loopback" , "http://127.0.0.1:4173/" ] ,
343+ [ "private-network" , "http://100.90.1.2:4173/" ] ,
344+ ] ,
345+ ) ;
346+ } ) ,
347+ ) ,
348+ ) ;
349+
327350 it . effect ( "does not spawn the tailscale CLI while server exposure is local-only" , ( ) =>
328351 withHarness (
329352 lanNetworkInterfaces ,
@@ -345,25 +368,25 @@ describe("DesktopServerExposure", () => {
345368 ) ,
346369 ) ;
347370
348- it . effect ( "uses ConfigProvider desktop exposure overrides" , ( ) =>
371+ it . effect ( "preserves explicit Tailscale exposure overrides" , ( ) =>
349372 withHarness (
350373 lanNetworkInterfaces ,
351374 Effect . gen ( function * ( ) {
352375 const serverExposure = yield * DesktopServerExposure . DesktopServerExposure ;
353376 yield * serverExposure . configureFromSettings ( { port : 4173 } ) ;
354377 const change = yield * serverExposure . setMode ( "network-accessible" ) ;
355378
356- assert . equal ( change . state . advertisedHost , "10.0.0.7 " ) ;
357- assert . equal ( change . state . endpointUrl , "http://10.0.0.7 :4173" ) ;
379+ assert . equal ( change . state . advertisedHost , "100.90.1.2 " ) ;
380+ assert . equal ( change . state . endpointUrl , "http://100.90.1.2 :4173" ) ;
358381
359382 const endpoints = yield * serverExposure . getAdvertisedEndpoints ;
360383 assert . deepEqual (
361384 endpoints . map ( ( endpoint ) => endpoint . httpBaseUrl ) ,
362- [ "http://127.0.0.1:4173/" , "http://10.0.0.7 :4173/" , "https://public.example.test/" ] ,
385+ [ "http://127.0.0.1:4173/" , "http://100.90.1.2 :4173/" , "https://public.example.test/" ] ,
363386 ) ;
364387 } ) ,
365388 {
366- T3CODE_DESKTOP_LAN_HOST : "10.0.0.7 " ,
389+ T3CODE_DESKTOP_LAN_HOST : "100.90.1.2 " ,
367390 T3CODE_DESKTOP_HTTPS_ENDPOINTS : "https://public.example.test" ,
368391 } ,
369392 ) ,
0 commit comments