Skip to content

Exit 1 from the legacy CLI flags when an action failed - #108

Merged
JE-Chen merged 1 commit into
devfrom
feat/cli-exit-status
Oct 11, 2026
Merged

JE-Chen merged 1 commit into
devfrom
feat/cli-exit-status

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Oct 8, 2026

Copy link
Copy Markdown
Member

Summary

python -m automation_file with -e, -d or --execute_str exits with status 1 when an action of the list failed, and prints error: N action(s) failed on stderr. The rest of the list still runs first.

Why

The executor records a failed action as repr(error) and runs the next one, so the process ended with status 0 whatever happened. TestPioneer's parallel_run starts --execute_file and reads the exit status (TestPioneer PR #32, docs/artifacts.rst, "Native Support"), and so does a CI job. LoadDensity made the same change in its PR #118; APITestka has it in its PR #149.

Behaviour change

A script with a failing action now ends with status 1 where it ended with 0. PyBreeze only displays the status. execute_action and what it returns are unchanged.

How

  • ActionExecutor.failure_count: how many actions have failed in the executor, thread-safe, dry runs excluded.
  • __main__.main compares the count before and after the legacy dispatch.

architecture.md §6 said TestPioneer's parallel_run does not spawn this package. It does, for its file-runner; the entry is corrected.

Checks

  • tests/test_legacy_cli_contract.py +4 (real child processes), tests/test_cli_main.py +3.
  • ruff check, ruff format --check and mypy are clean for the package.
  • Local suite: 838 passed, 1 skipped. Five tests in tests/test_versioning.py fail with FileNotFoundError on the machine it was run on, with and without this change.

Docs: the three READMEs, docs/source/{Eng,Zh-TW,Zh-CN}/usage/cli.rst, architecture.md §6, docs/updates/.

The executor records a failed action and runs the next one, so the
process ended with status 0 whatever happened. The executor now counts
the actions that failed, and the entry point compares the count before
and after the legacy dispatch and exits 1 with "N action(s) failed".
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen
JE-Chen marked this pull request as ready for review October 11, 2026 07:38
@JE-Chen
JE-Chen merged commit 10b54fc into dev Oct 11, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant