Skip to content

fix(tests): stop clear_fault_emits_fault_cleared_event racing its siblings - #135

Merged
passcod merged 1 commit into
mainfrom
claude/fix-fault-cleared-test-race
Aug 1, 2026
Merged

fix(tests): stop clear_fault_emits_fault_cleared_event racing its siblings#135
passcod merged 1 commit into
mainfrom
claude/fix-fault-cleared-test-race

Conversation

@passcod

@passcod passcod commented Aug 1, 2026

Copy link
Copy Markdown
Member

Split out of #107 so it can merge on its own — it is unrelated to that PR's subject and fixes a flake that can hit any branch.

runtime::faults::tests::clear_fault_emits_fault_cleared_event intermittently fails comparing two unrelated fault ids:

left: "7e4dee6c-0be9-4503-ba26-eb208bb98e54"
right: "5e15805b-3d12-40ac-90df-c8ce5f8fe250"

The event sender is global and the test binary runs tests in parallel. The drain loop's comment says it skips "any interleaved events from other parallel tests", but the Ok(_) => continue arm only skips other event kinds — another test's FaultCleared matches the first arm and is asserted against this test's id. Eleven tests in that file clear faults, so the collision is routine rather than theoretical.

Guarding the arm on the id makes the loop skip what it always claimed to skip; a non-matching FaultCleared now falls through to continue.

Observed failing on a branch whose changes go nowhere near faults, while the identical code passed on a sibling branch in the same window — which is the flake.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CgdfXBAnSEj5s24gbJyXHi


Generated by Claude Code

…lings

The event sender is global and the test binary runs tests in parallel, so the
drain loop sees FaultCleared events from any test that clears a fault — and
eleven of them do. The loop's Ok(_) arm skips other event kinds but not other
tests' FaultCleared, so whichever arrives first is asserted against this
test's id, comparing two unrelated uuids.

Guard the arm on the id so the loop skips what its comment always said it
skipped. Observed failing in CI; the same code passes on other branches,
which is the flake.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CgdfXBAnSEj5s24gbJyXHi
Copilot AI review requested due to automatic review settings August 1, 2026 21:53
passcod pushed a commit that referenced this pull request Aug 1, 2026
Split into #135 against main. It is unrelated to the Windows runtime and
fixes a flake that can hit any branch, so it should not wait on this one.

The --nocapture change that shared its commit stays: it belongs here, since
it is what makes the S6 spike tests' recorded observations reach the log.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CgdfXBAnSEj5s24gbJyXHi
@github-code-quality

github-code-quality Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript, Rust

TypeScript / code-coverage/vitest

The overall coverage in commit 01d37b6 in the claude/fix-fault-cle... branch remains at 65%, unchanged from commit 9983b79 in the main branch.

Rust / code-coverage/rust

The overall coverage in commit 01d37b6 in the claude/fix-fault-cle... branch remains at 57%, unchanged from commit 9983b79 in the main branch.


Updated August 01, 2026 21:55 UTC

Copilot AI 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.

Pull request overview

This PR fixes a flaky runtime faults test caused by parallel test execution sharing a global event broadcaster, where unrelated FaultCleared events from sibling tests could be incorrectly asserted against this test’s fault id.

Changes:

  • Make clear_fault_emits_fault_cleared_event only match FaultCleared events whose id equals the fault id created by the test (via a match guard).
  • Expand the in-test comment to accurately document why the id guard is necessary given parallel execution and a global sender.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@passcod
passcod marked this pull request as ready for review August 1, 2026 21:59
@passcod
passcod added this pull request to the merge queue Aug 1, 2026
Merged via the queue into main with commit a631fc5 Aug 1, 2026
15 checks passed
@passcod
passcod deleted the claude/fix-fault-cleared-test-race branch August 1, 2026 22:04
passcod pushed a commit that referenced this pull request Aug 1, 2026
Brings in restart accounting (#134), so wcr[restart.ownership] and
wcr[restart.record]'s references to r[autonomous.restart.record] and
r[autonomous.restart.rate] resolve within the branch, and the fault-cleared
test fix (#135).
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.

3 participants