You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor: extract shared transaction helper from duplicated runReservationTransaction/runEpicTransaction #121
Both are byte-for-byte identical in logic: committed flag, deferred rollback guarded with sql.ErrTxDone, and errors.Join for error aggregation. The duplication was intentional — the spec (design.md) scoped work as per-package correctness without cross-cutting refactors.
Proposed Change
Extract a shared helper into internal/db, e.g.:
// RunTransaction executes work within a transaction lifecycle.// It calls commit on success and ensures rollback is called exactly// once on failure, guarding against sql.ErrTxDone.funcRunTransaction(work, commit, rollbackfunc() error) error
Then replace both package-local copies with calls to db.RunTransaction.
Acceptance Criteria
Shared helper exists in internal/db
internal/comms/reservation.go uses the shared helper
internal/org/epic.go uses the shared helper
Existing tests for both packages continue to pass
Shared helper has its own unit tests in internal/db
No third copy of this pattern exists in the codebase
Activity