SIGN IN SIGN UP

Fix CI: Livewire 3 version constraint and flaky sampling tests (#502)

* Fix CI: prevent Livewire 3 minimum version from being downgraded in prefer-lowest

The `composer require livewire/livewire:^3.0` step overwrites the
`^3.6.4` constraint in composer.json, causing prefer-lowest to resolve
to Livewire 3.0.0 which has known issues that break Pulse's dashboard
rendering. Skip the override for Livewire 3 so the existing composer.json
constraint is respected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix Livewire 3 constraint to use ^3.6.4 instead of skipping override

The previous approach skipped the composer require for Livewire 3,
but this meant prefer-stable resolved to Livewire 4.x (since
composer.json has ^3.6.4|^4.0), making the Livewire 3 jobs duplicate
the Livewire 4 jobs. Now explicitly requires ^3.6.4 for Livewire 3
so prefer-stable gets the latest 3.x and prefer-lowest gets 3.6.4.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* CI: re-run 1 — verify flaky sampling test

* Fix flaky sampling tests by making Lottery results deterministic

All 8 "can sample" tests used probabilistic assertions
(toEqualWithDelta) that could randomly fail in CI. For the 7 tests
using Lottery-based sampling, use Lottery::fix() to control outcomes.
For the Queues test using deterministic UUID-based sampling, use
Str::createUuidsUsingSequence() with pre-computed UUIDs where exactly
one hashes below the 0.1 threshold.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix code styling

* Fix sampling tests: use Lottery::alwaysWin and filter by entry type

The previous approach with Lottery::fix() failed because the fixed
sequence is global — multiple recorders consume from it on each event,
exhausting the sequence and falling back to random behavior.

Instead, use Lottery::alwaysWin() so all Lottery-based sampling passes,
then assert the exact expected count. Tests that query pulse_entries
now filter by the specific recorder's type to avoid counting entries
from other recorders that also fire on the same events.

For the Queues test (UUID-based deterministic sampling), use
Str::createUuidsUsing() with a fixed UUID that hashes below the 0.1
threshold, so all 10 jobs deterministically pass sampling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Reset Lottery state after sampling tests to prevent bleed

Lottery::alwaysWin() sets a static factory that persists across tests.
Add Lottery::determineResultNormally() cleanup to prevent subsequent
tests (like "can sample at zero") from inheriting the always-win state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: JoshSalway <1491451+JoshSalway@users.noreply.github.com>
J
Josh Salway committed
dfd3b8e98cd1ada8d105e528da0afe1bbfe7d990
Parent: 4bb792f
Committed by GitHub <noreply@github.com> on 3/26/2026, 2:27:31 PM