diff --git a/tests/hermes_state/test_fts_rebuild_admission.py b/tests/hermes_state/test_fts_rebuild_admission.py index 4fbca604de..f8423cdfb7 100644 --- a/tests/hermes_state/test_fts_rebuild_admission.py +++ b/tests/hermes_state/test_fts_rebuild_admission.py @@ -524,18 +524,19 @@ class TestDeferredFtsRetryInProcess: d.close() self._mark_stale(db_path) - with _rebuild_lock_held_by_other_process(db_path): + with _rebuild_lock_held_by_other_process(db_path) as holder: gw = SessionDB(db_path=db_path) # long-lived "gateway" open try: assert gw._fts_stale is True - # Live holder: the retry must return quickly (timeout=0), - # not wait out any admission budget. + # Live holder: the retry uses timeout=0 rather than waiting out + # the configured admission budget. Prove that contract from the + # holder's liveness; a wall-clock bound also measures macOS's + # load-dependent process open-file scan. monkeypatch.setattr( hermes_state_common, "_FTS_REBUILD_LOCK_TIMEOUT_SECONDS", 30.0 ) - t0 = time.monotonic() assert gw.retry_deferred_fts_recovery() is False - assert time.monotonic() - t0 < 2.0 + assert holder.poll() is None assert gw._fts_stale is True # Rate limit engaged: an immediate second call is a no-op. assert gw.retry_deferred_fts_recovery() is False