fix(lease-broker): recovery_runtime_unittest wait_ready() connect-probe (co-equal CI flake, cherry-pick #898) #900
Reference in New Issue
Block a user
Delete Branch "fix/recovery-runtime-wait-ready-race"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Root cause
wait_ready()inrecovery_runtime_unittest.pypolledsocket_path.exists()todecide the daemon was ready to accept connections.
exists()only proves thepath was
bind()'d — it does not prove the daemon has calledlisten()yet.Under CI load the gap between
bind()andlisten()widens enough that thefirst client
connect()lands in that window and getsECONNREFUSED, flakingthe test.
This is the identical TOCTOU race that PR #898 fixed in
recovery_b1_adversarial_unittest.py, in the sametest:framework-shell/pnpm testchain, in this test-locked (#828/#869) fail-closed area.Same proven form as #898
Cherry-picked the exact
wait_ready()transformation from #898: replace theexistence check with a real
socket.connect()-and-close probe (contextmanager, per-probe
settimeout(0.25), retrying onConnectionRefusedError/FileNotFoundErroruntil success or the deadline).Adapted to this file's own existing structure rather than overwritten
wholesale:
process.poll()/RuntimeError) is unchangedTimeoutError("daemon did not create private broker socket")message is unchangedZero assertion / daemon / gate-timeout changes
git diff origin/main -- packages/mosaic/src/lease-broker/recovery_runtime_unittest.py | grep -E '^[-+].*assert'is empty).wait_ready()in this one test file was touched.recovery_b1_adversarial_unittest.py(already fixed by #898) and the p5/p6 probes (separate trailing PR) are untouched.Verification
git diff origin/main --stat→ exactly 1 file changed (6 insertions, 1 deletion).python3 -m unittest recovery_runtime_unittest -v8x in a row from the file's directory: all green (3/3 tests each run), no ECONNREFUSED.Closes #899
Record of Review — PR #900 (recovery_runtime_unittest wait_ready() connect-probe; Closes #899)
VERDICT: APPROVE (GO conditional on CI terminal-green). Reviewer: independent subagent
aa839a9e(ms-lead-reviewer), fresh clone — ≠ builder (a0a052a4,mosaic-coder). REVIEWED-HEAD:fc9feb4d0870d004c0745c369016e32420e21d5a.git diff origin/main | grep -E "^[-+].*assert"= EMPTY. Only wait_ready readiness changed (socket_path.exists → real connect probe); this file own 5.0s deadline, daemon-exited-early check, and exactTimeoutError("daemon did not create private broker socket")message byte-identical.Closes #899; commit-author mosaic-coder ≠ reviewer.CI: pipeline 2022 (recovery_runtime IS in CI test:framework-shell chain, so green confirms the fix in CI). GO for id-11 + merge at FULL-40
fc9feb4d0870d004c0745c369016e32420e21d5aon terminal-green. Non-executor.jason.woltje referenced this pull request2026-07-25 22:22:45 +00:00
GO — Gate-16 id-11 stamp, pinned to exact FULL head
fc9feb4d08.Basis: verbatim RoR (comment 18817) — independent review APPROVE, MANDATORY zero-assertion-change gate PASSED (assert-diff empty; only the wait_ready readiness probe changed, deadline and error message byte-identical; structurally identical to the proven #898 form); CI terminal-green (2022) — and because recovery_runtime IS in the CI chain, this green is in-situ proof the fix works under the very harness it repairs. Closes #899. Vector 2 of 2: with #898 + #900 on main, the test:framework-shell chain's known TOCTOU flake class is closed. Named executor: Mos (id-11), squash pinned.