Currently the EnvironmentResponse class contained a boolean initialized field and a string error_message field, the combination of whic is used to determine what action is taken during WorkerDispatcher initialization. At the moment this decision is spread across multiple lines and is not immediately clear on what the acceptable/valid states are without detailed knowledge of the class. The correct interpretation should be as follows:
| |
initialized=True |
initialized=False |
error_message is None |
Return |
Block until next poll |
error_message is not None |
Undefined |
Raise |
This should be encapsulated in e.g. a dedicated enum field so that he logic is fixed and can be interpreted based on an explicit set of possibilities
Acceptance Criteria
- The
EnvironmentResponse class contains a single field that encapsulates the interpretation logic described as known states which can be directly compared
- The new field is updated automatically by the class when the state of its constituent parts changes
- The affected interpretations of the class have been migrated to use the new field
- Tests have been provided to validate the behaviour for eaxh allowed state of the field
Currently the
EnvironmentResponseclass contained a booleaninitializedfield and a stringerror_messagefield, the combination of whic is used to determine what action is taken duringWorkerDispatcherinitialization. At the moment this decision is spread across multiple lines and is not immediately clear on what the acceptable/valid states are without detailed knowledge of the class. The correct interpretation should be as follows:initialized=Trueinitialized=Falseerror_message is Noneerror_message is not NoneThis should be encapsulated in e.g. a dedicated
enumfield so that he logic is fixed and can be interpreted based on an explicit set of possibilitiesAcceptance Criteria
EnvironmentResponseclass contains a single field that encapsulates the interpretation logic described as known states which can be directly compared