Skip to content

Fix: Prepend simtime to ZMQ write() payload for consistency (Issue #244)#258

Merged
pradeeban merged 1 commit into
ControlCore-Project:devfrom
GaneshPatil7517:fix/issue-244-zmq-simtime
Feb 11, 2026
Merged

Fix: Prepend simtime to ZMQ write() payload for consistency (Issue #244)#258
pradeeban merged 1 commit into
ControlCore-Project:devfrom
GaneshPatil7517:fix/issue-244-zmq-simtime

Conversation

@GaneshPatil7517
Copy link
Copy Markdown
Contributor

@GaneshPatil7517 GaneshPatil7517 commented Feb 11, 2026

Hey pradeeban,

Fixes #244.

The write() function behaved differently for ZMQ and file-based communication.

In the file-based path, [simtime + delta] is prepended before writing the data.
But in the ZMQ path, the value was sent directly without the simtime prefix.

Since read() always expects the first element (inval[0]) to be simtime, this caused problems in mixed setups where one component uses ZMQ and another uses file-based communication. In those cases the first data value could be interpreted as simtime, resulting in incorrect data and one fewer value being returned.

To fix this, the ZMQ write path now prepends simtime + delta to list payloads so that it behaves the same as the file-based implementation.

Updated logic:

if isinstance(zmq_val, list):
payload = [simtime + delta] + zmq_val
zmq_p.send_json_with_retry(payload)
simtime += delta
else:
zmq_p.send_json_with_retry(zmq_val)

Changes in this PR:

  • concore.py – prepend simtime to ZMQ list payloads in write()
  • test_concore.py – updated test to expect the simtime prefix

Testing:

  • All 25 unit tests pass locally
  • Non-list ZMQ payloads remain unchanged for backward compatibility
  • Existing retry logic and error handling are preserved

Copilot AI review requested due to automatic review settings February 11, 2026 20:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes inconsistency between file-based and ZMQ-based concore.write() by adding a simtime prefix to ZMQ list payloads, addressing Issue #244 where mixed ZMQ/file studies could misinterpret the first data element as simtime.

Changes:

  • Prepend [simtime + delta] to ZMQ list payloads in concore.write() to match file write behavior.
  • Update the ZMQ write unit test to expect the simtime-prefixed payload.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
concore.py Adjusts ZMQ write() to prefix simtime for list payloads (aligning with file output format).
tests/test_concore.py Updates test expectations to include simtime prefix in the ZMQ send payload.

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

Comment thread concore.py
Comment thread concore.py
Comment thread tests/test_concore.py
…ntrolCore-Project#244)

- ZMQ write now prepends [simtime + delta] to match file-based write behavior
- ZMQ read now strips simtime prefix (mirroring file-based read behavior)
- Updated docstring to clarify val is data-only
- Added round-trip test to verify write+read returns original data
@GaneshPatil7517 GaneshPatil7517 force-pushed the fix/issue-244-zmq-simtime branch from a8009fa to 0e49e15 Compare February 11, 2026 20:18
@pradeeban
Copy link
Copy Markdown
Member

/gemini review

@pradeeban pradeeban merged commit 9ecefc0 into ControlCore-Project:dev Feb 11, 2026
6 checks passed
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