Fix the impact check for a timezone default change
Your task
An AI agent changed the default timezone in your shared formatTimestamp utility to fix one customer's display bug. Over 40 modules import that utility, and the test suite passing tells you little, because most tests never pin a zone. So your team lists each consumer and checks which ones the new default moves.
An assistant wrote consumers_broken_by_default_change(consumer_lines, new_default_zone). It is in the editor. It has a bug. Find it and fix it.
Input and output:
consumer_lines: one line per consumer, writtenmodule|required_zone|binding.required_zoneis the zone the module's output must be in.bindingsays how the module gets its zone:explicitwhen it passes a zone itself.new_default_zone: the utility's new default zone, such asAmerica/Los_Angeles.- Return the names of the modules the change breaks, each once, sorted.
Rules the tests check:
- Split each line on
|. Skip a line with fewer than 3 parts. Only the first 3 parts are used. Trim whitespace from both ends of each part and ofnew_default_zone. - Skip a line whose module name is empty.
- A consumer whose binding is
explicit, in any case, passes its own zone and is never broken. - Any other binding, including
default, an empty one or any other word, means the consumer uses the utility's default zone. - A consumer that uses the default is broken when its required zone differs from the new default zone. Zones compare without regard to case.
- Return each broken module name once, sorted as plain strings in ascending order.
Examples
consumers_broken_by_default_change(consumer_lines: list[str], new_default_zone: str) -> list[str]Example 1
Input
consumers_broken_by_default_change(["billing|UTC|default", "notifications|America/New_York|explicit", "audit_log|UTC|default", "analytics|UTC|explicit"], "America/Los_Angeles")Output
["audit_log", "billing"]Example 2
Input
consumers_broken_by_default_change(["billing|UTC|default", "notifications|America/New_York|explicit", "audit_log|UTC|default", "analytics|UTC|explicit"], "UTC")Output
[]Example 3
Input
consumers_broken_by_default_change(["support_inbox|America/New_York|default", "billing|UTC|default"], "America/New_York")Output
["billing"]