Skip to content

fix(tests): replace wall-clock flakes with deterministic probes - #18864

Open
chubes4 wants to merge 1 commit into
mainfrom
fix/test-timing-flakes
Open

chubes4 wants to merge 1 commit into
mainfrom
fix/test-timing-flakes

Conversation

@chubes4

@chubes4 chubes4 commented Nov 23, 2026

Copy link
Copy Markdown
Member

Summary

Two tests flaked under full nextest parallelism on Ubuntu CI because they depended on wall-clock scheduling.

What changed

  • help_fast_path::invalid_help_subcommand_fails_locally_with_upgrade_suggestion: removed the 10ms bound on update_help_diagnostic (a pure function returning a static string; the bound only measured runner load). Kept the content check. Added invalid_help_subcommand_never_discovers_extensions, which runs the shipped binary with a HOME whose extension manifest is a FIFO with no writer. Extension discovery would block forever reading it, so a regression off the fast path hangs and fails within a 30s cap. The test also asserts exit code 2, the upgrade suggestion, and that the runtime-initialization sentinel is never written.
  • cook_effects::renewing_cook_owner_blocks_until_expiry_and_replays_completion: the 300ms lease with a lease/3 heartbeat gave each renewal only ~200ms of slack. A delayed renewal (each one reopens the observation store) expired the live owner, and the second claim got the lease. The lease is now 3s, and the test waits on the recorded lease deadlines instead of fixed sleeps. It waits past the initial deadline and expects LeaseHeld, then checks that the deadline moved forward. After the owner drops (which joins the heartbeat), it waits past the final recorded deadline, so the expiry step no longer depends on scheduling.
  • Product: EffectLeaseHeartbeat used to stop for good on any renewal error, so one transient store error (for example a busy database) could let a live owner's lease expire. It now stops only when the fence is lost (Ok(false)) or when the owner drops it.

Verification

Deferred to GitHub Actions CI; no local cargo run by operator instruction. rustfmt --edition 2021 and git diff --check are clean.

AI disclosure

Written by Claude (Anthropic) as a Pi subagent, dispatched directly (outside Homeboy Cook) at @chubes4's request; Claude wrote the code and tests.

The update --help fast-path test asserted a 10ms bound on a pure
function, which a loaded CI runner can exceed. Keep the content check
and add a binary test that proves the fast path never discovers
extensions: a FIFO manifest blocks any read, so a regression hangs and
is reported instead of racing a stopwatch.

The renewing Cook owner test used a 300ms lease, leaving the heartbeat
~200ms of scheduling slack per renewal. Use a 3s lease and wait on the
recorded lease deadlines rather than fixed sleeps. Also keep the effect
lease heartbeat running across transient store errors; only a lost
fence ends ownership.

This branch has not been deployed

No deployments
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