Skip to content

fix: classify active default-network transport - #1037

Merged
torlando-tech merged 6 commits into
mainfrom
port/pr-903-active-network-classification
Jul 28, 2026
Merged

fix: classify active default-network transport#1037
torlando-tech merged 6 commits into
mainfrom
port/pr-903-active-network-classification

Conversation

@torlando-tech

Copy link
Copy Markdown
Owner

Summary

  • classify transport from Android's active default-network callback rather than broad matching-network callbacks plus a separate activeNetwork snapshot
  • reapply interface restrictions coherently across Wi-Fi/cellular handoffs while ignoring stale onLost callbacks
  • reserve NONE for the absence of a default route and represent VPN-only, unsupported, or temporarily unpublished capabilities as UNKNOWN
  • keep unrestricted IP interfaces available on UNKNOWN while conservatively filtering Wi-Fi-only and cellular-only interfaces
  • align the production InterfaceTransportObserver, host manager, and interface-management UI with the same transport truth table
  • seed observer state before callback registration so a stale startup snapshot cannot overwrite a newer default-network callback
  • document the Android-only network-restriction behavior in port-deviations.md

This is a current-main replacement for stale draft PR #903. The old draft is intentionally left open pending explicit closure authorization.

Verification

Exact rebased head: 253b11d322520efe17143c172dd4c9e70b13c7b5

  • NetworkChangeManagerTest and InterfaceTransportFilterTest
    • Kotlin backend: passed
    • Python backend: passed
  • InterfaceTransportObserverTest and InterfaceManagementUtilsTest
    • no-Sentry Kotlin backend: passed
    • no-Sentry Python backend: passed
  • :rns-host:ktlintCheck :rns-host:detekt: passed
  • :app:ktlintCheck :app:detekt: passed
  • :app:assembleNoSentryPythonBackendDebug: passed
  • git diff --check origin/main...HEAD: passed
  • ARM64 Python debug APK:
    • APK Signature Scheme v2 verified
    • installed successfully on the test phone
    • interface configuration completed successfully
    • Wi-Fi/cellular physical handoff matrix remains pending until a Wi-Fi network is available

Behavior

  • Wi-Fi and Ethernet map to WIFI_LIKE.
  • Cellular maps to CELLULAR.
  • A live but opaque route maps to UNKNOWN; ANY remains active while transport-specific interfaces pause.
  • No live default route maps to NONE; IP interfaces pause.
  • BLE and non-TCP RNode interfaces bypass the IP-carrier restriction.

@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes Android interface restrictions follow the active default network consistently.

  • Replaces broad internet-network callbacks with default-network callbacks in both app and host processes.
  • Tracks default-network identity to ignore stale loss and non-default capability events.
  • Introduces UNKNOWN for live but unclassified routes and keeps unrestricted IP interfaces available in that state.
  • Aligns runtime filtering, interface-management UI, documentation, and tests with the revised transport model.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

Default-network identity tracking, UNKNOWN classification, host filtering, and UI presentation are aligned, and the transition and stale-callback cases are covered by focused tests.

Important Files Changed

Filename Overview
app/src/main/java/network/columba/app/service/manager/InterfaceTransportObserver.kt Tracks the active default-network callback identity, seeds state before registration, and coherently reloads filtered interfaces on meaningful transport transitions.
rns-host/src/main/kotlin/network/columba/app/rns/host/manager/NetworkChangeManager.kt Switches host monitoring to the active default network and ignores capability or loss events belonging to stale networks.
rns-host/src/main/kotlin/network/columba/app/rns/host/manager/InterfaceTransportFilter.kt Adds UNKNOWN classification for live opaque routes while preserving unrestricted and non-IP interfaces according to the documented truth table.
app/src/main/java/network/columba/app/ui/screens/InterfaceManagementUtils.kt Presents transport-restricted interfaces as blocked, rather than disconnected, when the active route is unclassified.
app/src/test/java/network/columba/app/service/manager/InterfaceTransportObserverTest.kt Adds coverage for startup ordering, handoffs, stale losses, UNKNOWN routes, deduplication, filtering, and observer restart behavior.
rns-host/src/test/kotlin/network/columba/app/rns/host/manager/NetworkChangeManagerTest.kt Updates host-manager tests for default-network callbacks, stale-event rejection, transport classification, and lifecycle behavior.

Sequence Diagram

sequenceDiagram
    participant Android as Android ConnectivityManager
    participant Observer as InterfaceTransportObserver
    participant Host as NetworkChangeManager
    participant Filter as InterfaceTransportFilter
    participant Backend as Reticulum backend
    Android->>Observer: onAvailable(default network)
    Android->>Host: onAvailable(default network)
    Android->>Observer: onCapabilitiesChanged(default, capabilities)
    Android->>Host: onCapabilitiesChanged(default, capabilities)
    Observer->>Filter: classify and filter enabled interfaces
    Observer->>Backend: reloadInterfaces(filtered configs)
    Host->>Filter: publish classified transport
    Note over Observer,Host: Non-default capability events and stale onLost events are ignored
    Android->>Observer: onLost(current default)
    Android->>Host: onLost(current default)
    Observer->>Filter: classify as NONE
    Observer->>Backend: reload without IP-carrier interfaces
Loading

Reviews (1): Last reviewed commit: "fix: prevent stale observer startup seed" | Re-trigger Greptile

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@torlando-tech
torlando-tech merged commit f3d2c3e into main Jul 28, 2026
21 of 22 checks passed
@torlando-tech
torlando-tech deleted the port/pr-903-active-network-classification branch July 28, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant