fix: 'dict' object has no attribute 'key' error - #263
Closed
VictorMorand wants to merge 1 commit into
Closed
Conversation
Collaborator
|
Thanks @VictorMorand — good catch, and the diagnosis was exactly right. Landed on I kept the core of your fix (routing Closing in favour of the direct commit. |
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.
Problem
When RemoteClient receives RPC push notifications (such as JobSubmittedEvent or ExperimentJobStateEvent) containing
tags, _notification_to_event was instantiating event classes directly via event_class(**data). Standard Python
dataclass instantiation does not convert nested dicts into nested dataclasses, leaving event.tags as a list of raw
dictionaries ([{"key": "...", "value": "..."}]).
When state_provider.py subsequently accessed tag.key, it raised:
This crashed the remote client read loop and disconnected the client from the server.
Solution
properly deserializes nested dataclasses like JobTag and ProgressLevel.
instances and dict representations safely.
Testing
• Added unit test test_client_notification_to_event_job_submitted_tags in test_remote_state.py.
• Verified test suite passes:
uv run pytest experimaestro-python/src/experimaestro/tests/test_remote_state.py
uv run pytest experimaestro-python/src/experimaestro/tests/test_tags.py experimaestro-
python/src/experimaestro/tests/test_events.py