URL-test: clear stale error on success; ignore cancelled-test failures#47
Merged
Conversation
…sts as failures - Clear profile.error on a successful URL/TCP test so a now-passing profile no longer shows an old failure message (previously only the manual 'Clear test results' action cleared it; the success paths set status/ping but left error set). - Guard the urlTest result handlers with !isActive before recording status=2/3, so a cancelled test (dialog cancel / teardown kills the sidecar mid-handshake) is not recorded as a profile failure. The pingTest path already guards this way. Verified on-device: after a re-test, profiles that pass no longer carry stale errors; the list shows current latency or the real current failure reason only.
📝 WalkthroughWalkthroughIn ChangesConnection Test Error Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
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
Two small URL-test UX fixes addressing stale/false test results.
Changes (
ConfigurationFragment.kt)profile.erroron success. The URL-test and TCP-ping success paths setstatus=1/pingbut never cleared a previously-seterror, so a profile that failed once andlater passes kept showing the old failure message until the user manually ran "Clear test
results". Now success clears it.
urlTestresult handlers recordedstatus=2/3+ error even when the exception was just job cancellation (cancelling the testdialog / teardown kills the sidecar mid-handshake → IOException). Guarded with
if (!isActive) breakbefore recording, matching the existingpingTestpath.Testing
list shows current latency (Mieru 189ms, AmneziaWG 283/292ms, Hysteria2 197ms) or the real
current failure reason only; no leftover stale "Get https..." strings.
Notes
guard (the test/service use separate sing-box instances; the
!isActiveguard fixes the actualfalse-failure symptom without the intrusive UX of blocking connects).
Greptile Summary
This PR makes two targeted UX fixes to the URL-test feature in
ConfigurationFragment.kt: clearing staleprofile.errorwhen a test passes, and skipping failure recording when a test is cancelled mid-flight (so a killed-sidecar IOException doesn't get written as a profile failure).profile.error = null, preventing old failure messages from persisting after a profile passes a subsequent test.if (!isActive) breakis added in theurlTestcatch blocks before recording any failure state, mirroring the pre-existing pattern inpingTest. A finalif (!isActive) breakalso guards thetest.updatecall so cancelled results are never added to the results queue.Confidence Score: 5/5
Safe to merge — both changes are surgical, well-scoped, and match patterns already established in the TCP-ping path.
The profile.error = null additions on success paths are straightforward and cannot regress. The !isActive guards in urlTest directly mirror the existing pingTest logic, and test.update is already a no-op for results when dialogStatus is 2, so the guards add defence-in-depth without changing normal-test behaviour. No new state, no schema changes, no new async paths introduced.
No files require special attention.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[urlTest coroutine - while isActive] --> B[poll next profile] B -->|null - queue empty| Z[break - done] B -->|profile| C[profile.status = 0] C --> D[urlTest.doTest] D -->|success| E[status=1, ping=result, error=null NEW] D -->|PluginNotFoundException| F{isActive? NEW} D -->|IOException / Exception| G{isActive? NEW} F -->|false - cancelled| Z F -->|true| H[status=2, error=message] G -->|false - cancelled| Z G -->|true| I[status=3, error=message] E --> J{isActive? NEW} H --> J I --> J J -->|false| Z J -->|true| K[test.update - add to results] K --> A%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% flowchart TD A[urlTest coroutine - while isActive] --> B[poll next profile] B -->|null - queue empty| Z[break - done] B -->|profile| C[profile.status = 0] C --> D[urlTest.doTest] D -->|success| E[status=1, ping=result, error=null NEW] D -->|PluginNotFoundException| F{isActive? NEW} D -->|IOException / Exception| G{isActive? NEW} F -->|false - cancelled| Z F -->|true| H[status=2, error=message] G -->|false - cancelled| Z G -->|true| I[status=3, error=message] E --> J{isActive? NEW} H --> J I --> J J -->|false| Z J -->|true| K[test.update - add to results] K --> AReviews (1): Last reviewed commit: "fix(urltest): clear stale error on succe..." | Re-trigger Greptile