You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 586e4c3
Browse filesBrowse the repository at this point in the historyBrowse files
Fix desktop CLI errors, shutdown hangs, and run verdicts (#4478)
* Report desktop-driver CLI usage errors in every reporter mode
Commander copies exit and output settings only into commands created
after they are set, so subcommand usage errors went to an in-memory
buffer and exited silently. Apply the reporter output and exit override
to the whole command tree.
- Route usage errors through the selected reporter: one error record in
json and ndjson, a stderr message in plain.
- Throw InvalidArgumentError from option parsers so they are reported as
usage errors instead of internal.
- Resolve the reporter mode once and before any action, so an invalid
DESKTOP_REPORTER no longer lets serve start listening.
- Write the serve readiness record inside the try so a write failure
still closes the server.
- Make the NDJSON error record the single terminal record, matching JSON.
- Map WebDriver error codes to matching CLI error kinds, including busy
for target-busy session failures.
- Clip doctor error messages to the same byte limit as other errors.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Report storybook-desktop CLI option errors as usage errors
Option parsers and input checks threw TypeError, which the reporter
classified as internal. Throw InvalidArgumentError so the error is
reported as a usage error in every mode.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Document desktop-driver CLI error records
Describe the single error record written for usage and configuration
failures in json and ndjson modes, and correct the NDJSON terminal
record rule.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Decide desktop-test verdicts from decisive attempts and reported work
Retried tests no longer pass when a failed attempt is followed only by skipped
attempts, selected worker work that reported no tests is incomplete, and
presentation errors become warnings that keep the verdict. Incomplete lane runs
list their unmet work and throw a typed error, secrets are sanitized once at
finalize, run-query errors use a closed code set without filesystem paths,
NDJSON milestones never suppress failures, run.json writes are throttled, and
IPC producers cannot send collector-only events.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Order WDIO attempts by arrival and surface empty specs
The producer's attempt number is opaque, so retry numbering no longer corrupts
workerAttempt, a spec that ran no tests is reported as a warning, and the
generated config raises the framework log level so spec import failures show.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Document desktop-test verdict rules and add changeset
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix desktop-test shutdown hangs and cancellation
- Integrations borrow the supervisor scope without closing it; the CLI awaits
the integration run outside the scope with a bound, and scope draining is
bounded (drainTimeoutMs), so Storybook serve and story tests exit after
SIGINT (LIFE-1). storybook-desktop closes only a scope it created.
- Stage, suite and storybook-desktop stage commands receive the scope signal;
abort stops the POSIX process group as failed, a late spawn is refused, and
sync spawn failures leave nothing tracked (LIFE-2, LIFE-9).
- Interrupt handlers cover SIGINT/SIGTERM/SIGHUP until cleanup completes; a
second signal force-kills owned trees, a third exits (LIFE-3..5).
- Close disposes services and resources in one reverse order, isolates
observer failures and releases spawn-failure claims (LIFE-10, LIFE-13).
- Per-user claim directory, atomic claim replacement and start-time tolerance
(LIFE-6, LIFE-8 partial); one short private local-socket helper for process
control and reporting transport, with IPC only for services (LIFE-7, REP-11).
- Generated WDIO config reads settings from a file; PowerShell reads the AppX
name from the environment; suiteTimeoutMs bounds the launcher; NUL is
rejected in command args and env (LIFE-11, LIFE-12, LIFE-15, LIFE-17).
- Tests: commands, services, signals, localSocket, transport negatives,
lifecycle and CLI-interrupt contracts, public-entry consumer, borrowed-scope
regression (LIFE-16, REP-16).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Document desktop-test shutdown, cancellation and claim location
Records the fixed idle-CLI-after-interrupt cause, signal escalation, bounded
draining, reverse disposal, the per-user claim directory, suiteTimeoutMs and
the NUL rule, and the borrowed storybook-desktop scope. Adds changesets.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Defer workload-claim start-time identity
Remove the one-second start-time tolerance from workload-claim inspection.
The recorded start time comes from the Node.js clock rather than the
operating system, and a tolerance would let a reused process ID match a
live owner. Inspection compares exactly again; the lifecycle and status
references record that `pid-reused` is unproven until the claim records a
helper-described start time (LIFE-8 deferred).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Keep interrupt handlers through storybook-desktop cleanup
Export the desktop-test interrupt policy as `handleDesktopInterrupts` and
use it in the storybook-desktop CLI and standalone Storybook channel. The
handlers now stay installed until cleanup completes, SIGHUP is handled, a
second interrupt force-stops owned commands, and a third exits without
cleanup. Previously the one-shot `process.once` listeners were consumed by
the first signal, so a second SIGINT or a SIGHUP killed the CLI mid-cleanup.
An interrupted one-shot command, such as a stage, now reports `incomplete`
instead of passed with exit 0.
Tests: interrupted stage under SIGINT/SIGINT and SIGHUP/SIGTERM, standalone
channel SIGHUP, and an owned service escalating on a second SIGINT; each
fails without the change.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address Windows process trees only before recorded exit
Run `taskkill /T /F` synchronously, and only while the command's exit is
unrecorded. Windows reuses a process ID only after every handle to the
process closes, and Node closes the child handle while processing the
exit on the same event loop, so the ID still names the owned leader. A
failed taskkill is now judged by the recorded completion rather than by
probing a process ID that may have been reused, and the asynchronous
force-stop spawn that could race the exit is gone.
This is not descendant containment: `/T` follows parent process IDs, so a
descendant whose parent already exited still escapes until Job Object
containment exists. Emulated-Windows tests cover the exit gate, the
synchronous call, and a failed taskkill for a leader that keeps running.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Assert spec-load failures name the failed spec
The spec-load-failure contract now also requires the failed work item to
be labelled with the spec that threw. The original error text remains in
the worker command log only; run.json and junit.xml do not carry it.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Print aggregate members when a desktop-test contract fails
The contract runner printed only the outer error stack, so an
AggregateError from disposal hid the cleanup failure that caused it.
Print the error with `util.inspect` so members and causes are included.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Report desktop-driver CLI usage errors in every reporter mode. Subcommand usage errors now reach stderr (plain) or a single `error` record (json and ndjson) and exit 1 instead of exiting silently. An invalid `DESKTOP_REPORTER` no longer lets `serve` start. NDJSON failures emit the error record as their terminal record, matching JSON. WebDriver errors map to matching CLI error codes, and `doctor` messages are clipped.
Fix shutdown hangs and cancellation. An integration's run is no longer tracked in the scope it borrows, so a Storybook `serve` or story test exits after SIGINT instead of idling, and scope draining is bounded. Cancellation stops running stage and suite commands, including their POSIX process groups, reports them failed, and refuses late spawns. A second interrupt force-stops owned process trees, SIGHUP is handled, and handlers stay installed until cleanup completes; `handleDesktopInterrupts` exports that policy for integrations. On Windows, `taskkill` runs synchronously and only before the command's exit is recorded, so it cannot address a reused process ID. Close disposes services and resources in one reverse order even when an observer throws. Workload claims move to a per-user directory independent of TMPDIR and are replaced atomically; local sockets use short private paths. Generated WDIO configs read settings from a file, suites accept `suiteTimeoutMs`, and command arguments and environment reject NUL.
Leave an injected desktop-test service scope to its owner instead of closing it from `driver`, `server`, and the smoke lifecycle, which made a supervising `desktop-test serve` or story test wait on itself after a stop. Stage commands now receive the scope's cancellation signal. The CLI and the standalone Storybook channel keep their interrupt handlers until cleanup completes, handle SIGHUP, and force-stop owned commands on a second interrupt; an interrupted one-shot command reports `incomplete` instead of passed.
Fix verdicts that passed without coverage. A test takes the status of its decisive attempt, so a failed attempt followed only by skipped or unsupported retries stays failed. Selected worker work that reports no tests is `incomplete`, and the WDIO reporter warns when a spec ran no tests, with the jasmine and mocha framework loggers raised to `warn` so an import failure is visible. WDIO attempts keep their arrival order whatever numbers the runner reports. Console stalls, closed pipes, and queue overflow are warnings that no longer fail a passing run, and the final line comes from the terminal result. Incomplete runs list their unmet work and a JUnit message that names it, and result checks throw a typed `DesktopIncompleteError` that reporters record as the run's verdict instead of an infrastructure failure. Failures and late-registered secrets are sanitized once at finalization, and run-query errors use a closed code set without filesystem paths. NDJSON milestones no longer suppress a later failure after many skips, record IDs are not clipped, a projection failure still emits a summary record, `run.json` snapshots are throttled, and producers can no longer send `run-finished`.
| `auto` (default) | `github-actions` when `GITHUB_ACTIONS=true`; otherwise `plain`. A future interactive renderer may be selected only for a TTY. | Current diagnostics |
431
-
| `plain`, `github-actions` | Existing human renderers. `reporting.console` remains a compatible configuration source. | Current diagnostics |
432
-
| `json` | Exactly one compact document at exit. Long-lived commands (`serve`, Storybook `driver` and `server`) print one readiness document instead and nothing afterward. | Empty, except for failures before mode resolution or loss of stdout |
433
-
| `ndjson` | Compact LF-terminated records ending with exactly one terminal record, identical to the `json` document. One-shot commands emit one record. | Same as `json` |
| `auto` (default) | `github-actions` when `GITHUB_ACTIONS=true`; otherwise `plain`. A future interactive renderer may be selected only for a TTY. | Current diagnostics |
431
+
| `plain`, `github-actions` | Existing human renderers. `reporting.console` remains a compatible configuration source. | Current diagnostics |
432
+
| `json` | Exactly one compact document at exit. Long-lived commands (`serve`, Storybook `driver` and `server`) print one readiness document instead and nothing afterward. | Empty, except for failures before mode resolution or loss of stdout |
433
+
| `ndjson` | Compact LF-terminated records. A run ends with exactly one `terminal` record, identical to the `json` document. A failure before a run starts emits only its `error` record, identical to `json`. | Same as `json` |
434
434
435
435
`--events <milestones|progress|all>` applies to `ndjson`; the default is
436
436
`milestones`:
@@ -714,7 +714,7 @@ exit-path gaps.
714
714
**Complete when:** every reporter mode is tested on every exit path: pass,
715
715
test failure, infrastructure failure, usage or configuration error,
716
716
interruption, and closed stdout. Structured stdout must parse as exactly one
717
-
document or as valid NDJSON ending in one terminal record, and structured
717
+
document or as valid NDJSON ending in one terminal or error record, and structured
718
718
stderr must be empty on normal paths. Documents and default streams stay within
719
719
limits for synthetic runs with at least 10,000 tests, 1,000 failures, and
0 commit comments