Skip to content

refactor(servers): use SelectionHistory instead of URLTestResults#8840

Merged
atavism merged 1 commit into
atavism/manual-serverfrom
garmr/selection-history
Jun 4, 2026
Merged

refactor(servers): use SelectionHistory instead of URLTestResults#8840
atavism merged 1 commit into
atavism/manual-serverfrom
garmr/selection-history

Conversation

@garmr-ulfr
Copy link
Copy Markdown
Contributor

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 UrlTestResult model with a more comprehensive SelectionHistory model, 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:

  • Replaced the UrlTestResult class with a new SelectionHistory class in available_servers.dart. SelectionHistory tracks 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.
  • Updated the Server model to use selectionHistory instead of urlTestResult. All JSON serialization/deserialization and related logic now work with the new SelectionHistory structure. [1] [2] [3]

Business Logic Changes:

  • Updated the logic for determining the fastest Lantern server to use selectionHistory.lastSuccessDelayMs for sorting, instead of the previous urlTestResult.delay.
  • Changed the hasSuccessfulProbe logic to check selectionHistory.lastSuccessDelayMs instead of urlTestResult.delay.

Logging and Testing:

  • Updated debug logging to display the new probe delay field from selectionHistory when reporting the fastest server.
  • Updated test helpers to construct Server instances with SelectionHistory instead of UrlTestResult.

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.
Copilot AI review requested due to automatic review settings June 4, 2026 16:27
Copy link
Copy Markdown
Contributor

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 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 UrlTestResult with SelectionHistory in 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.

@garmr-ulfr garmr-ulfr requested a review from atavism June 4, 2026 16:31
Copy link
Copy Markdown
Contributor

@atavism atavism left a comment

Choose a reason for hiding this comment

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

LGTM!

@atavism atavism merged commit 12bcec8 into atavism/manual-server Jun 4, 2026
1 check passed
@atavism atavism deleted the garmr/selection-history branch June 4, 2026 17:08
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.

3 participants