From d0bc67ad6c33c0c127c3e4a59fcb0e28fd15fdf5 Mon Sep 17 00:00:00 2001 From: JeffreyChen Date: Thu, 8 Oct 2026 15:30:14 +0800 Subject: [PATCH] Exit 1 from the legacy CLI flags when an action failed 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". --- README.md | 2 ++ README.zh-CN.md | 2 ++ README.zh-TW.md | 2 ++ architecture.md | 5 +++- automation_file/__main__.py | 8 +++++- automation_file/core/action_executor.py | 18 +++++++++++++ docs/source/Eng/usage/cli.rst | 7 +++++ docs/source/Zh-CN/usage/cli.rst | 7 +++++ docs/source/Zh-TW/usage/cli.rst | 7 +++++ docs/updates/2026-10.md | 10 +++++++ docs/updates/README.md | 3 ++- tests/test_cli_main.py | 35 +++++++++++++++++++++++++ tests/test_legacy_cli_contract.py | 33 +++++++++++++++++++++++ 13 files changed, 136 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ed85aee..dd12ffc 100644 --- a/README.md +++ b/README.md @@ -929,6 +929,8 @@ python -m automation_file --execute_str '[["FA_create_dir",{"dir_path":"x"}]]' python -m automation_file --create_project ./my_project ``` +The legacy flags exit with status 1 when an action of the list failed, after the rest of the list has run, and print `error: N action(s) failed` on stderr. + ## JSON action format Each entry is either a bare command name, a `[name, kwargs]` pair, or a diff --git a/README.zh-CN.md b/README.zh-CN.md index ce4e224..4df9eae 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -910,6 +910,8 @@ python -m automation_file --execute_str '[["FA_create_dir",{"dir_path":"x"}]]' python -m automation_file --create_project ./my_project ``` +旧式标志在清单中有动作失败时,会在其余动作执行完之后以状态 1 结束,并在 stderr 打印 `error: N action(s) failed`。 + ## JSON 动作格式 每一项动作可以是单纯的命令名称、`[name, kwargs]` 组合,或 `[name, args]` diff --git a/README.zh-TW.md b/README.zh-TW.md index 49352f4..dc2e3de 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -910,6 +910,8 @@ python -m automation_file --execute_str '[["FA_create_dir",{"dir_path":"x"}]]' python -m automation_file --create_project ./my_project ``` +舊式旗標在清單中有動作失敗時,會在其餘動作執行完之後以狀態 1 結束,並在 stderr 印出 `error: N action(s) failed`。 + ## JSON 動作格式 每一項動作可以是單純的指令名稱、`[name, kwargs]` 組合,或 `[name, args]` diff --git a/architecture.md b/architecture.md index bf590df..59f2092 100644 --- a/architecture.md +++ b/architecture.md @@ -134,7 +134,10 @@ ActionExecutor() → build_default_registry(): local + http + utils + drive comm contract, guarded by `tests/test_legacy_cli_contract.py`. PyBreeze also declares `automation-file` as a dependency. - **TestPioneer** imports `download_file` and `unzip_all` from the facade in-process - (`test_pioneer/executor/file/file_processing.py`). Its `parallel_run` does not spawn this package. + (`test_pioneer/executor/file/file_processing.py`). Its `file-runner` runs an action file through + `execute_action` in-process, and `parallel_run` spawns `python -m automation_file --execute_file