From 7970477054c49948350f41e4997f4d42084e41be Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:37:52 -0400 Subject: [PATCH 1/4] fix: apply exact Ruff formatting to enterprise module --- logsight/enterprise.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/logsight/enterprise.py b/logsight/enterprise.py index ceab760..08b8ddf 100644 --- a/logsight/enterprise.py +++ b/logsight/enterprise.py @@ -110,8 +110,12 @@ class AnomalyScore: def score_event(event: EnrichedLog, recent: list[EnrichedLog]) -> AnomalyScore: """Combine frequency and structural signals into a deterministic score.""" template = event.template or extract_template(event.message) - same = sum(1 for item in recent if (item.template or extract_template(item.message)) == template) - error_rate = sum(item.level in {"ERROR", "CRITICAL"} for item in recent) / max(len(recent), 1) + same = sum( + 1 for item in recent if (item.template or extract_template(item.message)) == template + ) + error_rate = sum(item.level in {"ERROR", "CRITICAL"} for item in recent) / max( + len(recent), 1 + ) rarity = 1.0 / (same + 1) severity = 1.0 if event.level in {"ERROR", "CRITICAL"} else 0.0 score = min(1.0, 0.45 * rarity + 0.35 * error_rate + 0.20 * severity) From 1f63b7e8b44b92f00ea2c99ff1c10e42f1d8fd61 Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:37:56 -0400 Subject: [PATCH 2/4] fix: apply exact Ruff formatting to storage module --- logsight/storage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/logsight/storage.py b/logsight/storage.py index a22329e..5c1ca5b 100644 --- a/logsight/storage.py +++ b/logsight/storage.py @@ -36,7 +36,9 @@ def insert_events(self, events: list[dict[str, Any]]) -> None: class QdrantStore: - def __init__(self, base_url: str = "http://localhost:6333", collection: str = "logsight") -> None: + def __init__( + self, base_url: str = "http://localhost:6333", collection: str = "logsight" + ) -> None: self.base_url = base_url.rstrip("/") self.collection = collection From d3ba7a7742eba2d35a97a75988f4805f8ded2424 Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:37:59 -0400 Subject: [PATCH 3/4] fix: apply exact Ruff formatting to enterprise tests --- tests/test_enterprise.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_enterprise.py b/tests/test_enterprise.py index 0b65d71..0305840 100644 --- a/tests/test_enterprise.py +++ b/tests/test_enterprise.py @@ -1,6 +1,12 @@ """Tests for enterprise observability primitives.""" -from logsight.enterprise import WebhookNotifier, enrich, extract_template, score_event, semantic_features +from logsight.enterprise import ( + WebhookNotifier, + enrich, + extract_template, + score_event, + semantic_features, +) from logsight.parser import parse_line From 5097b6e4329e3b350f45eeff46b6383d61e7cdb0 Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:41:16 -0400 Subject: [PATCH 4/4] fix: satisfy Ruff formatting for error_rate --- logsight/enterprise.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/logsight/enterprise.py b/logsight/enterprise.py index 08b8ddf..a3adc8f 100644 --- a/logsight/enterprise.py +++ b/logsight/enterprise.py @@ -113,9 +113,7 @@ def score_event(event: EnrichedLog, recent: list[EnrichedLog]) -> AnomalyScore: same = sum( 1 for item in recent if (item.template or extract_template(item.message)) == template ) - error_rate = sum(item.level in {"ERROR", "CRITICAL"} for item in recent) / max( - len(recent), 1 - ) + error_rate = sum(item.level in {"ERROR", "CRITICAL"} for item in recent) / max(len(recent), 1) rarity = 1.0 / (same + 1) severity = 1.0 if event.level in {"ERROR", "CRITICAL"} else 0.0 score = min(1.0, 0.45 * rarity + 0.35 * error_rate + 0.20 * severity)