Refactor SimulationController to callback-based lifecycle API and move EDT UI updates into Frame#488
Merged
bedaHovorka merged 5 commits intocopilot/goal-7-simulation-speed-controlfrom May 6, 2026
Conversation
4 tasks
Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/01419796-a691-46e1-ae10-8c1373a9ee18 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/01419796-a691-46e1-ae10-8c1373a9ee18 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Decide thread-safety strategy for SimulationController
Refactor SimulationController to callback-based lifecycle API and move EDT UI updates into Frame
May 6, 2026
bedaHovorka
approved these changes
May 6, 2026
Owner
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/e88ff78a-7a85-4ecd-9542-da0b8e356164 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com>
Contributor
Author
Applied the requested fixes in commit
Screenshot: N/A — no visual layout/UI rendering change; this is lifecycle wiring/state synchronization behavior. |
bedaHovorka
approved these changes
May 6, 2026
- StatusBar.propertyChange: dispatch label update via invokeLater when called from non-EDT thread (EDT violation now always reachable since StatusBar stays visible during simulation) - SimulationControlPanel: add onSpeedChanged callback wired to SimulationController.setSpeed() so desiredSpeed stays in sync; speed selected via slider/preset is now honoured after stop+start - Frame.setContext: close previous SimulationContext after new wiring to prevent Koin scope leak on repeated Simulation > Start... invocations - SimulationControllerTest: replace Thread.sleep(100) with flushEDT(times=3) to eliminate timing-dependent flakiness in stale-monitor test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bedaHovorka
approved these changes
May 6, 2026
|
87786bf
into
copilot/goal-7-simulation-speed-control
10 checks passed
Copilot AI
added a commit
that referenced
this pull request
May 6, 2026
…e EDT UI updates into Frame (#488) * refactor: decouple SimulationController from Swing components Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/01419796-a691-46e1-ae10-8c1373a9ee18 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com> * test: adapt SimulationController tests to callback-based UI wiring Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/01419796-a691-46e1-ae10-8c1373a9ee18 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com> * fix: handle stopped runner detachment and initial speed callback Agent-Logs-Url: https://github.com/bedaHovorka/interlockSim/sessions/e88ff78a-7a85-4ecd-9542-da0b8e356164 Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com> * fix: resolve four Important issues from code review - StatusBar.propertyChange: dispatch label update via invokeLater when called from non-EDT thread (EDT violation now always reachable since StatusBar stays visible during simulation) - SimulationControlPanel: add onSpeedChanged callback wired to SimulationController.setSpeed() so desiredSpeed stays in sync; speed selected via slider/preset is now honoured after stop+start - Frame.setContext: close previous SimulationContext after new wiring to prevent Koin scope leak on repeated Simulation > Start... invocations - SimulationControllerTest: replace Thread.sleep(100) with flushEDT(times=3) to eliminate timing-dependent flakiness in stale-monitor test Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bedaHovorka <5263405+bedaHovorka@users.noreply.github.com> Co-authored-by: Bedrich Hovorka <bedrich.hovorka@gmail.com> Co-authored-by: Claude Sonnet 4.6 <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.



SimulationControllerpreviously mutated Swing UI state directly, relying onFrameas an implicit EDT boundary. This change applies the requested option 5: controller lifecycle is now UI-agnostic, andFrameowns EDT-marshalled UI projection.Controller boundary: lifecycle logic decoupled from Swing
ControlPanel/ToolBar/StatusBardependencies with callbacks:onStateChanged(SimulationStatus)onSpeedChanged(Double)onCompleted()SimulationStatusenum (RUNNING,STOPPED) for explicit state signaling.Frame integration: EDT-safe UI projection
Framenow wires controller callbacks to UI updates (ControlPanel,ToolBar,StatusBar).Frameso callback-driven UI work is always marshalled to EDT.Test adaptation: callback-wired headless verification
SimulationControllerTestto construct controller via callback wiring helper instead of passing Swing components directly into the controller.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
download.jetbrains.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Xmx2g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant(dns block)If you need me to access, download, or install something from one of these locations, you can either: