Skip to content

test(reporter): drive the deferred-warning rules on a local buffer - #1345

Merged
codyde merged 1 commit into
masterfrom
fix/reporter-deferred-test-race
Nov 10, 2026
Merged

codyde merged 1 commit into
masterfrom
fix/reporter-deferred-test-race

Conversation

@codyde

@codyde codyde commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

util::reporter::tests::deferred_warnings_are_capped failed on Windows in run 42856901338 (#1275, which does not touch the reporter). The test asserted on the process-global DEFERRED buffer. Its DEFERRED_TEST_LOCK only serialised the two reporter tests against each other. Any TUI test marks the terminal owned, and a warn() raised on another test thread in that window lands in the same buffer. A TUI exit can also flush the buffer partway through the assertion.

  • Split the dedupe-and-cap rule out of defer into push_deferred(&mut Vec, ..). Runtime behaviour is unchanged.
  • The counting and cap tests now drive push_deferred on a local Vec, so no other thread can affect them.
  • The drain check is now its own test, flushing_drains_deferred_warnings. It still uses the global buffer, but only asserts that its own uniquely named entry is gone after a flush.
  • Removed DEFERRED_TEST_LOCK, which is no longer needed.

Test-only change, so release/skip.

Validation

  • cargo fmt --all: no changes.
  • cargo test: all suites pass (1891 unit tests, 6 ignored).
  • cargo clippy --all-targets --all-features: no warnings in reporter.rs.

🤖 Generated with Claude Code

deferred_warnings_are_capped failed on Windows CI (#1275, run 42856901338)
because it asserted on the process-global DEFERRED buffer. Its test lock
only serialised the two reporter tests; any TUI test marks the terminal
owned, and a warn() raised on another test thread during that window
lands in the same buffer (or a TUI exit flushes it mid-assertion).

Split the dedupe-and-cap rule into push_deferred(&mut Vec, ..) so the
counting and cap tests use a local Vec, and keep one global-buffer test
that only asserts on its own uniquely named entry after a flush.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codyde codyde added the release/skip Author no release label Nov 10, 2026
@codyde
codyde merged commit 0240c5d into master Nov 10, 2026
9 checks passed
@codyde
codyde deleted the fix/reporter-deferred-test-race branch November 10, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/skip Author no release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant