Repository navigation
Conversation
Operators can stop a running test from the station page instead of pressing Ctrl+C in the terminal. The test ends ABORTED and its teardown phases and output callbacks still run. - Test.abort(): aborts the running test the way SIGINT does (same executor.abort(), same "Abort test executor." log line), but a second call does nothing instead of forcibly stopping the process, so a double click can't skip teardown. Returns whether it started the abort. Backed by TestExecutor.abort_requested and a read-only TestState.status. - Station server: POST /tests/<test_uid>/abort -> 204; 404 for an unknown or finished test, 409 if it hasn't started or is already stopping. Unlike the other endpoints it sends no CORS headers and only takes a JSON request whose Origin, if any, is this server, so another web page open on a machine on the network can't stop a test. The dashboard (a different port) can't either. - Web UI: a red "Stop test" button in the Current test header while the test is running. It asks for confirmation, then shows "Stopping..." disabled; on an error other than 409 it re-enables and flashes the error. - web_gui/dist rebuilt with Node 16 (unchanged sources reproduce the old dist byte for byte); README fork notes say how. Tests: test_descriptor_test.AbortTest (ABORTED with teardown run, second abort is a no-op during teardown, no running test), and test/output/servers/station_server_abort_test.py (status codes, origin and content-type checks, no CORS preflight). Full suite: 521 passed. Also checked end to end: a StationServer serving this dist, a real test, and headless Chromium clicking the button -> confirmation, "Stopping...", later phase skipped, teardown ran, outcome ABORTED. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Coverage Report for CI Build 38000336077Coverage increased (+2.6%) to 64.052%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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.
Description
Operators can stop a running test from the station web UI instead of pressing Ctrl+C in the terminal. The test ends ABORTED, and its teardown phases and output callbacks still run. That matters for us because the results upload and the hardware shutdown both run there.
Test.abort()(openhtf/core/test_descriptor.py): aborts the running test the same way SIGINT does. It callsexecutor.abort()and logs the same "Abort test executor." line, whichstafltest.results_uploaduses to upload ABORTED. Unlike a second SIGINT, a second call does nothing instead of force-stopping the process, so a double click can't skip teardown. It returns whether it started the abort. It's backed by a newTestExecutor.abort_requestedand a read-onlyTestState.status.Station server:
POST /tests/<test_uid>/abortreturns these codes:Unlike the other endpoints, it sends no CORS headers. It only accepts a JSON request whose
Origin, if present, is this server. So another web page open on a machine on the network can't stop a test, and neither can the dashboard, which runs on a different port.Web UI: a red Stop test button in the "Current test" header, shown while the test is running. It asks for confirmation, then shows a disabled "Stopping…". On an error other than 409 it re-enables and shows the error.
web_gui/distis rebuilt with Node 16. The unchanged sources reproduce the olddist/byte for byte, so the only difference is this change. The README fork notes now say how to rebuild it.Motivation and Context
The only way to stop a test was Ctrl+C in the station's terminal. Operators work in the web UI, and a second Ctrl+C force-stops the process before the upload and hardware teardown run.
How Has This Been Tested?
test/core/test_descriptor_test.py,AbortTest:test/output/servers/station_server_abort_test.py: status codes, the origin and content-type checks, and no CORS preflight. With the origin check removed, the cross-origin test fails.StationServerserving thisdist/, a real test with a long phase and a teardown, and headless Chromium clicking the button. The confirmation appeared, the button showed "Stopping…", the later phase was skipped, teardown ran, and the outcome was ABORTED.Affected components
openhtf.core(Test,TestExecutor,TestState),openhtf.output.servers.station_server, and the web GUI. After merge, the framework should pin the merge commit (per the fork notes) and the EOL should repin the framework.🤖 Generated with Claude Code