• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

azmaveth / ex_mcp / bde822a85c937c0d7ad736eae05dbe5c9eef5fa6
65%

Build:
DEFAULT BRANCH: master
Ran 05 Jun 2026 02:57PM UTC
Jobs 1
Files 258
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

05 Jun 2026 02:55PM UTC coverage: 8.962% (-0.004%) from 8.966%
bde822a85c937c0d7ad736eae05dbe5c9eef5fa6

push

github

azmaveth
test(client): make 'transport closure in ready' test telemetry-driven

Replaces a fixed-sleep + state-poll pattern that flaked under CI load
(`:disconnected` instead of `:ready` at the assertion point) with a
telemetry-subscription pattern that waits for the actual state
transition events the state machine already emits.

## What changed

1. **`Arbor.LLM.Client.StateMachine` emits `pid: self()` in the
   `[:ex_mcp, :client, :state_transition]` telemetry metadata** so
   async tests with multiple state machines can filter events to
   their own client. Other handlers ignore the extra key.

2. **`TestTransport.respond_to_handshake/2` polls internally** for
   the handshake request to arrive at the test transport. Previously
   it failed immediately with `{:error, :no_messages}` if called
   between the `:enter :handshaking` callback and the asynchronous
   `:start_handshake_internal` message that actually sends the
   request. New default 2s window (configurable) covers CPU-busy CI
   runners.

3. **The failing test subscribes to state-transition telemetry**
   (`attach_state_transition_listener/1` helper at the bottom of the
   module) and uses `assert_receive` instead of `Process.sleep` +
   `StateMachine.get_state`. The handler filters by `metadata[:pid]`
   so async tests don't see each other's transitions. Auto-detaches
   on test exit.

4. **The final assertion matches `from_state: :ready`** to pick the
   transition triggered BY the transport closure, not earlier
   transitions that `assert_receive` left in the mailbox during the
   handshake flow.

## Why this commit only touches one test

The same `Process.sleep(N) + assert state.state == X` pattern shows
up 25 more times in this file. The pattern is timing-sensitive and
is the right shape to migrate eventually. This commit establishes
the pattern (helper, telemetry pid, polling respond_to_handshake)
on the one test that actually failed CI — leaving the rest as a
focused follow-up rather than r... (continued)

0 of 9 new or added lines in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

1434 of 16001 relevant lines covered (8.96%)

5.85 hits per line

Uncovered Changes

Lines Coverage ∆ File
9
0.0
0.0% test/support/test_transport.ex

Coverage Regressions

Lines Coverage ∆ File
1
0.0
0.0% lib/ex_mcp/client/state_machine.ex
Jobs
ID Job ID Ran Files Coverage
1 bde822a85c937c0d7ad736eae05dbe5c9eef5fa6.1 05 Jun 2026 02:57PM UTC 258
8.96
GitHub Action Run
Source Files on build bde822a85c937c0d7ad736eae05dbe5c9eef5fa6
  • Tree
  • List 258
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • bde822a8 on github
  • Prev Build on master (#60DEB227...)
  • Next Build on master (#9A4B0411...)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc