fix: outbox + thought save not transactional #14
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
ThoughtRepository::save()andOutboxWriter::append()each acquire their own DB connection. A crash between the two can lose the outbox event — the thought is persisted but the federation broadcast never fires.Acknowledged in
crates/worker/src/outbox_relay.rs:30.Fix approach
Requires sharing a transaction handle between repositories. Options:
&mut PgConnection(or aTransaction) through the use case into both reposUnitOfWork/TransactionalContextwrapperPgThoughtRepository::save()so both happen on the same connectionThis is an architectural change — each approach has trade-offs for the hexagonal boundary.