Done
Details
Priority
MediumAssignee
Charles LangloisCharles LangloisReporter
Charles LangloisCharles LangloisFix versions
Details
Details
Priority
Assignee
Charles Langlois
Charles LangloisReporter
Charles Langlois
Charles LangloisFix versions
Zendesk Support
Zendesk Support
Zendesk Support
Created December 11, 2023 at 3:46 PM
Updated January 16, 2025 at 8:07 PM
Resolved January 16, 2025 at 8:06 PM
Given some CEL event(e.g.
WAZO_USER_MISSED_CALL
,WAZO_MEETING_NAME
,WAZO_CONFERENCE
) is missing the expectedextra
data needed to process it correctlyThen the event interpreter method silently returns
None
instead of returning the inputRawCallLog
objectThen the next event interpreter will be passed a
None
value for its inputcall_log
parameter, and will crash when accessing its attributesExpected the contract of each event interpreter to be consistent in its return types and input types
Expected event interpreters to be consistent and outspoken about error conditions that may prevent further processing
Details
https://github.com/wazo-platform/wazo-call-logd/blob/b59227ebf9b55b710b77e52e62d437ab2194ac59/wazo_call_logd/cel_interpretor.py#L382-L384
https://github.com/wazo-platform/wazo-call-logd/blob/b59227ebf9b55b710b77e52e62d437ab2194ac59/wazo_call_logd/cel_interpretor.py#L405-L407
https://github.com/wazo-platform/wazo-call-logd/blob/b59227ebf9b55b710b77e52e62d437ab2194ac59/wazo_call_logd/cel_interpretor.py#L392-L394
These event handler methods return nothing (
None
) when the cel is missing theextra
data expected.There is no exception being raised, and no logging documenting that this is an error condition.
https://github.com/wazo-platform/wazo-call-logd/blob/b59227ebf9b55b710b77e52e62d437ab2194ac59/wazo_call_logd/cel_interpretor.py#L179-L183
Since the
interpret_cels
method is calling each event handler with the return value of the previous one, the next event handler following each of these three handler may receive acall_log
argument that is aNone
value, which no handler expects and deal with.event handlers can be modeled as functions
RawCallLog -> RawCallLog
. In this model, either a handler should fail and raise, or return a validRawCallLog
value(which may be its undisturbed input)AbstractCELInterpretor.interpret_cels
can validate the output of each handler before passing it as input to the next handler, ensuring no handler receives invalid inputs. This is not necessary if we statically ensure each handler always return a validRawCallLog
(through type checking).If those three cases of missing
extra
data should be considered critical, and further processing would not be worth it, then they should raise an exception and interrupt the processing of this sequence of CEL. The calling code (generator.CallLogsgenerator.call_logs_from_cel
) can then expect and handle this failure