diff --git a/agent.py b/agent.py index f3642b1..9690cfa 100644 --- a/agent.py +++ b/agent.py @@ -189,7 +189,6 @@ class ProductionProofV116HighUtili72551( "min_severity": min_severity, } ) - history: list[dict[str, Any]] = [] try: history = _persist_dashboard_run( tenant_key=tenant, @@ -392,18 +391,6 @@ def _persist_dashboard_run( artifact_media_type: str, artifact_size: int, ) -> list[dict[str, Any]]: - payload = { - "rows": [row.model_dump() for row in rows], - "filtered_rows": [row.model_dump() for row in filtered], - "filters": filters, - "trends": trends, - "exceptions": exceptions, - "artifact": { - "name": artifact_name, - "media_type": artifact_media_type, - "size_bytes": artifact_size, - }, - } receipt_payload = { "receipt_id": receipt_id, "run_id": run_id, @@ -434,7 +421,7 @@ def _persist_dashboard_run( json.dumps(filters), json.dumps(trends), json.dumps(exceptions), - json.dumps(payload["filtered_rows"]), + json.dumps([row.model_dump() for row in filtered]), artifact_name, artifact_media_type, artifact_size, @@ -482,13 +469,6 @@ def _persist_scheduled_rollup( ).fetchone() if existing: return {"run_id": str(existing[0]), "receipt_id": str(existing[1]), "already_processed": True} - conn.execute( - """ - INSERT INTO scheduled_rollups (tenant_key, run_key, run_id, receipt_id, created_at) - VALUES (%s, %s, %s, %s, %s) - """, - (tenant_key, run_key, run_id, receipt_id, created_at), - ) conn.execute( """ INSERT INTO dashboard_runs ( @@ -534,6 +514,13 @@ def _persist_scheduled_rollup( created_at, ), ) + conn.execute( + """ + INSERT INTO scheduled_rollups (tenant_key, run_key, run_id, receipt_id, created_at) + VALUES (%s, %s, %s, %s, %s) + """, + (tenant_key, run_key, run_id, receipt_id, created_at), + ) conn.commit() return {"run_id": run_id, "receipt_id": receipt_id, "already_processed": False}