refactor(servers): use SelectionHistory instead of URLTestResults#8840
Merged
Conversation
Map the radiance server JSON field renamed from urlTestResult to selection_history, replacing the UrlTestResult model with a SelectionHistory model mirroring lantern-box's TagHistory shape. Probe delay reads now key off lastSuccessDelayMs.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors server health/probe tracking by replacing the legacy UrlTestResult model with a richer SelectionHistory model, and updates the “fastest Lantern server” selection and related logging/tests to use the new probe delay field.
Changes:
- Replace
UrlTestResultwithSelectionHistoryin the server model and JSON parsing. - Update fastest-server ranking and “successful probe” checks to use
selectionHistory.lastSuccessDelayMs. - Update logging and test helpers to construct/use
SelectionHistory.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/core/models/available_servers_test.dart | Updates test server factory to populate selectionHistory.lastSuccessDelayMs for probe-related assertions. |
| lib/features/vpn/provider/available_servers_notifier.dart | Updates debug log output to report probe delay via selectionHistory.lastSuccessDelayMs. |
| lib/core/models/available_servers.dart | Introduces SelectionHistory, updates Server to parse selection_history, and updates fastest-server logic to rank by lastSuccessDelayMs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request refactors the way server probe results and selection history are tracked and used throughout the codebase. The main change is replacing the
UrlTestResultmodel with a more comprehensiveSelectionHistorymodel, which captures more detailed probe and user-traffic failure information. All references and logic related to server probe results are updated accordingly.Key changes include:
Model and Data Structure Updates:
UrlTestResultclass with a newSelectionHistoryclass inavailable_servers.dart.SelectionHistorytracks the last successful probe delay, consecutive failures, user-traffic failures, and related timestamps for each server, providing a more complete history of server selection and health.Servermodel to useselectionHistoryinstead ofurlTestResult. All JSON serialization/deserialization and related logic now work with the newSelectionHistorystructure. [1] [2] [3]Business Logic Changes:
selectionHistory.lastSuccessDelayMsfor sorting, instead of the previousurlTestResult.delay.hasSuccessfulProbelogic to checkselectionHistory.lastSuccessDelayMsinstead ofurlTestResult.delay.Logging and Testing:
selectionHistorywhen reporting the fastest server.Serverinstances withSelectionHistoryinstead ofUrlTestResult.