rubyforgood / human-essentials

Human Essentials is an inventory management system for diaper, incontinence, and period-supply banks. It supports them in distributing to partners, tracking inventory, and reporting stats and analytics.
https://humanessentials.app
MIT License
464 stars 493 forks source link

Document event sourcing #4238

Closed dorner closed 7 months ago

dorner commented 7 months ago

Summary

Protect against the bus factor by documenting how event sourcing works (as well as comparing what happens with and without the flag).

Things to consider

No response

Criteria for Completion

No response

dorner commented 7 months ago

Wiki page has been added: https://github.com/rubyforgood/human-essentials/wiki/Event-Sourcing

cc: @awwaiid @cielf @scooter-dangle Please let me know if there are any comments or questions.

cielf commented 7 months ago

@dorner What might cause an error in the rerunning of the events?

dorner commented 7 months ago

Really the only thing that should be possible is if business logic changed in between when the event first was created and now. Assuming we are not allowing "bad" events to be added live (which is what the events_read flag does), there theoretically shouldn't be a case where an event worked and then stopped working.

Of course there's plenty of "unknown unknowns" when it comes to errors 😁

cielf commented 7 months ago

What constitutes a "bad" event?

dorner commented 7 months ago

One that shouldn't be let through - usually because there isn't enough inventory to process it.