arshnah/detsim ? reverse-engineered prompt

Reverse engineered prompt

Build me a Go library for deterministic simulation testing, with a small command line app I can run to see it work.

I want a virtual time event driven simulator that can replay the exact same run from the same seed, plus a fake network that can drop, delay, and partition messages in a repeatable way. I also want a faulty storage layer that can simulate torn writes, corruption, dropped syncs, reordered syncs, and crashes that discard anything not durable yet.

Please include a couple of simple examples, one showing a Raft style cluster that can survive partitions and still never end up with two leaders in the same term, and another showing a tiny key value store where checksums matter under storage faults. It should be easy to run from the command line with a seed and trial count, and if a run fails I should be able to reproduce it exactly by rerunning the same seed. If you need to, look up current Go docs online for anything uncertain.