stateflow-conflation-inverts-state

Installation
SKILL.md

Conflation makes write order a correctness question

MutableStateFlow holds exactly one value. Take the compiled class apart and there is a single volatile state field and a sequence counter — no per-write buffer — and collect allocates a slot and then re-reads that one field. So a collector on another thread observes whatever is in the slot when it wakes, and every value written in between is simply gone.

That is fine for a state holder written once per event. It is a correctness bug the moment one callback writes it more than once, because the last write becomes the published truth regardless of which write was right:

Installs
2
GitHub Stars
35
First Seen
6 days ago
stateflow-conflation-inverts-state — maxrave-dev/kotlin-footguns