Skip to content

test(core): de-flake supervision props strategy scenario (#100)#110

Merged
joeldsouzax merged 1 commit into
mainfrom
test/100-deflake-supervision-props-settle
Jul 2, 2026
Merged

test(core): de-flake supervision props strategy scenario (#100)#110
joeldsouzax merged 1 commit into
mainfrom
test/100-deflake-supervision-props-settle

Conversation

@joeldsouzax

Copy link
Copy Markdown
Contributor

Closes #100.

Finding

The card's premise — "a fixed-duration sleep used as a settle barrier races under load" — was stale for the current code. At card #77 the suite was rewritten to a condition-based settle() that is iteration-bounded, so its effective timeout self-scales with load. The one genuine residual was a bare tokio::time::sleep(NEGATIVE_BOUND) in run_strategy_trial — the only real-actor path in supervision.properties.feature. There is no proptest in this path, so the card's "commit a regression seed" prong does not apply.

Change (test-only)

  • Replace the bare sleep(NEGATIVE_BOUND) with an active hold_for over the out-of-set children: it re-checks across the negative window and fails loudly the moment a spurious restart appears, instead of reading state once at the end. The independent restarted-set observation the caller compares to the oracle is preserved.
  • Raise SETTLE_STEPS 600 → 2000. settle returns the instant its condition holds, so a generous positive bound is free for a passing run; it only widens the margin before a genuinely scheduler-starved restart (a 2-core CI runner under llvm-cov) is declared a failure.

No public API change, no coverage movement → no README/coverage-baseline update.

Verification

Could not reproduce on a 14-core dev box. 336 whole-binary runs + 64k in-process cascade trials + 150 hardened runs, all under heavy CPU oversubscription — zero failures. nix flake check green (incl. bombay-nextest).

Side effect: scenario runtime ~7s → ~3.7s (OneForAll trials have an empty out-of-set and now skip the negative window entirely).

The real-actor property scenario (`law_strategy_restart_set` →
`run_strategy_trial`) is the only path in supervision.properties.feature
that spawns real actors, and it carried the last bare fixed-duration
settle sleep in the file: a `tokio::time::sleep(NEGATIVE_BOUND)` used as
a passive barrier before reading the restarted set. A fixed sleep is not
a synchronization primitive — under CI scheduling load (a 2-core runner
under llvm-cov) it races the async restart path.

Replace it with an active bounded `hold_for` over the out-of-set
children: it re-checks throughout the negative window and panics loudly
the moment a spurious restart appears, instead of reading state once at
the end. The independent restarted-set observation the caller compares
to the oracle is preserved.

Also raise the positive-observation bound `SETTLE_STEPS` 600 → 2000.
`settle` returns the instant its condition holds, so a generous bound is
free for a passing run; it only widens the margin before a genuinely
scheduler-starved restart is declared a failure.

Side effect: OneForAll trials have an empty out-of-set and now skip the
negative window entirely, so the scenario runs ~3.7s instead of ~7s.

Verified: 336 whole-binary stress runs + 64k in-process cascade trials +
150 hardened runs, all under heavy CPU oversubscription, zero failures.
@joeldsouzax joeldsouzax merged commit f4d5d15 into main Jul 2, 2026
6 checks passed
@joeldsouzax joeldsouzax deleted the test/100-deflake-supervision-props-settle branch July 2, 2026 17:51
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.

test(core): de-flake supervision property scenarios (timed settle barrier races under load)

1 participant