A small module builds a short badge preview for a contact card. After a recent change, the results started depending on previous calls and sometimes include extra elements.
ContactBadgePreview stores badge history only within a single instance.build(labels) method:
labels;strip() to the history;"badge:<value>" in the same order.recent() method returns a copy of the instance’s current history.python demo.py
ContactBadgePreview instances.recent() does not change internal state.build() returns only badges built from the input data of the current call.3.12python demo.pylabels is a regular list[str]Use line comments to explain the problem, its impact, the fix and how to test it.