Skip to content

Make updater reservation and selection timing tests deterministic - #1199

Merged
jatmn merged 2 commits into
mainfrom
fix/queue-666-updater-reservation-fixtures
Dec 6, 2026
Merged

jatmn merged 2 commits into
mainfrom
fix/queue-666-updater-reservation-fixtures

Conversation

@jatmn

@jatmn jatmn commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Part of #666. Fifteen updater tests now check file-lock ownership, health-bind retry, readiness and saved selections against observable fixture state. Health-bind retry uses Tokio's monotonic clock for both its deadline and its sleep, so the busy-port test can exercise expiry and cancellation with paused time.

The older-writer test keeps its receipt clock fixed while it verifies that an unsupported diagnostic stays deferred and the managed child still reports readiness. With the same child already ready, the supervisor ticks a nanosecond before the stored retry deadline and again at the deadline. The writer receives exactly one additional diagnostic request, on the second tick. Suppressing this retry passed the old test and failed the new one.

Verification

  • Pinned Dylint reproduced all 37 assigned findings. The remaining 47 updater findings on this independent branch are addressed by Synchronize updater child-exit and health handoff tests #1198.
  • All 187 updater package tests passed. All 15 affected tests passed 20 serial and 12 contended runs each on the integrated commit, totaling 480 executions.
  • Delaying the second supervisor tick by 2.4 seconds reproduced an extra diagnostic request on the earlier candidate. The corrected test passed with the same delay, and changing the backoff to zero made it fail.
  • Formatting, updater all-target Clippy, pinned Dylint and repository contracts passed. The initial implementation also caught 10 injected faults. The tests use Linux file locking, real processes, SQLite and loopback sockets with fixture writer and registry endpoints.

Tested together with #1198, the two PRs merge cleanly into tree a5e71a3b61cefc388b0f472960868d7aa0035d32. On that exact tree, pinned Dylint passed across the full workspace with zero test-flake diagnostics, and all 187 updater package tests passed.

Summary by Sourcery

Make updater reservation, retry, readiness, and selection tests deterministic by asserting against observable state and controlled timing.

Enhancements:

  • Make updater tests verify reservation-lock ownership, health-bind retries, readiness, auth-hold deadlines, and saved-selection behavior against observable fixture state.
  • Use Tokio's monotonic clock for health-bind retry deadlines so tests can control timeout and cancellation timing.
  • Verify deferred boot-receipt retries remain pending until their exact deadline while managed readiness proceeds.

Tests:

  • Stabilize timing-sensitive updater tests with paused time, observable fixture markers, exact deadline assertions, and controlled process and file-lock state.

@jatmn
jatmn marked this pull request as ready for review December 5, 2026 23:38
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Dec 5, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

pullfrog[bot]
pullfrog Bot previously approved these changes Dec 5, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No blocking issues. One test coverage gap below.

Approach
Process and filesystem signals establish fixture state, and controlled clocks make the retry assertions independent of runner speed.

Reviewed changes

  • Reservation and readiness. The lock holder signals acquisition over a pipe, child tests wait for published markers, and selection tests check the saved state across supervisor restarts.
  • Health and registry. The health bind deadline uses Tokio time, and the tests exercise busy-port expiry, cancellation, rebind, and truncated registry responses.
  • Auth holds and writer receipts. Tests measure auth holds from the recorded rejection and keep the diagnostic clock fixed while the older writer defers Record and Clear and the managed child reports readiness.

All 187 updater tests and cargo fmt --all -- --check passed on 3359d2d.

Non-blocking

  • The older-writer test bypasses the scheduled Clear retry. It advances the clock to at and checks waiting(), then overwrites After(at) with Ready before calling tick_control(). Tick once at at with the existing managed child already ready and After(at) still in place, then assert one additional diagnostic request. That covers expiry through the supervisor and avoids counting the fresh Clear issued when a new child reports readiness. Older-writer retry test

Pullfrog  | Fix it ➔ | View workflow run | Using gpt-6.2-sol | 𝕏

@jatmn
jatmn dismissed stale reviews from pullfrog[bot] and sourcery-ai[bot] via 03ec695 December 5, 2026 23:51

jatmn commented Dec 5, 2026

Copy link
Copy Markdown
Owner Author

Fixed in 03ec695. The already-ready child now runs tick_control() one nanosecond before the stored Clear deadline and again exactly at it. The loopback writer receives zero additional diagnostic requests on the first tick and exactly one on the second. Suppressing that due retry passed the previous test and failed the new request-count assertion. All 187 updater tests and 480 focused repetitions passed.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed 03ec695, the follow-up to the prior Pullfrog review.

  • Exercised the scheduled Clear retry. The test keeps the same ready child and ticks the supervisor one nanosecond before the saved deadline and again at the deadline. The writer fixture observes zero additional diagnostic requests on the first tick and exactly one on the second.

The focused older-writer regression and cargo fmt --all -- --check passed on 03ec695.

Pullfrog  | View workflow run | Using gpt-6.2-sol | 𝕏

@jatmn
jatmn merged commit 16b813a into main Dec 6, 2026
21 checks passed
@jatmn
jatmn deleted the fix/queue-666-updater-reservation-fixtures branch December 6, 2026 00:02
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