This repository was archived by the owner on Aug 25, 2026. It is now read-only.
test: use event-driven AFK injection waits - #33
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Reduce Firstmate behavior-test runtime without weakening assertions or gates by replacing fixed afk injection sleeps with bounded event-driven waits
What Changed
CONTRIBUTING.mdto describe the AFK injection e2e as event-driven single-digest coverage.Risk Assessment
✅ Low: Captain, the change is limited to one AFK e2e test file and the event-driven waits preserve the original assertions while adding a stability window for duplicate detection.
Testing
The configured full-suite baseline was already green; I then reran the focused AFK injection e2e with tmux 3.4, verified the PR target guard, captured reviewer-visible CLI evidence for all three AFK injection scenarios, and recorded that the target event-driven run finished in 19.88s versus the base test's 26s fixed-sleep floor.
Evidence: AFK injection e2e transcript
Evidence: AFK runtime evidence
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (2) ✅
tests/fm-afk-inject-e2e.test.sh:259- Captain, this wait now returns as soon as one digest is logged and the buffer is empty. The exact-count assertion runs immediately after, so a duplicate emitted on the next watcher or housekeeping cycle can arrive after the test already passed. Keep the event-driven wait, but add a short stability check that requires exactly one digest for at least one poll cycle after first delivery.🔧 Fix: Stabilize AFK duplicate waits
1 warning still open:
tests/fm-afk-inject-e2e.test.sh:408- Captain, the stability window is counted inside the overall timeout, so Scenario B only allows the digest to first appear by about 7.8s even though the old fixed wait allowed about 8s before asserting. Increase the timeout by at leaststable_ticksor changewait_for_stable_eventso the stability clock starts after first success; otherwise this can add CI flake while trying to make the test more event-driven.🔧 Fix: Captain, stabilize AFK wait clocks
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash bin/fm-no-mistakes-pr-target-guard.sh || exit 1; command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"Provided baseline already passed:bash bin/fm-no-mistakes-pr-target-guard.sh || exit 1; command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"./usr/bin/time -p bash tests/fm-afk-inject-e2e.test.shwith transcript captured to/tmp/no-mistakes-evidence/01KWF2MXFAGQAESNS0PV539AGE/fm-afk-inject-e2e-transcript.txt.command -v tmux && tmux -V && bash bin/fm-no-mistakes-pr-target-guard.sh.Compared target event-driven waits against base fixed sleeps withgit show 528ca21e3fc540cfbff6849eff8385bde8f878ee:tests/fm-afk-inject-e2e.test.sh | grep -n "sleep 6\|sleep 8"andgrep -n "wait_for_event \|wait_for_stable_event " tests/fm-afk-inject-e2e.test.sh, recorded in/tmp/no-mistakes-evidence/01KWF2MXFAGQAESNS0PV539AGE/afk-runtime-evidence.txt.git status --short --ignored=noconfirmed no working-tree artifacts were left behind.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.