-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(webview_apis): always bind ephemeral port, ignore stale PORT_ENV (OPENHUMAN-TAURI-82) #1543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
senamakel
merged 4 commits into
tinyhumansai:main
from
sanil-23:fix/webview-apis-ephemeral-port
May 13, 2026
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f047af1
fix(webview_apis): always bind ephemeral port, ignore stale PORT_ENV
sanil-23 cbad0df
review: save+restore PORT_ENV around test (CodeRabbit on #1543)
sanil-23 44c155d
review: current_thread runtime + STARTED-leak note (graycyrus on #1543)
sanil-23 4c14099
Merge remote-tracking branch 'upstream/main' into pr/1543
senamakel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[major]
std::env::set_varin async test without single-threaded runtimeEnv mutation (
set_var/remove_var) is process-global and not thread-safe in Rust. The save/restore pattern (prev_port_env) prevents value leakage but does not eliminate the data-race window where another thread reads the env betweenset_varand the restore.Under
#[tokio::test](default multi-threaded runtime), other tests in the same binary can observe the mutated env mid-flight.Suggested fix:
This eliminates the intra-test thread-pool concurrency. Not a full fix for cross-test env races (OS threads from other tests still run), but it removes the Tokio-specific window and is consistent with how other env-mutating tests in the project are handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in
44c155d6— switched to#[tokio::test(flavor = "current_thread")]. Eliminates the intra-test multi-threaded tokio window. Cross-test races between OS threads of OTHER tests are still possible by design (the save/restore pattern covers that part). Test still passes (1/1).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in
44c155d6— switched to#[tokio::test(flavor = "current_thread")]. Eliminates the intra-test multi-threaded tokio window. Cross-test races between OS threads of other tests are still possible by design (the save/restore pattern covers that part). Test still passes (1/1).