Skip to content

test(internal): synchronize stop callback before checking side effects - #89

Merged
benbenbang merged 1 commit into
mainfrom
fix/mcp-stop-test
Oct 11, 2026
Merged

benbenbang merged 1 commit into
mainfrom
fix/mcp-stop-test

Conversation

@benbenbang

Copy link
Copy Markdown
Member

The MCP management test previously treated a stop acknowledgement as proof
that the deferred callback had finished, which allowed the assertion on the
stop counter to race against the callback's completion.

Test Synchronization Improvements:

  • Added a cancellation gate that blocks the stop callback until the test
    explicitly releases it, forcing the acknowledgement to arrive before the
    callback increments the counter.
  • Released the gate and joined the HTTP handlers via server.Close() before
    inspecting cancellation side effects, ensuring the deferred callback has
    run.
  • Replaced the inline authenticated && stops.Load() != 1 check with an
    explicit wantStops expectation, making the intended stop count clear for
    both authenticated and unauthenticated cases.

The MCP management test previously treated a stop acknowledgement as proof
that the deferred callback had finished, which allowed the assertion on the
stop counter to race against the callback's completion.

**Test Synchronization Improvements:**
* Added a cancellation gate that blocks the stop callback until the test
  explicitly releases it, forcing the acknowledgement to arrive before the
  callback increments the counter.
* Released the gate and joined the HTTP handlers via `server.Close()` before
  inspecting cancellation side effects, ensuring the deferred callback has
  run.
* Replaced the inline `authenticated && stops.Load() != 1` check with an
  explicit `wantStops` expectation, making the intended stop count clear for
  both authenticated and unauthenticated cases.
@benbenbang
benbenbang enabled auto-merge (squash) October 11, 2026 08:25
@benbenbang
benbenbang merged commit 83be2a8 into main Oct 11, 2026
5 checks passed
@benbenbang
benbenbang deleted the fix/mcp-stop-test branch October 11, 2026 08:26
@ptah-bw-technical-app

Copy link
Copy Markdown

🎉 This PR is included in version 1.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant