Skip to content

test(cadence): use integer FM_POLL in fast-poll watcher tests - #152

Open
yjuyjuy wants to merge 4 commits into
mainfrom
fm/fm-lock-defunct-hardening2
Open

test(cadence): use integer FM_POLL in fast-poll watcher tests#152
yjuyjuy wants to merge 4 commits into
mainfrom
fm/fm-lock-defunct-hardening2

Conversation

@yjuyjuy

@yjuyjuy yjuyjuy commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Summary

Fix stale fractional FM_POLL values in fast-poll watcher tests. The watcher
cadence resolver (bin/fm-cadence-lib.sh) accepts only non-negative integer
seconds since PR #52; a fractional FM_POLL=0.2/0.1/0.02 is rejected with a
loud warning and falls back to the 300s default. Tests written before the
integer-only contract silently ran at a 300s cadence and failed
deterministically:

  • tests/fm-watcher-lock.test.sh - watcher self-eviction never observed within
    the 60s wait (observed failure).
  • tests/fm-watch-triage.test.sh - AFK paused-pane handoff waits 40s for a
    stale-detection cycle that takes 300s.
  • tests/fm-pr-check-security.test.sh - the bounded-watcher helper (5s alarm)
    and the descendant-check watcher time out before one cycle.

All six fractional FM_POLL sites in tests are switched to FM_POLL=1, the
documented integer test seam, with a comment at each site. This work was found
while verifying the already-landed defunct/zombie lock hardening (#84); its
zombie-guard tests pass unmodified.

Pipeline validation (no-mistakes)

Run 01M0QWQ055EWTFBZ3PWB4HPHKE, gate agent claude (global config workaround
2026-08-23, captain word): review 0 findings, test passed (~8m), lint passed
(full-tree bin/fm-lint.sh), push + PR done. Pipeline fix commits on this
branch repair four pre-existing CI drifts on main (see below).

Pre-existing CI red on main (not caused by this change)

All check families covering this change pass (parallel-1, parallel-2, invariants,
lint, coverage guard; serial lane's watcher/triage/security suites pass: the
zombie, self-evict, and arm tests are green on the serial head). Three checks
fail on main for unrelated, pre-existing or environment-dependent reasons:

  1. Behavior portable serial - 8 failing scripts on the first pipeline head,
    none touched by this change: fm-backend.test.sh (pre-refactor shim sibling
    list drift), fm-bearings-snapshot.test.sh (Account-quotas "unavailable"
    rendering), fm-bootstrap.test.sh (CONFIG_REREAD nudge banner, secondmate
    env), fm-gotmp.test.sh, fm-hourly-passes.test.sh, fm-memory-report.test.sh,
    fm-session-start.test.sh (each environment-dependent), and
    fm-subagent-pretool-check.test.sh (guard drift vs shipped commit 10d26a4,
    fixed in-branch by the pipeline, 7deb70f). The serial family
    (watcher-wake-lock) is green.
  2. Behavior tests (Herdr) - one test fails on the runner:
    "projected task-pane close did not demonstrate and immediately restore the
    exact focus-steal regression" (fm-backend-herdr-presentation-e2e.test.sh,
    timing-dependent real-Herdr test). This change never runs in the Herdr lane.
  3. Stock macOS Bash snapshot compatibility - snapshot suite now matches the
    bumped 20-test count; the Bearings suite ("missing quota data must render
    unavailable under the Account quotas subsection") produces no output under
    stock macOS bash 3.2 and fails the 42-test assertion. This change does not
    touch Bearings.

Fleet lanes are addressing the main-CI drift separately (a fix-firstmate-main-ci
lane owns the Bearings failure). This PR's own checks are green.

The watcher cadence resolver (bin/fm-cadence-lib.sh) accepts only
non-negative integer seconds; a fractional FM_POLL such as 0.2 falls
back to the 300s default with a loud warning. Tests written before the
integer-only contract (#52) still used fractional polls and silently
ran at 300s cadence, so cycle-bound assertions failed deterministically:

- tests/fm-watcher-lock.test.sh: watcher self-eviction was never
  observed within the 60s wait once the poll fell back to 300s.
- tests/fm-watch-triage.test.sh: the AFK paused-pane handoff waited on
  a cycle that never arrived inside the 40s bound.
- tests/fm-pr-check-security.test.sh: the bounded-watcher helper
  (5s alarm) and the descendant-check watcher timed out before one
  cycle.

Switch every fractional FM_POLL in tests to FM_POLL=1, the documented
integer test seam, preserving the fast-cycle intent. Found while
verifying the landed defunct/zombie lock hardening (#84); the zombie
guard tests pass unmodified.
@yjuyjuy
yjuyjuy force-pushed the fm/fm-lock-defunct-hardening2 branch from bbea594 to 56ef609 Compare August 23, 2026 19:18
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