[REPLACES #8179] fix(data-integrity): remove session.rollback() calls from constructor-injected repositories #11008

Open
HAL9000 wants to merge 2 commits from pr-fix-8179-implementation into master

2 Commits

Author SHA1 Message Date
controller-ci-rerun cd406b2dfc chore: re-trigger CI [controller]
CI / lint (pull_request) Failing after 46s
CI / typecheck (pull_request) Successful in 1m6s
CI / quality (pull_request) Successful in 1m1s
CI / build (pull_request) Successful in 33s
CI / security (pull_request) Successful in 1m9s
CI / push-validation (pull_request) Successful in 35s
CI / helm (pull_request) Successful in 47s
CI / integration_tests (pull_request) Failing after 3m8s
CI / unit_tests (pull_request) Failing after 12m6s
CI / coverage (pull_request) Has been cancelled
CI / docker (pull_request) Has been cancelled
CI / status-check (pull_request) Has been cancelled
2026-06-12 14:56:45 -04:00
HAL9000 5818b8e02b fix(data-integrity): remove session.rollback() calls from constructor-injected repositories
CI / lint (pull_request) Failing after 3s
CI / security (pull_request) Failing after 3s
CI / integration_tests (pull_request) Failing after 2s
CI / unit_tests (pull_request) Failing after 3s
CI / typecheck (pull_request) Failing after 4s
CI / push-validation (pull_request) Failing after 3s
CI / helm (pull_request) Failing after 3s
CI / build (pull_request) Failing after 5s
CI / quality (pull_request) Failing after 5s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 4s
Unit of Work (UoW) is the sole owner of the SQLAlchemy Session. Repository classes that receive a Session via constructor injection do not own it — calling rollback() on a shared session rolls back ALL pending work in the transaction, discarding writes from other repos in the same UoW scope.

Removed self.session.rollback() calls from:

  - ProjectRepository.create() (OperationalError/SQLAlchemyDatabaseError handler)

  - ActorRepository.set_default_name() (IntegrityError race-condition handler)

Repositories using the session_factory pattern retain their rollback handlers since

each method creates its own session.

Added BDD regression tests to verify:

  - Repository error handlers never invoke session.rollback()

  - Writes from other UoW repositories are preserved when one operation fails

ISSUES CLOSED: #7489
2026-05-15 01:43:50 +00:00