From 371099a82cd72742c71224b2767ee9cf73037d78 Mon Sep 17 00:00:00 2001 From: Godopu Date: Mon, 14 Sep 2026 21:03:38 +0000 Subject: [PATCH] test(issue-18): rec 5 follow-up - acceptance5 accepts a delivery confirmed by the retained terminal event and skips when the dispatch never reached the broker Two more failure modes seen on the public broker after the stale-dispatch fix: - the runner served this run's job, but the broker delivered only the retained `completed` (not the non-retained `started`); the wrapper logged "advanced to 'completed'", which the test did not accept as delivery evidence although it is the same protocol evidence as "advanced to 'running'"; - the orchestrator's dispatch publish failed with "no CONNACK from broker" and the runner never saw the job - an unreachable broker, the same kind of precondition as the existing skip when the runner cannot subscribe. Everything else still fails. The test remains dependent on the public broker (3 runs after this change: 2 passed, 1 failed with CONNACK retry warnings). Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_017R3Eg7MEpSWnm1oB9ZPP6G --- tests/test_issue18_liveness_contract.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_issue18_liveness_contract.py b/tests/test_issue18_liveness_contract.py index e0d4033..db95f29 100644 --- a/tests/test_issue18_liveness_contract.py +++ b/tests/test_issue18_liveness_contract.py @@ -1220,9 +1220,16 @@ def test_acceptance5_remote_runner_completes_a_job_over_the_broker_only(tmp_path stdout, stderr = proc.communicate(timeout=180) jid = _wait_job_id(reg) if proc.returncode != 0: + if ("no CONNACK from broker" in stderr + and "published started" not in runner_log.read_text(errors="replace")): + pytest.skip("broker unreachable when publishing the dispatch (no CONNACK); the runner never saw the job") _skip_if_broker_did_not_deliver(reg, runner_log) assert proc.returncode == 0, f"rc={proc.returncode}\n{stdout}\n{stderr}\nrunner:\n{runner_log.read_text()}" - assert "subscriber received started" in stderr or "advanced to 'running'" in stderr + # delivery is confirmed by the protocol: the subscriber saw `started`, or + # the registry left pending - to running, or straight to completed when + # the broker delivered only the retained terminal event + assert ("subscriber received started" in stderr or "advanced to 'running'" in stderr + or "advanced to 'completed'" in stderr), stderr assert _job(reg, jid)["status"] == "completed", \ f"the subscriber mirrors the remote terminal into the registry\n{stdout}\n{stderr}\nrunner:\n{runner_log.read_text()}" assert _job(reg, jid)["transport"] == "remote"