Normalize Env subscriber path/URL payloads to UTF-8 binaries - #85
Merged
Conversation
Wx charlists (including a bare charlist as the event list) are converted at the Env boundary on notify_subscribers and OS handle_info ingest so subscribers always receive String.t() paths. Document the subscriber_event types and cover binary, charlist, buffer-replay, and lifecycle events in tests.
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
Desktop.Envsubscriber OS events (:open_url,:open_file,:print_file) now always deliver UTF-8 binaries (String.t()), whether they arrive from wx (charlists) or from native bridges (already binaries).This closes the gap where EventBridge/
notify_subscriberssent binaries while wxhandle_infoforwarded charlists (including a bare charlist as the second tuple element), which broke app adapters that only handled one encoding.Changes
t:subscriber_event/0/t:os_app_event/0/t:desktop_event/0and document the contract onsubscribe/0andnotify_subscribers/1notify_subscriberscast and OShandle_info) before buffer or delivery:window_activated, and:new_filetest/desktop/env_wx_test.exsso browser/normalization tests are not polluted byWxCasemodule setup{:open_url, [url]}Test plan
NO_WX=1 mix test test/desktop/env_test.exs(8 tests, 0 failures)NO_WX=1 mix test.fast(pre-existing unrelated failures in this environment)xvfb-run -a mix test.wxwhen a display is availableNote
Medium Risk
Changes the on-the-wire contract for OS open events that apps handle via
Env.subscribe/0; apps that matched only charlists or only binaries must align with binaries, but behavior is now consistent across wx and native paths.Overview
Desktop.Envsubscribers now always get UTF-8 binaries for:open_url,:open_file, and:print_file, fixing inconsistent charlist vs binary payloads from wx vs bridges.Normalization runs on
notify_subscribers/1and on OShandle_infoingest (including events buffered beforesubscribe/0), with a special case for wx’s bare charlist second element ({:open_url, ~c"..."}).subscribe/0and module docs documentt:subscriber_event/0and related types; other events (:new_file,:window_activated) are unchanged.Tests cover passthrough, charlist conversion, buffering, and non-path events; wx-only Env tests move to
test/desktop/env_wx_test.exs. Changelog and the 1.3 note are updated to describe list-shaped{:open_url, [url]}.Reviewed by Cursor Bugbot for commit 8a3d5fa. Configure here.