8000 test(bench): assert the worker join, not just the taken handle by 0-jake-0 · Pull Request #847 · wingfoil-io/wingfoil · GitHub
[go: up one dir, main page]

Skip to content

test(bench): assert the worker join, not just the taken handle - #847

Merged
0-jake-0 merged 1 commit into
mainfrom
claude/bencher-join-test-guard
Aug 15, 2026
Merged

0-jake-0 merged 1 commit into
mainfrom
claude/bencher-join-test-guard

Conversation

@0-jake-0
Copy link
Copy Markdown
Contributor

What this changes

Adds one assertion to stop_joins_worker_and_treats_kill_as_clean_shutdown so
it actually guards the join that gives it its name.

Why

Follow-up to #845 (merged), which was correct — this is a gap in its test, not
in its fix.

The test asserted bencher.worker.is_none() and that the signal stayed Kill.
Both hold as soon as the handle is taken, whether or not it is joined, so the
Kill half of #845 was guarded and the join half was not. Verified by mutation
on the merged commit:

Mutation Test result
Remove the Kill early-return in the worker FAILS (guarded)
Replace the join with let _ = self.worker.take(); PASSES (unguarded)

Arc::strong_count(&bencher.signal) == 1 closes it. The worker holds its own
clones of signal — the trigger's and the sink's — which drop with its stack,
so the caller owning the last reference is observable only once the thread has
genuinely finished.

How it was verified

  • cargo fmt --all
  • cargo lint (via the pre-commit hook — workspace, --all-targets)
  • cargo test -p wingfoil --lib --features bench (87 passed)
  • cargo test -p wingfoil --all-features (not run: needs protoc; CI covers it)
  • New behaviour is covered by a test — this PR is the test

Mutation-checked both ways, which is the point of the change: the new assertion
passes 5/5 runs with the join in place and fails 8/8 with the join removed.

Notes for the reviewer

One deliberate non-goal: Bencher still has no Drop, so if criterion panics
between start() and stop() the ALWAYS-activated worker keeps spinning a
core for the life of the process. That is pre-existing rather than introduced by
#845, and it is a behaviour change rather than a test fix, so it is left out of
this PR. Happy to open it separately if wanted.


Generated by Claude Code

`stop_joins_worker_and_treats_kill_as_clean_shutdown` guarded the `Kill`
half of #845 but not the join it is named for: replacing the join with a
bare `self.worker.take()` left the test passing, because taking the handle
already satisfies both of its assertions.

Assert `Arc::strong_count(&bencher.signal) == 1` instead. The worker holds
its own clones of `signal` (the trigger's and the sink's), which drop with
its stack, so the caller owning the last reference is observable only once
the thread has actually finished.

Verified by mutation: passes with the join, fails without it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016uTUQ2a6B1Hscropr8rvt6
@0-jake-0 0-jake-0 mentioned this pull request Aug 15, 2026
5 of 8 tasks
@0-jake-0
0-jake-0 merged commit 15117d0 into main Aug 15, 2026
7 checks passed
@0-jake-0
0-jake-0 deleted the claude/bencher-join-test-guard branch August 15, 2026 22:54
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.

2 participants

0