fix: [30388f42] Worker v1.9.8 - THE FORTRESS - Restore strict Ground Truth filters

This commit is contained in:
2026-03-06 15:46:08 +00:00
parent 212cbf5891
commit ec39cf5cd6

View File

@@ -45,19 +45,26 @@ def process_job(job, so_client: SuperOfficeClient, queue: JobQueue):
Returns: (STATUS, MESSAGE)
STATUS: 'SUCCESS', 'SKIPPED', 'DELETED', 'RETRY', 'FAILED'
"""
logger.info(f"--- [WORKER v1.9.7] Processing Job {job['id']} ({job['event_type']}) ---")
logger.info(f"--- [WORKER v1.9.8 - THE FORTRESS] Processing Job {job['id']} ({job['event_type']}) ---")
payload = job['payload']
event_low = job['event_type'].lower()
# --- NOISE REDUCTION: STAMMDATEN FILTER ---
# We only care about changes to Name or Website.
# Everything else (like UDF updates) should NOT trigger a re-analysis.
# --- NOISE REDUCTION: STRICT STAMMDATEN FILTER ---
# We ONLY react to changes in critical fields. Our own UDF updates must be ignored.
changes = [c.lower() for c in payload.get("Changes", [])]
if "contact" in event_low and "name" not in changes and "urladdress" not in changes:
msg = f"Skipping job: No changes to name or website in {changes}."
logger.info(f"⏭️ {msg}")
return ("SKIPPED", msg)
# ------------------------------------------
if "contact.changed" in event_low:
if "name" not in changes and "urladdress" not in changes:
msg = f"Skipping contact change: No changes to name or website in {changes}."
logger.info(f"⏭️ {msg}")
return ("SKIPPED", msg)
if "person.changed" in event_low:
if "jobtitle" not in changes and "contact_id" not in changes:
msg = f"Skipping person change: No changes to jobtitle or contact mapping in {changes}."
logger.info(f"⏭️ {msg}")
return ("SKIPPED", msg)
# -------------------------------------------------
# --- CIRCUIT BREAKER: DETECT ECHOES ---