test(continuous): per-instance trigger-miss hook#542
Open
julio4 wants to merge 1 commit into
Open
Conversation
… process global The previous `FORCE_TAKE_MISS_COUNT` static in `shared_best.rs` was a process-global AtomicU64, so under `cargo test` (all tests in one process, parallel threads) any other continuous-mode test calling `SharedBest::take()` in its build loop could consume the forced miss intended for `smoke_continuous_trigger_miss_fallback_publishes_candidate`, causing the fallback test to pass vacuously or perturbing a sibling test. Replace the global with a per-builder `Arc<AtomicU64>` seeded from a new `initial_force_take_miss_count` field on `FlashblocksConfig` (and `FlashblocksArgs`, `#[arg(skip)]`). `OpPayloadBuilderInner` holds the Arc (`#[cfg(test)]`), clones it into every `SharedBest` via `start_flashblock_interval`, and `SharedBest::take()` does the decrement on `self.force_take_miss` rather than the global. The test sets `initial_force_take_miss_count: 1` in its `OpRbuilderArgs` literal; all global hook infrastructure (`ForceTakeMissGuard`, `force_next_take_misses`, `should_force_take_miss`, and the `continuous_test_hooks` re-exports) is deleted. Verified with both `cargo nextest run` and `cargo test`.
avalonche
reviewed
Jun 16, 2026
| /// Number of forced `SharedBest::take()` misses for test isolation. | ||
| /// Consumed only under `#[cfg(test)]`; else always 0. | ||
| #[arg(skip)] | ||
| pub initial_force_take_miss_count: u64, |
Collaborator
There was a problem hiding this comment.
can this not be refactored such that the test instance can be configured with a test SharedBest instance with test config?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fallback test was flaky with the force trigger-miss hook, that relied on a process-global count that any concurrent test could consume. Replaced with per-builder Arc.