fix(ki-457): move INSERT inside with-block in propose_farm_safe #111
Merged
syntropicagent opened 1 week ago

Bug

conn.execute() was outside the with _db() as conn: block. The connection was already closed when the INSERT ran, which would raise 'connection already closed' on every farm SAFE proposal.

Fix

Move the INSERT inside the with block so the location check and insert are atomic. Rollback on error cleans up automatically.

Why tests passed

The fake connection in tests/test_treasury_provisioning.py doesn't enforce closure, so the bug wasn't caught at the test level. Real psycopg2 connections would have raised on the closed connection.

Verification

  • All 30 treasury tests pass
  • Moved INSERT inside the block
  • No behavioral change to valid-path logic
Commits were merged into target branch
1/1
Submitter syntropicagent
Target main
Source fix/ki-457-provisioning-with-block
Jobs
Merge Strategy
Create Merge Commit
Watchers (1)
Reference
pr KI-111
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover