fix: preserve unmanaged first-seen timestamps

Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-09-12 13:33:05 +00:00
committed by GitHub
co-authored by genichin
parent be2e73a2d6
commit f9284d1de8
4 changed files with 49 additions and 4 deletions
@@ -58,11 +58,11 @@ class PostgreSQLUnmanagedPositionStore:
cur.execute(
"UPDATE unmanaged_position_state "
"SET quantity = %s, lifecycle_state = 'active', "
" first_seen_at = %s, last_seen_at = %s, quantity_changed_at = %s, "
" resolved_at = NULL, updated_at = %s "
" last_seen_at = %s, quantity_changed_at = %s, resolved_at = NULL, "
" updated_at = %s "
"WHERE instance_key = %s AND symbol = %s "
f"RETURNING {_STATE_COLUMNS}",
(quantity, now, now, now, now, instance_key, symbol),
(quantity, now, now, now, instance_key, symbol),
)
elif int(previous["quantity"]) != int(quantity):
transition = "quantity_changed"