From 1827342737aaa5b217f432d0e84b05b8839f5ce2 Mon Sep 17 00:00:00 2001 From: Vu Nguyen Date: Mon, 5 Oct 2026 14:45:04 +0000 Subject: [PATCH 1/2] test: give the remote-reply whole-log recapture a longer wait --- tests/fm-remote-reply.test.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/fm-remote-reply.test.sh b/tests/fm-remote-reply.test.sh index dfdc212c1b9..2eb13111d0c 100755 --- a/tests/fm-remote-reply.test.sh +++ b/tests/fm-remote-reply.test.sh @@ -952,6 +952,23 @@ caught_up=$(FM_STATE_OVERRIDE="$PARENT/state" bash -c ' || fail "the caught-up watermark ($caught_up) is outside the quiet window" pass "a quiet reply window publishes the caught-up watermark the reply guard reads" +# The whole-log recapture re-fetches every document the log offers, one remote +# job at a time, so it needs far more than one await_reply_result budget on a +# loaded runner. Each attempt is a full wait that re-checks ownership of the +# source, so the recapture is bounded by RECAPTURE_WAIT_ATTEMPTS of them. +RECAPTURE_WAIT_ATTEMPTS=3 +await_recapture_result() { # + local attempt + for attempt in $(seq 1 "$RECAPTURE_WAIT_ATTEMPTS"); do + if [ "$attempt" -lt "$RECAPTURE_WAIT_ATTEMPTS" ]; then + await_reply_result "$1" 2>/dev/null && return 0 + else + await_reply_result "$1" && return 0 + fi + done + return 1 +} + # The observed already-handled replay class: a lost cursor (an update or # convergence retire) makes the next armed source recapture the WHOLE remote # log from offset 0. Every line is already mirrored, so the at-most-once @@ -967,7 +984,7 @@ mv "$PARENT/state/.wake-queue" "$TMP_ROOT/wake-queue-before-replay" 2>/dev/null stop_reply_listener || fail "the reply listener did not stop before the whole-log recapture" rm -f "$PARENT/state/remote-replies/ios.cursor" GEN=$((GEN + 1)) -await_reply_result "$PARENT/state/procevent-inbox/$SID.$GEN.result" \ +await_recapture_result "$PARENT/state/procevent-inbox/$SID.$GEN.result" \ || fail "the cursor-loss recapture was not captured" assert_present "$PARENT/state/procevent-inbox/$SID.$GEN.handled" \ "the whole-log recapture was not acknowledged by the adapter" From e72d75ae7bd00a193d6e9116716a6c6edabc54bb Mon Sep 17 00:00:00 2001 From: Vu Nguyen Date: Mon, 5 Oct 2026 15:20:09 +0000 Subject: [PATCH 2/2] no-mistakes(review): Extend both recapture waits and simplify retry handling --- tests/fm-remote-reply.test.sh | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/tests/fm-remote-reply.test.sh b/tests/fm-remote-reply.test.sh index 2eb13111d0c..414767f4147 100755 --- a/tests/fm-remote-reply.test.sh +++ b/tests/fm-remote-reply.test.sh @@ -657,6 +657,19 @@ assert_grep 'report=data/remote-secondmates/ios/data/reply/writefail.md' "$PAREN mirrored_cursor_is_current "the recovered delta did not advance the cursor" pass "a failed mirror write never drops status content or advances the cursor" +# The whole-log recapture re-fetches every document the log offers, one remote +# job at a time, so it needs far more than one await_reply_result budget on a +# loaded runner. Each attempt is a full wait that re-checks ownership of the +# source, so the recapture is bounded by RECAPTURE_WAIT_ATTEMPTS of them. +RECAPTURE_WAIT_ATTEMPTS=3 +await_recapture_result() { # + local attempt + for attempt in $(seq 1 "$RECAPTURE_WAIT_ATTEMPTS"); do + await_reply_result "$1" && return 0 + done + return 1 +} + # A source line remains the replay identity even when document availability # changes between a successful mirror append and a failed ingestion commit. REPLAY_LINE='needs-decision [key=replay-decision]: pick report=data/reply/replay.md' @@ -703,7 +716,7 @@ assert_not_contains "$(status_open_decisions "$PARENT/state/ios.status")" $'repl stop_reply_listener || fail "the reply listener did not stop before the cursor-loss recapture" rm -f "$PARENT/state/remote-replies/ios.cursor" GEN=$((GEN + 1)) -await_reply_result "$PARENT/state/procevent-inbox/$SID.$GEN.result" \ +await_recapture_result "$PARENT/state/procevent-inbox/$SID.$GEN.result" \ || fail "the replay-identity whole-log recapture was not captured" assert_present "$PARENT/state/procevent-inbox/$SID.$GEN.handled" \ "the replay-identity whole-log recapture was not applied" @@ -952,23 +965,6 @@ caught_up=$(FM_STATE_OVERRIDE="$PARENT/state" bash -c ' || fail "the caught-up watermark ($caught_up) is outside the quiet window" pass "a quiet reply window publishes the caught-up watermark the reply guard reads" -# The whole-log recapture re-fetches every document the log offers, one remote -# job at a time, so it needs far more than one await_reply_result budget on a -# loaded runner. Each attempt is a full wait that re-checks ownership of the -# source, so the recapture is bounded by RECAPTURE_WAIT_ATTEMPTS of them. -RECAPTURE_WAIT_ATTEMPTS=3 -await_recapture_result() { # - local attempt - for attempt in $(seq 1 "$RECAPTURE_WAIT_ATTEMPTS"); do - if [ "$attempt" -lt "$RECAPTURE_WAIT_ATTEMPTS" ]; then - await_reply_result "$1" 2>/dev/null && return 0 - else - await_reply_result "$1" && return 0 - fi - done - return 1 -} - # The observed already-handled replay class: a lost cursor (an update or # convergence retire) makes the next armed source recapture the WHOLE remote # log from offset 0. Every line is already mirrored, so the at-most-once