forked from HAL9000/cleveragents-core
9e93ea5fc6
Add missing `finally: if self._auto_commit: session.close()` blocks to all four public session-creating methods in `AutomationProfileRepository`: `get_by_name()`, `list_all()`, `upsert()`, and `delete()`. Without these blocks, sessions were never closed when the repository operated in auto_commit mode, causing a slow session leak that could exhaust the connection pool over time. The fix mirrors the pattern already used by `SessionRepository`, which correctly closes its session in a `finally` block for every public method. Removed the `@tdd_expected_fail` tag from the TDD test (`tdd_automation_profile_session_leak.feature`) so the six scenarios now run as normal regression tests (four original plus two new scenarios for `get_by_name` and `list_all`). ISSUES CLOSED: #987