Skip to content

fix(test): stabilize watcher healthy-peer restart fixture - #9

Merged
Amplify-Logic merged 2 commits into
mainfrom
fm/firstmate-watcher-lock-flake-t9
Jul 20, 2026
Merged

fix(test): stabilize watcher healthy-peer restart fixture#9
Amplify-Logic merged 2 commits into
mainfrom
fm/firstmate-watcher-lock-flake-t9

Conversation

@Amplify-Logic

Copy link
Copy Markdown
Owner

Summary

  • Fix the flaky tests/fm-watcher-lock.test.sh healthy-peer restart case that timed out at 80s (status 124) on unmodified main.
  • Root cause was a test-fixture race, not a product hang in the arm/restart path: the Node peer was launched with a SIGTERM no-op handler, but the test proceeded as soon as the shell recorded the peer pid. On macOS, restart can deliver SIGTERM before Node finishes installing that handler; default TERM then kills the peer, so restart falls into the child-owned attach/replace path and blocks until the suite's 80s wait deadline.
  • Evidence: the failing assertion was restart did not exit zero after reporting healthy peer (status 124) — 124 is the fixture timeout, not an assertion mismatch. Reproduced deterministically when the peer was still in startup (handler not installed). After waiting for an explicit readiness marker written only after the SIGTERM handler is installed, restart correctly reports the healthy peer and exits 0 without attaching.
  • Fixture now waits for that readiness file (failing fast if the handler never installs) and cleans up peer/arm processes on assertion failure so leftovers cannot poison later cases. Product restart behavior is unchanged.

Test plan

  • bash tests/fm-watcher-lock.test.sh — at least 5 consecutive green runs in isolation on the task machine (predecessor + 2 reconfirm runs after recovery)
  • Confirm CI green on this PR
  • No other suites expected to change; this is fixture-only

Amplify-Logic and others added 2 commits July 19, 2026 17:11
Wait for the fixture's SIGTERM handler before exercising restart so startup scheduling cannot turn the healthy-peer case into the child-owned path.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant