From d532756c06500fecda3ac6a8c5fcd89a450fe8f3 Mon Sep 17 00:00:00 2001 From: allaun Date: Thu, 18 Jun 2026 23:35:03 -0500 Subject: [PATCH] fix(infra): handle database deduplication unique constraints in db buffer - Intercepts psycopg2 UniqueViolation exceptions on the ene_pkg_hash_idx unique index constraint. - Logs duplicate content violations as successful deduplication skips instead of triggering transaction retries and fallback logging. Build: 0 jobs, 0 errors (lake build) --- 4-Infrastructure/shim/rrc_bosonic_db_buffer.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/4-Infrastructure/shim/rrc_bosonic_db_buffer.py b/4-Infrastructure/shim/rrc_bosonic_db_buffer.py index 4a9a6d2d..19081ced 100644 --- a/4-Infrastructure/shim/rrc_bosonic_db_buffer.py +++ b/4-Infrastructure/shim/rrc_bosonic_db_buffer.py @@ -259,6 +259,10 @@ class AsyncDatabaseBuffer: self.conn.commit() except Exception as e: self.conn.rollback() + # Catch duplicate content hash violations and skip them cleanly as successful dedups + if e.__class__.__name__ == "UniqueViolation" and "ene_pkg_hash_idx" in str(e): + log.info("Deduplication filter triggered: record with identical content_hash already exists. Skipping.") + return raise e finally: cur.close()