mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 14:00:37 +00:00
The third audit-log consumer was written for a single case: the list of event names that feed it lived in the producer, and the rule itself (which props carry the team id, how a team is marked dirty) lived in the transport that drains the queues. Every new case meant touching the producer, the transport and the metric. The transport keeps only what is generic (the queues, the drain, the housekeeping, the metrics) and the rules move to a registry of reactions, one per domain. The team-storage rule moves to the domain that owns its table (app.tasks.team-storage) and becomes a reaction: the event names it cares about, the flag that turns it on and the function that marks the teams dirty. The registry and the dispatch live in the new app.tasks.event-consumer. A reaction receives the whole batch of events it declares, so marking the teams dirty is one write per batch and not one write per event. No behavior change: the same events queue, the same teams get marked and the same metrics are recorded. The view of a row that a reaction sees carries the row id, so a reaction can correlate what it did with the row it came from; the id does not travel to the archives. AI-assisted-by: minimax-m3.1-flash