Skip to content

Add optional readiness checks to memory TcpClient#1134

Merged
bengineerd merged 7 commits into
pre-releasefrom
tcpclient-wait-ready
Mar 16, 2026
Merged

Add optional readiness checks to memory TcpClient#1134
bengineerd merged 7 commits into
pre-releasefrom
tcpclient-wait-ready

Conversation

@bengineerd

Copy link
Copy Markdown
Contributor

Description
This branch adds an explicit readiness-check capability to rogue.interfaces.memory.TcpClient and updates a few timing-sensitive tests to use it.

The main change is a lightweight built-in bridge probe between memory.TcpClient and memory.TcpServer. This allows a client to verify that the TCP memory request/response path is actually usable, rather than relying on fixed sleeps or local socket-connect assumptions.

What changed:

  • Added an internal memory bridge probe transaction type:
    • rim::TcpBridgeProbe
  • Updated memory.TcpServer to recognize and answer that probe locally
  • Added memory.TcpClient.waitReady(timeout, period)
  • Added waitReady as an optional TcpClient constructor flag
    • TcpClient(addr, port, waitReady=False)
    • when waitReady=True, managed _start() blocks on bridge readiness
  • Kept the default behavior backward-compatible
    • if waitReady is not enabled, startup behavior is unchanged

Tests updated:

  • tests/test_enum.py
  • tests/test_epics.py

These now use TcpClient(..., waitReady=True) instead of fixed startup sleeps or external readiness wrappers.

Docs updated:

  • docs/src/pyrogue_tree/node/device/index.rst

Important compatibility note:

  • The new readiness probe is opt-in
  • existing code paths remain unchanged by default
  • mixed-version use with an older TcpServer is only affected if the new readiness probe is explicitly enabled

This branch also includes a short-lived exploration of broader managed interface readiness, but the final implementation intentionally keeps the scope focused on TcpClient readiness rather than introducing a new generic PyRogue wrapper mechanism.

This commit introduces a new internal transaction type, TcpBridgeProbe, to facilitate readiness probing in the TcpClient and TcpServer classes. The TcpClient now includes a waitReady method that verifies the request/response path is operational before proceeding. Additionally, the constructor of TcpClient has been updated to accept a waitReady parameter, allowing for optional blocking during startup. The TcpServer has been modified to handle the TcpBridgeProbe locally, ensuring proper acknowledgment of readiness. Tests have been updated to reflect these changes.
@bengineerd bengineerd requested a review from slacrherbst March 10, 2026 19:01
This commit introduces a new start method in the TcpServer class, which serves as a managed-lifecycle startup hook. Although the server binds and starts its worker thread in the constructor, this method allows TcpServer to participate uniformly in PyRogue's managed interface lifecycle handling. The setup_python function has been updated to expose this new method to Python.
… return values; remove unnecessary blank lines in test files
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 29.59%. Comparing base (455967d) to head (10b4279).
⚠️ Report is 788 commits behind head on pre-release.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@               Coverage Diff               @@
##           pre-release    #1134      +/-   ##
===============================================
+ Coverage        29.54%   29.59%   +0.04%     
===============================================
  Files               65       68       +3     
  Lines             6644     6944     +300     
  Branches          1015      969      -46     
===============================================
+ Hits              1963     2055      +92     
- Misses            4527     4736     +209     
+ Partials           154      153       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bengineerd bengineerd marked this pull request as ready for review March 12, 2026 03:54
@bengineerd bengineerd merged commit 2319af9 into pre-release Mar 16, 2026
6 checks passed
@bengineerd bengineerd deleted the tcpclient-wait-ready branch March 16, 2026 19:32
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