Currently it is possible to indirectly update the offsets in RecordCollectorImpl via the offset read function:
The offsets here is the a private final field in RecordCollectorImpl. It appears that the intent is for this field to be updated only when the producer acknowledges an offset. However, because it is handed back in a mutable form, it is possible to update offsets through this call, as actually happens today in StreamTask:
Here it is possible to set a new checkpoint if the topic partition is not already in the offsets map, which happens for the input topic when we're using optimized topologies and a KTable. The effect is that we continue to checkpoint the first offset seen (putIfAbsent).
It seems the correct behavior would be to return a read only view of the offsets from RecordCollectorImpl and create a copy of the returned map in activeTaskCheckpointableOffsets before we mutate it.