Fix: Add explicit error signalling to read() instead of silent default fallback (#390)#462
Open
GaneshPatil7517 wants to merge 1 commit intoControlCore-Project:devfrom
Open
Conversation
read() now returns (data, success_flag) tuple and sets concore.last_read_status / concore_base.last_read_status to one of: SUCCESS, FILE_NOT_FOUND, TIMEOUT, PARSE_ERROR, EMPTY_DATA, RETRIES_EXCEEDED. - concore_base.read(): all return paths now yield (data, bool) - concore.py: exposes last_read_status, syncs from concore_base - concoredocker.py: same treatment - Existing tests updated for tuple returns - New test_read_status.py covers success, file-not-found, parse error, retries exceeded, ZMQ success/timeout/error, backward compatibility, and last_read_status exposure. Backward compatible: callers can use isinstance(result, tuple) or simply unpack with value, ok = concore.read(...).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hello @pradeeban Sir
Problem
read()silently returned default values on all failure paths (file not found,parse error, empty file, timeout, retry exhaustion, ZMQ failure), with no mechanism
for downstream nodes to detect whether they received real data or stale fallback values.
This is a safety concern in neuromodulation control loops.
Solution
read()now returns(data, success_flag)on every code path:True→ real data was successfully receivedFalse→ fallback/default value was usedAdditionally,
concore.last_read_status(andconcore_base.last_read_status) isset after each read to one of:
SUCCESS,FILE_NOT_FOUND,TIMEOUT,PARSE_ERROR,EMPTY_DATA,RETRIES_EXCEEDEDExample usage
Backward Compatibility
Files Changed
Impact
Improves reliability and safety of control loops by allowing controllers to detect invalid reads.