@@ -594,6 +594,7 @@ struct RootTabsSourceGuardTests {
594594 #expect( actionsSource. contains ( " self.gatewayController.refreshActiveGatewayRegistrationFromSettings() " ) )
595595 #expect( actionsSource. contains ( " self.gatewayController.restartDiscovery() " ) )
596596 #expect( actionsSource. contains ( " await self.appModel.refreshGatewayOverviewIfConnected() " ) )
597+ #expect( actionsSource. contains ( " self.gatewayController.requestLocalNetworkAccess(reason: \" settings_preflight \" ) " ) )
597598 #expect( actionsSource. contains ( " await TCPProbe.probe(host: trimmed, port: port " ) )
598599 #expect( actionsSource. contains ( " Check Tailscale or LAN. " ) )
599600 #expect( actionsSource. contains ( " Tailscale is off on this device. Turn it on, then try again. " ) )
@@ -610,6 +611,32 @@ struct RootTabsSourceGuardTests {
610611 #expect( controllerSource. contains ( " trustRotatedGatewayCertificate(from problem: GatewayConnectionProblem) " ) )
611612 }
612613
614+ @Test func `local network access is requested from visible gateway flows`() throws {
615+ let appSource = try String ( contentsOf: Self . openClawAppSourceURL ( ) , encoding: . utf8)
616+ let rootSource = try String ( contentsOf: Self . rootTabsSourceURL ( ) , encoding: . utf8)
617+ let onboardingSource = try String ( contentsOf: Self . onboardingWizardSourceURL ( ) , encoding: . utf8)
618+ let actionsSource = try String ( contentsOf: Self . settingsProTabActionsSourceURL ( ) , encoding: . utf8)
619+ let controllerSource = try String ( contentsOf: Self . gatewayConnectionControllerSourceURL ( ) , encoding: . utf8)
620+
621+ #expect( appSource. contains ( " deferDiscoveryUntilLocalNetworkRequest: true " ) )
622+ #expect( controllerSource. contains ( " func requestLocalNetworkAccess(reason: String) " ) )
623+ #expect( controllerSource. contains ( " guard self.localNetworkAccessRequested else " ) )
624+ #expect( controllerSource. contains ( " self.requestLocalNetworkAccess(reason: \" connect_manual \" ) " ) )
625+ #expect( controllerSource. contains ( " self.requestLocalNetworkAccess(reason: \" connect_discovered_gateway \" ) " ) )
626+ #expect( controllerSource. contains ( " self.requestLocalNetworkAccess(reason: \" connect_last_known \" ) " ) )
627+
628+ #expect( rootSource. contains ( " self.maybeRequestLocalNetworkAccess(reason: \" root_appear \" ) " ) )
629+ #expect( rootSource. contains ( " self.maybeRequestLocalNetworkAccess(reason: \" scene_active \" ) " ) )
630+ #expect( rootSource. contains ( " self.maybeRequestLocalNetworkAccess(reason: \" onboarding_dismissed \" ) " ) )
631+ #expect( rootSource. contains ( " self.requestLocalNetworkAccess(reason: \" gateway_setup_deeplink \" ) " ) )
632+ #expect( rootSource. contains ( " guard self.didEvaluateOnboarding else { return } " ) )
633+ #expect( rootSource. contains ( " onRequestLocalNetworkAccess: { reason in " ) )
634+
635+ #expect( onboardingSource. contains ( " self.requestLocalNetworkAccess(reason: \" onboarding_continue \" ) " ) )
636+ #expect( onboardingSource. contains ( " self.requestLocalNetworkAccessIfPastIntro(reason: \" onboarding_appear \" ) " ) )
637+ #expect( actionsSource. contains ( " self.gatewayController.requestLocalNetworkAccess(reason: \" settings_preflight \" ) " ) )
638+ }
639+
613640 @Test func `gateway settings preview matrix covers primary states`() throws {
614641 let supportSource = try String ( contentsOf: Self . settingsProTabSupportSourceURL ( ) , encoding: . utf8)
615642
@@ -800,6 +827,13 @@ struct RootTabsSourceGuardTests {
800827 . appendingPathComponent ( " Sources/Design/SettingsProTab.swift " )
801828 }
802829
830+ private static func onboardingWizardSourceURL( ) -> URL {
831+ URL ( fileURLWithPath: #filePath)
832+ . deletingLastPathComponent ( )
833+ . deletingLastPathComponent ( )
834+ . appendingPathComponent ( " Sources/Onboarding/OnboardingWizardView.swift " )
835+ }
836+
803837 private static func openClawAppSourceURL( ) -> URL {
804838 URL ( fileURLWithPath: #filePath)
805839 . deletingLastPathComponent ( )
0 commit comments