Repository navigation
desktop::safety: wait for the supervisor thread instead of a fixed sleep (fixes #50) - #51
Merged
Merged
Conversation
…ce after a sleep (fixes #50) Three Supervisor tests slept a fixed time and then read the switch once: "still live" 60 ms into a 120 ms deadline, "open" 400 ms into a 150 ms one, "stopped" 120 ms after the subject died. Each failed whenever the beating thread went unscheduled for longer than its window, as it did on macOS CI (silent_for 136 ms at safety.rs:513) while ~2200 tests ran in parallel: the code under test was right, the tests read too early. Each now waits, up to WAIT_FOR_THREAD (10 s), for the state it proves: the switch open at a moment past its first deadline (only a beat after the start explains that), Stopped once the subject dies, Unsupervised once the supervisor is dropped. A stalled scheduler only delays them; a supervisor that never beats, or a drop that leaves it beating, still fails them -- both checked by breaking the code (no heartbeat; Drop not stopping the thread). 15 runs of the module beside a full parallel test run: 0 failures.
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.
Fixes #50.
Problem: three
Supervisortests insrc/desktop/safety.rsslept a fixed time and then read the switch once. When the beating thread went unscheduled longer than that window (macOS CI:silent_for: 136msagainst a 120 ms deadline), they failed although the code was right.Fix: each test now waits, for up to 10 s, for the state it proves:
Stoppedonce the subject dies;Unsupervisedonce the supervisor is dropped.A slow scheduler only delays them.
Checked:
Dropthat leaves the thread beating, the drop test fails withgot Ok(()).cargo test --lib, 0 failures.acp_agent::flow_tests::session_new_answers_before_a_slow_server_has_listed_its_tools: a timing test, passes when rerun on its own (3 of 3).desktop::uia::tests::live::the_focused_window_can_be_walked: a live test that walks the focused window. On this machine that was a web page with a 1×1 visually-hidden element at y = −16079, which the test's bounds assertion rejects. Tracked separately.