Silent data-loss bug fixed in Zulip's Microsoft Teams importer before it struck
A developer contributing to Zulip, an open-source team chat server, identified a subtle batching bug in its Microsoft Teams data importer that had never triggered an error in production. The flaw involved a Python generator that yielded a shared list object, then called `.clear()` on it before the next batch, meaning any consumer retaining multiple batches would silently receive the same overwritten list. In a test dataset, this caused the total message count to collapse from 29 to 24 with no exception raised. The fix, submitted as pull request zulip/zulip#39814, replaces the clear-and-refill approach with a fresh list per batch, matching the contract used by the standard library's own `itertools.batched`. A regression test was also added to catch the data-loss scenario with a concrete assertion.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in