Make global confs immutable.
For better or worse, in this repo we depend a lot on the mergedeep
library. I personally find its API horrible, and there have been multiple instances in which we have shot ourselves in the foot (examples: !559 (comment 64045), !193 (comment 14507), also, see bugfix in this MR!). I tried replacing it with PEP 584, a builtin dict
merge mechanism (dict1 | dict2
) but quickly found that such mechanism only does shallow merges. There doesn't seem to be any good replacement for mergedeep
, thus we are stuck with it.
In this MR then, we try to avoid shooting ourselves in the foot by using Python's MappingProxyType
, which wraps a dict
in an immutable view. We apply this mechanism to all the global confs that we use today. We also suggest what variable are not to be consumed externally using Python's convention of using _
as first char of a variable to convey an equivalent of Java's private
.
Additionally, we fix a couple of bugs were we inadvertently mutated the global config!
Bug: T325014