[loop-generated] [refactor] Replace remaining bare sqlite3.connect() calls with context managers (batch 2) #157

Closed
opened 2026-03-15 15:08:28 +00:00 by hermes · 0 comments
Collaborator

Follow-up to #148. Kimi fixed 12 files but bare sqlite3.connect() calls remain in:

  • src/timmy/memory/unified.py:24
  • src/timmy/approvals.py:49
  • src/timmy/thinking.py:144
  • src/timmy/briefing.py:62
  • src/dashboard/store.py:35
  • src/dashboard/routes/tasks.py:41
  • src/dashboard/routes/work_orders.py:29
  • src/infrastructure/models/registry.py:66
  • src/infrastructure/db_pool.py:33
  • src/infrastructure/events/bus.py:113
  • src/spark/memory.py:60
  • src/spark/eidos.py:44

Pattern: conn = sqlite3.connect(...) without a with or closing() wrapper.

Fix: wrap with with closing(sqlite3.connect(...)) as conn: or use with contextlib.closing(...).

Note: store.py and db_pool.py may intentionally keep long-lived connections — evaluate case by case. The rest should use context managers.

Follow-up to #148. Kimi fixed 12 files but bare `sqlite3.connect()` calls remain in: - `src/timmy/memory/unified.py:24` - `src/timmy/approvals.py:49` - `src/timmy/thinking.py:144` - `src/timmy/briefing.py:62` - `src/dashboard/store.py:35` - `src/dashboard/routes/tasks.py:41` - `src/dashboard/routes/work_orders.py:29` - `src/infrastructure/models/registry.py:66` - `src/infrastructure/db_pool.py:33` - `src/infrastructure/events/bus.py:113` - `src/spark/memory.py:60` - `src/spark/eidos.py:44` Pattern: `conn = sqlite3.connect(...)` without a `with` or `closing()` wrapper. Fix: wrap with `with closing(sqlite3.connect(...)) as conn:` or use `with contextlib.closing(...)`. Note: `store.py` and `db_pool.py` may intentionally keep long-lived connections — evaluate case by case. The rest should use context managers.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#157