From 834ab22198b377cea91abf8a8b20f7e08ecf2a55 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Fri, 6 Nov 2026 12:49:24 +0800 Subject: [PATCH] fix: Preserve execution evidence after heartbeat failures Co-Authored-By: Codex --- .../workflows/execution-report-heartbeat.yml | 1 + docs/runtime-daily-heartbeat-sync.zh-CN.md | 5 +++++ tests/test_execution_evidence_failure_path.py | 20 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 tests/test_execution_evidence_failure_path.py diff --git a/.github/workflows/execution-report-heartbeat.yml b/.github/workflows/execution-report-heartbeat.yml index 9212d561..7fd098be 100644 --- a/.github/workflows/execution-report-heartbeat.yml +++ b/.github/workflows/execution-report-heartbeat.yml @@ -126,6 +126,7 @@ jobs: uv run --no-sync python scripts/with_heartbeat_digest_binding.py candidates - name: Publish read-only runtime execution evidence + if: ${{ !cancelled() && steps.install_runtime_deps.outcome == 'success' && (steps.gcp_auth_primary.outcome == 'success' || steps.gcp_auth_retry.outcome == 'success') }} uses: QuantStrategyLab/QuantRuntimeSettings/actions/publish-runtime-execution-evidence@c97752202670fac58db797c01596d11dd105a94b with: source-id: runtime-reports-schwab diff --git a/docs/runtime-daily-heartbeat-sync.zh-CN.md b/docs/runtime-daily-heartbeat-sync.zh-CN.md index 62f02412..9509097b 100644 --- a/docs/runtime-daily-heartbeat-sync.zh-CN.md +++ b/docs/runtime-daily-heartbeat-sync.zh-CN.md @@ -9,6 +9,11 @@ daily publisher step,在既有 22:20 UTC 调度内复用同一 WIF/uv 流程 或证据同步失败仍可记录日报;认证、依赖安装失败或运行取消不发布。日报的失败 不会跳过已经执行的原健康通知,原步骤顺序与行为不变。 +`Publish read-only runtime execution evidence` 同样独立于健康检查和候选发布的 +成功状态:只要运行未取消、依赖安装成功且本次认证成功,就继续导出已有执行证据。 +因此缺少可接受回执或候选冲突不会额外造成管理站的执行证据缺口。原检查仍保留失败 +结论;导出步骤继续使用原有 action、来源和步骤级凭据,不调用策略或券商。 + GitHub默认条件语义:[官方表达式说明](https://docs.github.com/en/actions/reference/workflows-and-actions/expressions#status-check-functions)。 ## 启用 diff --git a/tests/test_execution_evidence_failure_path.py b/tests/test_execution_evidence_failure_path.py new file mode 100644 index 00000000..9e690e07 --- /dev/null +++ b/tests/test_execution_evidence_failure_path.py @@ -0,0 +1,20 @@ +"""Evidence export remains independent of failed heartbeat/candidate checks.""" +from test_runtime_daily_heartbeat_workflow import ( + _condition, _evaluate, _step_block, _workflow_text, +) + + +def test_evidence_export_after_attention_uses_authenticated_installed_reader(): + step = _step_block(_workflow_text(), "Publish read-only runtime execution evidence") + condition = _condition(step) + # A status function overrides implicit success(), including failed candidate publication. + assert "!cancelled()" in condition + assert _evaluate(condition, "", "success", "skipped") + assert _evaluate(condition, "", "failure", "success") + for primary, retry in (("failure", "failure"), ("failure", "skipped")): + assert not _evaluate(condition, "", primary, retry) + for installed in ("failure", "skipped", "cancelled"): + assert not _evaluate(condition, "", "success", "skipped", installed=installed) + assert not _evaluate(condition, "", "success", "skipped", cancelled=True) + assert "actions/publish-runtime-execution-evidence@" in step + assert "EXECUTION_EVIDENCE_SYNC_TOKEN:" in step