split tunneling: treat FFI "ok" response as success, not error#8691
Merged
myleshorton merged 2 commits intogarmr/radiance-daemon-refactorfrom Apr 23, 2026
Merged
Conversation
_runSplitTunnelCall was checking `result != nullptr` and treating any
non-null return as an error message. But the Go FFI
(lantern-core/ffi/ffi.go) returns C.CString("ok") on success for both
addSplitTunnelItem and removeSplitTunnelItem — a non-null C string.
As a result, every successful add/remove was being reported to the UI as
a failure with message "ok". Symptoms:
- Adding a website in split tunneling showed an unstyled default
snackbar reading "OK" (the default Material SnackBar rendering
failure.localizedErrorMessage).
- The website appeared to not be saved — but it actually was; the
provider's `reloaded` flag was never set, so the on-screen list never
re-fetched from the backend.
- Re-clicking "Add" with the same domain created a duplicate entry on
disk (visible as repeated items in split-tunnel.json) because the
provider's local "already-added" check worked against a stale copy
that had never been refreshed.
Fix: mirror the checkAPIError convention — treat literal "ok" as
success, parse JSON {"error": "..."} bodies for the error message, and
fall back to the raw string otherwise.
Reported in getlantern/engineering#3291 against Windows 9.0.29 build 481
(Freshdesk #173656).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rather than hardcoding 'ok', use the existing _ffiOkResults set
({'ok', 'true'}) defined at the top of this file so the split-tunnel
path stays in sync with the other FFI success checks (e.g.
_setupRadiance at line 201).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes split-tunneling add/remove calls incorrectly treating successful Go FFI responses ("ok") as errors, which caused spurious “OK” snackbars and stale UI state.
Changes:
- Update
_runSplitTunnelCallto treatnullptrand literal"ok"as success. - Parse JSON error bodies (
{"error":"..."}) from Go FFI and surface the decoded error message instead of the raw JSON. - Ensure non-null returned C strings are freed after decoding.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4 tasks
myleshorton
added a commit
that referenced
this pull request
Apr 23, 2026
The local showSnackbar helper in website_domain_input was using Material's default ScaffoldMessenger.showSnackBar(SnackBar(content: Text(message))) — producing an unstyled grey/dark snackbar that the rest of the app doesn't use. Every call site in this file is an error path (empty input, invalid domain, already-added, backend failure), so route them through context.showSnackBarError which applies the app's rounded, floating, red-background error style. Follow-up to #8691. Addresses the "unstyled snackbar" symptom in getlantern/engineering#3291 issue 3 for any remaining error surface after the FFI "ok" fix. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
_runSplitTunnelCallwas checkingresult != nullptrand treating any non-null FFI return as an error. But the Go side returnsC.CString("ok")on success (a non-null C string), so every successful add/remove was reported to the UI as a failure with the message"ok".checkAPIErrorconvention — treat literal"ok"as success, parse JSON{"error": "..."}bodies for the error message, and fall back to the raw string otherwise.User-visible effect
Reported in getlantern/engineering#3291 against Windows 9.0.29 build 481 (Freshdesk #173656):
SnackBarrenderingfailure.localizedErrorMessage).reloadedflag was never set, so the on-screen list never re-fetched.split-tunnel.json) because the provider's local "already-added" check worked against a stale copy.One root-cause fix addresses all three symptoms.
Test plan
🤖 Generated with Claude Code