Repository navigation
test(audit): audit tests wait their turn for the chain's lock and move the sealer's clock instead of sleeping - #693
Open
PiquelChips wants to merge 2 commits into
Open
PiquelChips wants to merge 2 commits into
PiquelChips wants to merge 2 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
PiquelChips
force-pushed
the
test/database-waits
branch
from
November 22, 2026 14:33
56edb82 to
ce614d6
Compare
PiquelChips
force-pushed
the
test/audit-waits
branch
from
November 22, 2026 14:34
9c8edb3 to
12b23ce
Compare
…e the sealer's clock instead of sleeping
PiquelChips
force-pushed
the
test/database-waits
branch
from
November 22, 2026 14:51
ce614d6 to
37c9fc8
Compare
PiquelChips
force-pushed
the
test/audit-waits
branch
from
November 22, 2026 14:51
12b23ce to
8fdd92e
Compare
PiquelChips
marked this pull request as ready for review
November 22, 2026 14:55
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.
Audit tests polled every 20ms for the sealer's advisory lock, and one of them slept 4.5s of wall time waiting for checkpoint intervals to pass. They now wait their turn for the lock, and move a clock instead of sleeping through it.
Stacked on #692, whose
Database::exclusivethey use.Changes
Sealer::failed_atis atokio::time::Instant. It behaves like thestdone in production, and paused tokio time can move it. auth-service's dev-dependencies enable tokio'stest-utilfor this.Fixture::lockwaits forAuditChainwithDatabase::exclusiveinstead of pollingtry_exclusive.Fixture::drain(lock, pass)replaces three copies of the same loop: run a pass until no event is left unsealed, and count the passes that sealed something. It keeps one// wall-clock:wait. Sealing waits for older transactions anywhere on the shared cluster to end, and PostgreSQL signals nothing when they do.Tests
Every audit test goes through
lockandseal_with, and they assert what they did before.sealing_goes_on_when_a_checkpoint_failsandcheckpoints_keep_their_interval_while_batches_stay_fullrun their passes throughdrain. The second now sleeps only after a pass that sealed nothing, which changes none of its assertions on checkpoint positions.a_failed_checkpoint_is_retried_after_the_intervalhas two changes:tokio::time::advance(interval)betweenpause()andresume(). That replaces sleeping one interval. Time is paused only for the jump, so the database queries keep their real timeouts.Checked: with the sealer never waiting after a failure, the test fails at "waits". With the sealer never trying again, it fails at "tries again".
I ran all 23 audit tests five times against a scratch cluster, and they passed every time.
Council review
Rounds: 3
GPT 6.1 Sol could not take part: its account hit its usage limit.
Note
Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 and Claude Fable 5.2 (via T3 Code)