Skip to content

fix: distinct READ_ERROR status for non-missing-file read failures - #579

Open
bhuvan-somisetty wants to merge 1 commit into
ControlCore-Project:devfrom
bhuvan-somisetty:fix/read-status-generic-io-error
Open

bhuvan-somisetty wants to merge 1 commit into
ControlCore-Project:devfrom
bhuvan-somisetty:fix/read-status-generic-io-error

Conversation

@bhuvan-somisetty

Copy link
Copy Markdown

Fixes #578

read() in concore_base.py was reporting FILE_NOT_FOUND for any file read failure that wasn't actually a missing file, permission errors, trying to read a directory, a file that fails to decode, etc all fell into the generic except and got the same status. This made read_with_status() unreliable for telling callers why a read actually failed.

Changes:

  • generic file I/O failures (anything other than FileNotFoundError) now set last_read_status = "READ_ERROR" instead of FILE_NOT_FOUND
  • updated the read() docstring's status list to match, EMPTY_DATA was listed but nothing ever set it, so replaced it with READ_ERROR
  • added a regression test using a directory in place of the expected file to trigger a non FileNotFoundError failure, and checked the existing last_read_status test still reflects the real set of values

Scope is intentionally narrow, just the Python file based read path and its docstring/tests. No change to ZMQ handling, write(), or other language runtimes.

Verified with:
pytest tests/test_read_status.py tests/test_concore.py -v (all 64 tests pass)

read() was reporting FILE_NOT_FOUND for any file I/O error other than
FileNotFoundError, e.g. permission errors or reading a directory. This
made read_with_status() unreliable for telling callers why a read
actually failed.

Also removed EMPTY_DATA from the status docstring since nothing in the
file ever sets it.

Fixes ControlCore-Project#578
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.

1 participant