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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017R3Eg7MEpSWnm1oB9ZPP6G
This commit is contained in:
GodopuandClaude Opus 5 committed 2026-09-14 21:03:38 +00:00
1 parent c01a1192c8
commit 371099a82c
1 file changed
+8 -1
+8 -1
View File
@@ -1220,9 +1220,16 @@ def test_acceptance5_remote_runner_completes_a_job_over_the_broker_only(tmp_path
stdout, stderr = proc.communicate(timeout=180) stdout, stderr = proc.communicate(timeout=180)
jid = _wait_job_id(reg) jid = _wait_job_id(reg)
if proc.returncode != 0: 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) _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 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", \ 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()}" 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" assert _job(reg, jid)["transport"] == "remote"