This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
"Non-overlapping container check" type error in BulkPushRuleEvaluator
#14450
Labels
A-Push
Issues related to push/notifications
O-Uncommon
Most users are unlikely to come across this or unexpected workflow
T-Task
Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Running mypy with strict equality checking (via
mypy --strict-equality
) we get the following error:It points to this piece of code:
synapse/synapse/push/bulk_push_rule_evaluator.py
Lines 379 to 382 in 2d0ba3f
The complaint is that
actions
is defined as aCollection[dict]
:synapse/stubs/synapse/synapse_rust/push.pyi
Lines 45 to 50 in 2d0ba3f
thus
if "notify" in actions:
makes no sense, hence mypy's complaint.The code that actually produces the data structure is in Rust, and returns a vector of
Action
s (which is an Enum):synapse/rust/src/push/evaluator.rs
Lines 90 to 103 in 2d0ba3f
synapse/rust/src/push/mod.rs
Lines 163 to 172 in 2d0ba3f
Following the definition of
Action
, we see that this should result in a vector of str when sent to python:synapse/rust/src/push/mod.rs
Lines 208 to 221 in 2d0ba3f
Assuming my Rust->Python foo is sound (please double-check!), my conclusion here is that the type stub is incorrect, and that we should instead have a
Collection[str]
when we reach Python.I don't believe this has any user-visible impact. Fixing this would just reduce the number of mypy errors (and potentially prevent future bugs!).
The text was updated successfully, but these errors were encountered: