feat: scaffold API, commands and tests#2
Merged
jjhafer merged 1 commit intosilvermine:masterfrom Apr 10, 2026
Merged
Conversation
jjhafer
requested changes
Apr 7, 2026
Contributor
Author
|
Thanks @jjhafer. All remaining comments have been resolved. |
jjhafer
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scaffolds the API contract for cross-platform network connectivity detection: Tauri commands, TypeScript bindings, types, permissions, and stub Rust implementation.
API design informed by platform-native connectivity APIs — Windows
NetworkInformation, iOSNWPathMonitor, and AndroidConnectivityManager— unified into a singleConnectionStatusmodel.Architecture
ConnectionStatuscombines reachability, cost/constraint flags, and physical transport type into a single query result:connected: bool— whether the device has an active internet connectionmetered: bool— whether data usage is billed or limited (maps toNetworkCostTypeon Windows,NWPath.isExpensiveon iOS,NET_CAPABILITY_NOT_METEREDon Android)constrained: bool— whether the connection is data-constrained or restricted (maps toApproachingDataLimit/OverDataLimit/Roamingon Windows,NWPath.isConstrainedon iOS, Data Saver on Android)connectionType: ConnectionType— the preferred physical transport (wifi,ethernet,cellular,unknown)ConnectivityExttrait provides Rust-side access viaapp.connectivity().connection_status()from any Tauri manager type. Uses managed state via.setup()— required for the mobile plugin bridge (PluginApi) when iOS/Android implementations are added.Platform stub (
src/platform.rs) returnsError::Unsupporteduntil platform-specific implementations are added behind#[cfg]gates.Design decisions
connectedas a status field, not an error — iOS and Android surface "disconnected" as a normal path status, not an exception. Treating it as a field keeps the consumer code path uniform.connectionType— when multiple interfaces are active (e.g. WiFi + Cellular), this represents the OS-determined preferred transport. Sufficient for network policy decisions without over-complicating the API.Error::Unsupportedonly — platform-specific error variants (PluginInvoke,Windows(...)) will be added via#[cfg]+#[from]when implementations land. Matches the Tauri plugin ecosystem pattern.Test plan
npm run standardspasses (eslint, tsc, markdownlint, clippy, rustfmt, commitlint, check-node-version)npm testpasses (7 TypeScript + 7 Rust tests)ConnectionTypevariants andConnectionStatusConnectionStatus::disconnected()convenience constructor tested