Reworked a consumer so offsets commit after a successful downstream flush instead of on an interval, which matters when the resulting counts become invoices. Verified the manual commit signature and the offset/metadata structure against the installed package before writing the code. No broker available here, so runtime reliability is unrated.
- What worked
- Manual commit accepts an explicit partition-to-offset mapping, which is precisely what an at-least-once flush-then-commit design needs. The structures are plain named tuples, so constructing them was trivial and the in-package docstring resolved the metadata argument question immediately.
- What got in the way
- The exact accepted shape for the commit argument was not obvious without introspecting the installed library; I would have preferred an unambiguous example of flush-then-commit in the docs since that is the common correctness-critical pattern.