feat: add ctrl+c cancellation on running pw-checks/tests#1292
Draft
ferrandiaz wants to merge 14 commits intomainfrom
Draft
feat: add ctrl+c cancellation on running pw-checks/tests#1292ferrandiaz wants to merge 14 commits intomainfrom
ferrandiaz wants to merge 14 commits intomainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
Adds an isCancelling flag to AbstractListReporter so the live status panel stops re-rendering while the cancel confirmation prompt is on screen, and resumes when the prompt closes. - onCancelPromptShown clears the panel and raises the flag. - onCancelPromptHidden lowers the flag and repaints; runs on both confirm and decline so live updates resume during the cancellation drain. - _printSummary and onStreamLogs short-circuit while the flag is up. - _clearSummary becomes a no-op when there is nothing to erase, preserving the clear/print invariant if a guard skips the paired _printSummary.
PQueue.pause() does not interrupt an in-flight handler. A CHECK_INPROGRESS handler that started before SIGINT could still emit and trigger a panel re-render right under the cancel prompt, producing spurious project-tree output. - Emit CANCEL_PROMPT_SHOWN before queue.pause(); EventEmitter.emit is synchronous so reporters set their flag before any pending handler can render. - Emit CANCEL_PROMPT_HIDDEN after the prompt resolves on both confirm and decline, restoring live updates. - On confirm, print 'Cancelling test session...' so the user sees feedback while the backend cancellation completes. - Always queue.start() after the prompt: drains MQTT results so allChecksFinished can resolve on confirm, resumes normal flow on decline. - Use printLn instead of raw process.stdout.write to match the rest of the CLI.
Wires the runner's CANCEL_PROMPT_SHOWN and CANCEL_PROMPT_HIDDEN events to each reporter for the test, pw-test, and trigger commands.
Covers happy paths (clear-then-repaint, normal render before/after the prompt) and edge cases (empty _clearString no-op, double prompt-shown idempotency, prompt-hidden without prior prompt-shown, suppression of _printSummary and onStreamLogs while cancelling).
This comment has been minimized.
This comment has been minimized.
|
🎉 Experimental release successfully published on npm |
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.
Affected Components
Notes for the Reviewer
Adds a
--detach(-d) flag to thetest,pw-test, andtriggercommands. When active, Ctrl+C no longer exits immediately — instead it shows a confirmation prompt and cancels the remote test session viaPOST /v1/cancel, allowing the server to return results marked as cancelled rather than dropping the connection mid-run.SIGINT flow (with
--detach)--detach: Ctrl+C exits immediately (behavior unchanged)Key files changed
rest/cancel.ts— new file, thin client forPOST /v1/cancelabstract-check-runner.ts— SIGINT handler added as private methods; cleanup infinallyisCancelledprioritytest,pw-test,triggercommand files — flag declaration and cancel handler wiring