The support team uses a small module to build a list of available notification channels and actions for each channel. After a recent change, the results started depending on the order of calls: the same operations on independent objects begin to affect each other, and the generated actions sometimes refer to the wrong channel.
ChannelRoster stores its own list of channels for each instance.add_channel(name) method adds a channel to the current instance and does not change the state of other instances.channel_actions() method returns a list of functions.channel_actions() when called must return a string of the form "open:<channel_name>" specifically for its own channel.channels.from notifications import ChannelRoster
primary = ChannelRoster()
primary.add_channel("email")
secondary = ChannelRoster()
print(primary.channels)
print(secondary.channels)
roster = ChannelRoster(["email", "sms", "push"])
actions = roster.channel_actions()
print([action() for action in actions])
channels list should remain empty if nothing was added to it.["open:email", "open:sms", "open:push"]
CPython 3.12notifications.pyUse line comments to explain the problem, its impact, the fix and how to test it.