Skip to content

Conversation

@kirkmorrow
Copy link
Contributor

@kirkmorrow kirkmorrow commented Dec 2, 2025

Part 2 of 2 fixes to address issue #1042
PR for part 1 is #1090

Pull Request

Issue

Closes: #1042

This is part 2 of 2 required for this fix. The Dart package update will need to be committed first. Then this PR will need to update pubspec.yaml to use that new package before this can be merged.

Approach

Use new ethernet enum to return a connection type consistent with connectivity_plus.

Tasks

  • [ No] Add tests
    • Not much to test here
  • [No ] Add changes to documentation (guides, repository pages, code comments)
    • No existing documentation to update, changes are consistent with existing code

Summary by CodeRabbit

  • New Features
    • Ethernet connectivity detection is now supported in the Flutter SDK, enabling detection of devices connected via ethernet alongside existing Wi-Fi and mobile network detection.

✏️ Tip: You can customize this high-level summary in your review settings.

Part 2 of 2 fixes to address issue parse-community#1042
Copilot AI review requested due to automatic review settings December 2, 2025 15:46
@parse-github-assistant
Copy link

parse-github-assistant bot commented Dec 2, 2025

🚀 Thanks for opening this pull request!

@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 2025

📝 Walkthrough

Walkthrough

Adds ethernet connectivity support to the Flutter SDK's connectivity handling. The checkConnectivity() method and connectivityStream getter now map ConnectivityResult.ethernet to sdk.ParseConnectivityResult.ethernet alongside existing wifi and mobile support, with precedence preserved and fallback to none when neither wifi, mobile, nor ethernet are present.

Changes

Cohort / File(s) Summary
Ethernet Connectivity Support
packages/flutter/lib/parse_server_sdk_flutter.dart
Updated checkConnectivity() to return sdk.ParseConnectivityResult.ethernet when ConnectivityResult.ethernet is detected; updated connectivityStream to map ethernet connectivity events to sdk.ParseConnectivityResult.ethernet.
Connectivity Mapping Tests
packages/flutter/test/parse_connectivity_mapping_test.dart
New test file validating connectivity mapping logic with priority order (wifi > ethernet > mobile > none), single and multiple connection scenarios, unsupported type handling, and edge cases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • The changes follow an established pattern already present in the codebase for wifi and mobile handling.
  • The test file comprehensively covers priority ordering and edge cases but is straightforward in structure.
  • Minimal logic density; primarily additive changes without refactoring or complex interactions.

Possibly related PRs

Suggested reviewers

  • mtrezza

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: enabling ethernet connectivity recognition to fix LiveQuery issues, which aligns with the PR's primary objective.
Description check ✅ Passed The description includes the required sections with relevant details: it links to issue #1042, explains the approach, notes dependencies, and marks tasks as not applicable with explanations.
Linked Issues check ✅ Passed The code changes implement the core requirement from issue #1042: adding ethernet enum handling in checkConnectivity() and connectivityStream to treat ethernet as an online connectivity state, matching the workaround approach.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the linked issue #1042: ethernet handling in parse_server_sdk_flutter.dart and corresponding test coverage in the new test file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 80c45a4 and 79359ed.

📒 Files selected for processing (1)
  • packages/flutter/test/parse_connectivity_mapping_test.dart (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/flutter/test/parse_connectivity_mapping_test.dart

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the ethernet connectivity type to align with the connectivity_plus package, completing the fix for LiveQuery connectivity issues (issue #1042). This is part 2 of a two-part change that requires the Dart package update (PR #1090) to be merged first.

Key Changes:

  • Added ethernet connectivity checks to both checkConnectivity() and connectivityStream methods
  • Ethernet is prioritized between wifi and mobile in the connectivity type hierarchy

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 2, 2025
@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Dec 2, 2025
@parse-github-assistant
Copy link

The label type:bug cannot be used here.

@parse-github-assistant parse-github-assistant bot removed the type:bug Impaired feature or lacking behavior that is likely assumed label Dec 2, 2025
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.84%. Comparing base (f76fde4) to head (79359ed).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1091      +/-   ##
==========================================
+ Coverage   43.54%   46.84%   +3.30%     
==========================================
  Files          61       53       -8     
  Lines        3587     3266     -321     
==========================================
- Hits         1562     1530      -32     
+ Misses       2025     1736     -289     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mtrezza mtrezza changed the title Use new ethernet enum fix: LiveQuery not working due to ethernet not recognized as connectivity state Dec 2, 2025
@mtrezza
Copy link
Member

mtrezza commented Dec 2, 2025

@kirkmorrow Does the PR title make sense?

@kirkmorrow
Copy link
Contributor Author

@mtrezza This is part 2 of the fix. Feel free to update the title, I just stole the title text from the original bug this addresses.

@kirkmorrow kirkmorrow requested a review from Copilot December 2, 2025 18:47
Copilot finished reviewing on behalf of kirkmorrow December 2, 2025 18:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

coderabbitai[bot]
coderabbitai bot previously approved these changes Dec 2, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kirkmorrow
Copy link
Contributor Author

kirkmorrow commented Dec 2, 2025

Okay... apparently the code checkers break if I try to change pubspec.yaml to pick up the required version of parse_server_sdk. @mtrezza should I just revert that change and let you handle it?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/flutter/test/parse_connectivity_mapping_test.dart (1)

118-129: Redundant assertions (same issue as lines 34-47).

This test iterates through online states to verify they're not equal to none. As with the earlier test, this checks Dart's built-in enum equality semantics and adds no meaningful coverage.

🧹 Nitpick comments (2)
packages/flutter/test/parse_connectivity_mapping_test.dart (2)

25-32: Consider removing or replacing this brittle test.

Testing specific enum index values couples the test to implementation details. If the enum is reordered (e.g., alphabetically), this test breaks even though the priority logic in the if-else chain would still work correctly. The priority is determined by the order of conditions in the mapping logic, not by enum indices.


34-47: Redundant assertions add no value.

These assertions test that different enum values are not equal and that the same enum value equals itself. Since Dart enum values are by definition distinct, these checks are redundant and don't add meaningful test coverage.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83ffd5a and 80c45a4.

📒 Files selected for processing (1)
  • packages/flutter/test/parse_connectivity_mapping_test.dart (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Agent
  • GitHub Check: Test Flutter 3.38, macOS
  • GitHub Check: Test Dart beta
  • GitHub Check: Test Flutter 3.38, Ubuntu
  • GitHub Check: Test Dart 3.10, Ubuntu
  • GitHub Check: Test Flutter 3.38, Windows
🔇 Additional comments (5)
packages/flutter/test/parse_connectivity_mapping_test.dart (5)

8-23: LGTM!

The enum structure test appropriately verifies that ParseConnectivityResult includes all four expected values, particularly ethernet, which is critical for resolving issue #1042.


107-116: Good documentation of the fix requirement.

This test clearly documents that ethernet must be treated as an online state, which is the core requirement for resolving issue #1042. While the assertion itself is trivial (testing enum inequality), the explicit test and reason string effectively document this critical behavior for future maintainers.

Note: Integration tests verifying that LiveQuery actually connects with ethernet would provide more comprehensive coverage beyond enum semantics.


132-146: Useful canary test for library updates.

This test explicitly lists all 7 ConnectivityResult values from connectivity_plus and verifies the count. This serves as a valuable canary: if connectivity_plus adds new enum values in a future update, this test will fail and alert developers to update the mapping logic accordingly.


149-159: LGTM!

This test documents and verifies that the Parse SDK explicitly supports the three main internet connection types (wifi, ethernet, mobile), which aligns with the PR's objective of adding ethernet support.


6-6: Consider removing TestWidgetsFlutterBinding initialization if these are pure unit tests.

TestWidgetsFlutterBinding.ensureInitialized() is required for widget tests that interact with the Flutter framework. If this test file only tests mapping logic without framework interactions, this initialization may be unnecessary and can be removed to reduce test overhead.

Comment on lines 49 to 105
test('mapping logic follows priority: wifi > ethernet > mobile > none',
() {
// This documents the if-else chain priority in checkConnectivity()
// If a list contains wifi, it returns wifi
// Else if it contains ethernet, it returns ethernet
// Else if it contains mobile, it returns mobile
// Else it returns none

// Simulating the mapping logic
ParseConnectivityResult mapResult(List<ConnectivityResult> list) {
if (list.contains(ConnectivityResult.wifi)) {
return ParseConnectivityResult.wifi;
} else if (list.contains(ConnectivityResult.ethernet)) {
return ParseConnectivityResult.ethernet;
} else if (list.contains(ConnectivityResult.mobile)) {
return ParseConnectivityResult.mobile;
} else {
return ParseConnectivityResult.none;
}
}

// Test single connection types
expect(mapResult([ConnectivityResult.wifi]),
ParseConnectivityResult.wifi);
expect(mapResult([ConnectivityResult.ethernet]),
ParseConnectivityResult.ethernet);
expect(mapResult([ConnectivityResult.mobile]),
ParseConnectivityResult.mobile);
expect(mapResult([ConnectivityResult.none]),
ParseConnectivityResult.none);

// Test priority when multiple connections exist
expect(mapResult([ConnectivityResult.wifi, ConnectivityResult.ethernet]),
ParseConnectivityResult.wifi);
expect(mapResult([ConnectivityResult.wifi, ConnectivityResult.mobile]),
ParseConnectivityResult.wifi);
expect(
mapResult([ConnectivityResult.ethernet, ConnectivityResult.mobile]),
ParseConnectivityResult.ethernet);

// Test that ethernet takes priority over mobile (important for issue #1042)
expect(
mapResult([ConnectivityResult.mobile, ConnectivityResult.ethernet]),
ParseConnectivityResult.ethernet);

// Test fallback behavior for unsupported types
expect(mapResult([ConnectivityResult.bluetooth]),
ParseConnectivityResult.none);
expect(mapResult([ConnectivityResult.vpn]), ParseConnectivityResult.none);
expect(
mapResult([ConnectivityResult.other]), ParseConnectivityResult.none);

// Test mixed with unsupported types
expect(
mapResult([ConnectivityResult.ethernet, ConnectivityResult.vpn]),
ParseConnectivityResult.ethernet);
});
Copy link

@coderabbitai coderabbitai bot Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Find the actual connectivity implementation in the Parse SDK
find . -name "*.dart" -type f | head -20

Repository: parse-community/Parse-SDK-Flutter

Length of output: 210


🏁 Script executed:

# Search for ConnectivityResult usage and actual mapping implementation
rg -n "checkConnectivity|mapResult" --type=dart -B 3 -A 3

Repository: parse-community/Parse-SDK-Flutter

Length of output: 210


🏁 Script executed:

# Look for the actual implementation file being tested
rg -n "ConnectivityResult\.(wifi|ethernet|mobile|none)" --type=dart -B 5 -A 5 | head -100

Repository: parse-community/Parse-SDK-Flutter

Length of output: 210


🏁 Script executed:

# Find the parse_connectivity file structure
fd "parse_connectivity" --type f

Repository: parse-community/Parse-SDK-Flutter

Length of output: 210


🏁 Script executed:

# Check the actual implementation that should be tested
cat -n packages/flutter/lib/src/parse_connectivity.dart 2>/dev/null | head -80

Repository: parse-community/Parse-SDK-Flutter

Length of output: 210


🌐 Web query:

Parse Flutter SDK ConnectivityResult checkConnectivity implementation

💡 Result:

Short summary of how checkConnectivity() / ConnectivityResult works (connectivity_plus):

  • Signature & return: Connectivity().checkConnectivity() is async and returns a List (one or more network interface types currently active). [1][2]

  • What the values mean: ConnectivityResult enumerates interface types (wifi, mobile, ethernet, vpn, bluetooth, none, other). The list can contain multiple entries (e.g., vpn + wifi). Use .contains(...) to check for a particular type. [2]

  • Implementation responsibility: The Dart API calls a platform-specific implementation (ConnectivityPlatform). Each platform plugin (Android/iOS/macos/linux/windows) implements checkConnectivity() to query the OS network APIs and map results to ConnectivityResult values. The platform interface defines the API and throws UnimplementedError if not overridden. [3]

  • Practical notes / caveats:

    • checkConnectivity reports the active network interface(s), not whether remote Internet access is reachable — you should still perform an actual network request (or ping) for “has internet.” [2]
    • Platform/OS differences and bugs exist (e.g., iOS simulator/versions have reported checkConnectivity returning none); platform behavior can change and issues are tracked in the plugin repo. [4]

If you want, I can fetch and paste the exact platform implementation files (Android/iOS/Linux/Windows) and explain line-by-line. Which platform(s) do you want analyzed?


🌐 Web query:

parse-flutter-sdk connectivity mapping ethernet wifi mobile priority

💡 Result:

Short answer: Parse Flutter SDK maps only wifi -> wifi, mobile -> mobile, and everything else -> none — it doesn’t expose ethernet (or other ConnectivityResult values) and thus treats those as none. [1][2]

Sources:

  • Parse Flutter SDK connectivityStream implementation (maps ConnectivityResult.wifi → ParseConnectivityResult.wifi, ConnectivityResult.mobile → ParseConnectivityResult.mobile, default → ParseConnectivityResult.none). [1]
  • connectivity_plus docs / changelog showing ConnectivityResult includes ethernet (and other types) on supported platforms. [2][3]

References:
[1] Parse SDK Flutter — connectivityStream implementation.
[2] connectivity_plus package docs (connectivity types & usage).
[3] connectivity_plus changelog (ethernet support added).


🌐 Web query:

Parse Flutter SDK issue 1042 ethernet connectivity

💡 Result:

Summary: The Parse Flutter SDK’s connectivityStream maps connectivity_plus values but only handles wifi and mobile — any other ConnectivityResult (including ethernet) falls to the default branch and is returned as ParseConnectivityResult.none. That causes devices on Ethernet to appear as “no connectivity” to the Parse SDK. Source code excerpt shows the mapping only for wifi/mobile and default -> none. [1]

Context / evidence:

  • Parse SDK docs (connectivityStream implementation) — maps ConnectivityResult.wifi -> ParseConnectivityResult.wifi, ConnectivityResult.mobile -> ParseConnectivityResult.mobile, all other cases -> ParseConnectivityResult.none. [1]
  • Related upstream bug reports show connectivity_plus returning ConnectivityResult.ethernet on macOS/desktop when both Wi‑Fi and LAN are present (so ethernet is a real value that needs handling). [2]

Impact: Apps using Parse’s connectivityStream will treat ethernet-connected devices as offline (ParseConnectivityResult.none), affecting logic that depends on network state (e.g., LiveQuery reconnect logic, background sync).

Minimal fixes:

  • Short-term: Patch parse_server_sdk_flutter to map ConnectivityResult.ethernet to an appropriate ParseConnectivityResult (e.g., wifi or add a new ethernet enum) in connectivityStream.
  • Alternate: Update consumer code to use connectivity_plus directly (and handle ethernet) rather than relying on Parse’s connectivityStream.

References:

  • Parse SDK connectivityStream implementation. [1]
  • connectivity_plus issue reporting ethernet-only result on desktop. [2]

Test expects ethernet connectivity handling that does not exist in the actual Parse SDK implementation.

The mapResult function tests logic for mapping ConnectivityResult.ethernet to ParseConnectivityResult.ethernet (lines 65, 88), but the current Parse Flutter SDK's connectivityStream only handles wifi and mobile—ethernet and other connectivity types are mapped to ParseConnectivityResult.none. This test will pass while devices on ethernet fail silently in production.

If this test is for issue #1042 (adding ethernet support), it should either:

  • Be marked as a failing test or skipped until ethernet handling is implemented, or
  • Be accompanied by changes to the actual Parse SDK connectivityStream to map ethernet appropriately.

If this test is meant for the current implementation, remove the ethernet-related test cases (lines 75-77, 88-90, 102-104) and the ethernet priority logic from mapResult.

🤖 Prompt for AI Agents
In packages/flutter/test/parse_connectivity_mapping_test.dart around lines 49 to
105, the test asserts handling and priority for ConnectivityResult.ethernet but
the current Parse Flutter SDK maps ethernet to none; update the test to match
the implementation by either (A) removing the ethernet-specific expectations and
the ethernet branch in mapResult (remove tests at lines ~75-77, ~88-90, ~102-104
and the etherenet condition), or (B) mark those ethernet-related test cases as
skipped/expected to fail until ethernet support is implemented, or (C) implement
ethernet mapping in the SDK and then keep the tests—choose one approach and make
the corresponding change so tests reflect the actual supported behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kirkmorrow What would be the response to this review feedback?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Revert pubspec.yaml changes
@kirkmorrow kirkmorrow requested a review from Copilot December 2, 2025 19:30
@kirkmorrow
Copy link
Contributor Author

I'm not sure how to address the failing checks

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

Windows: LiveQuery not working since 9.0.0

2 participants