Skip to content

fix: eliminate flaky tests from port TOCTOU race and CI timing - #2341

Merged
oferchen merged 1 commit into
masterfrom
fix/flaky-tests
Feb 18, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/flaky-tests

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Replace daemon test port allocator with OS-assigned ephemeral ports (port 0), eliminating the file-based counter and cross-process collision window
  • Hold TcpListener until right before daemon spawn to minimize TOCTOU between port release and daemon bind
  • Widen execute_sparse_with_large_file timeout from 10s to 30s for slow CI runners (macOS beta observed 13.8s)
  • Add nextest CI retry policy (retries=2) for daemon and sparse tests

Test plan

  • All 730 daemon tests pass locally
  • execute_sparse_with_large_file passes locally
  • cargo clippy --workspace --all-targets --all-features --no-deps -D warnings clean
  • cargo fmt --all -- --check clean
  • CI passes on all platforms

- Replace file-based port allocator with OS-assigned ephemeral ports
  (port 0) to eliminate cross-process port collision. Return held
  TcpListener alongside port so callers can minimize the TOCTOU window
  between release and daemon bind.

- Update start_daemon() to accept and drop the held listener immediately
  before spawning the daemon thread, reducing the race window to near
  zero.

- Widen execute_sparse_with_large_file timeout from 10s to 30s to
  accommodate slow macOS CI runners (observed 13.8s on macOS beta).

- Add nextest CI retry policy (retries = 2) for daemon tests and sparse
  tests as belt-and-suspenders against residual timing sensitivity.
@oferchen
oferchen merged commit 9e01530 into master Feb 18, 2026
30 checks passed
@oferchen
oferchen deleted the fix/flaky-tests branch February 18, 2026 17:30
@oferchen oferchen added the bug Something isn't working label Feb 19, 2026
oferchen added a commit that referenced this pull request May 1, 2026
fix: eliminate flaky tests from port TOCTOU race and CI timing
oferchen added a commit that referenced this pull request May 5, 2026
fix: eliminate flaky tests from port TOCTOU race and CI timing
oferchen added a commit that referenced this pull request May 18, 2026
… (STN-7 #2341)

Wire the SpillCompression knob on SpillPolicy through the
SpillableReorderBuffer write/read path. The on-disk record format gains a
single leading tag byte per record (0x00 raw, 0x01 zstd) so the reader can
dispatch unambiguously, and the spill-compression Cargo feature now pulls
in zstd 0.13 as an optional dependency. Default builds keep the historical
raw-byte payload format and pay no extra dependency cost.

The Zstd variant of SpillCompression is still gated by the feature so
constructing it in a default build is a compile error - the natural
"fail fast at construction" guarantee. A reader that encounters the zstd
tag without the feature surfaces the new typed
SpillError::UnsupportedCompression(0x01) instead of feeding garbage to the
item codec.
oferchen added a commit that referenced this pull request May 18, 2026
… (STN-7 #2341)

Wire the SpillCompression knob on SpillPolicy through the
SpillableReorderBuffer write/read path. The on-disk record format gains a
single leading tag byte per record (0x00 raw, 0x01 zstd) so the reader can
dispatch unambiguously, and the spill-compression Cargo feature now pulls
in zstd 0.13 as an optional dependency. Default builds keep the historical
raw-byte payload format and pay no extra dependency cost.

The Zstd variant of SpillCompression is still gated by the feature so
constructing it in a default build is a compile error - the natural
"fail fast at construction" guarantee. A reader that encounters the zstd
tag without the feature surfaces the new typed
SpillError::UnsupportedCompression(0x01) instead of feeding garbage to the
item codec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant