Skip to content

Conversation

@GaneshPatil7517
Copy link

@GaneshPatil7517 GaneshPatil7517 commented Feb 11, 2026

hey @pradeeban

Summary

Fixes #244 - ZMQ write() does not prepend simtime, breaking mixed ZMQ/file-based studies.

Problem

The write() function had inconsistent behavior between ZMQ and file-based paths:

  • File path: Correctly prepends [simtime + delta] before writing
  • ZMQ path: Sent raw val without simtime prefix

Since read() always expects inval[0] to be simtime, this caused:

  • Data corruption in mixed topologies (ZMQ writer → file reader or vice versa)
  • First data value incorrectly interpreted as simtime
  • One fewer element returned than expected
  • Silent wrong results

Solution

Modified the ZMQ write path to prepend simtime + delta to list payloads, matching file-based write behavior:

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**
[concore.py](vscode-file://vscode-app/c:/Users/HP/AppData/Local/Programs/Microsoft%20VS%20Code/591199df40/resources/app/out/vs/code/electron-browser/workbench/workbench.html): Prepend simtime to ZMQ list payloads in [write()](vscode-file://vscode-app/c:/Users/HP/AppData/Local/Programs/Microsoft%20VS%20Code/591199df40/resources/app/out/vs/code/electron-browser/workbench/workbench.html)

[test_concore.py](vscode-file://vscode-app/c:/Users/HP/AppData/Local/Programs/Microsoft%20VS%20Code/591199df40/resources/app/out/vs/code/electron-browser/workbench/workbench.html): Updated test to expect simtime prefix

Testing
All 25 unit tests pass
Maintains backward compatibility for non-list ZMQ payloads
Preserves existing retry logic and error handling

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

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.

…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
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.

2 participants