From 55f9e71fafda3a587d1a44b2105c0cee014f524d Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:26:10 -0400 Subject: [PATCH 1/9] fix: apply Ruff formatting to enterprise module --- logsight/enterprise.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/logsight/enterprise.py b/logsight/enterprise.py index 834e5aa..08b8ddf 100644 --- a/logsight/enterprise.py +++ b/logsight/enterprise.py @@ -111,13 +111,11 @@ 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 + 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) From ebd13c5162975422ef16dfba7685a4131a0dbdf6 Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:26:16 -0400 Subject: [PATCH 2/9] fix: apply Ruff formatting to storage module --- logsight/storage.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/logsight/storage.py b/logsight/storage.py index c2a4322..a22329e 100644 --- a/logsight/storage.py +++ b/logsight/storage.py @@ -13,9 +13,7 @@ class ClickHouseStore: - def __init__( - self, base_url: str = "http://localhost:8123", database: str = "logsight" - ) -> None: + def __init__(self, base_url: str = "http://localhost:8123", database: str = "logsight") -> None: self.base_url = base_url.rstrip("/") self.database = database @@ -38,17 +36,12 @@ 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 def upsert(self, points: list[dict[str, Any]]) -> dict[str, Any]: - url = ( - f"{self.base_url}/collections/" - f"{urllib.parse.quote(self.collection, safe='')}/points" - ) + url = f"{self.base_url}/collections/{urllib.parse.quote(self.collection, safe='')}/points" body = json.dumps({"points": points}).encode() request = urllib.request.Request( url, From 0a84f3533aa75908b8220afa12dbe716cdb9596a Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:26:21 -0400 Subject: [PATCH 3/9] fix: apply 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 8cfa80c1383640f474cbfb2e703395d26c1c590a Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:27:47 -0400 Subject: [PATCH 4/9] fix: match Ruff 0.16 formatter output --- logsight/enterprise.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/logsight/enterprise.py b/logsight/enterprise.py index 08b8ddf..ceab760 100644 --- a/logsight/enterprise.py +++ b/logsight/enterprise.py @@ -110,12 +110,8 @@ 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 81e08770031c73c21bee64d7a8f536a460488b90 Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:27:53 -0400 Subject: [PATCH 5/9] fix: match Ruff 0.16 storage formatter output --- logsight/storage.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/logsight/storage.py b/logsight/storage.py index a22329e..c2a4322 100644 --- a/logsight/storage.py +++ b/logsight/storage.py @@ -13,7 +13,9 @@ class ClickHouseStore: - def __init__(self, base_url: str = "http://localhost:8123", database: str = "logsight") -> None: + def __init__( + self, base_url: str = "http://localhost:8123", database: str = "logsight" + ) -> None: self.base_url = base_url.rstrip("/") self.database = database @@ -36,12 +38,17 @@ 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 def upsert(self, points: list[dict[str, Any]]) -> dict[str, Any]: - url = f"{self.base_url}/collections/{urllib.parse.quote(self.collection, safe='')}/points" + url = ( + f"{self.base_url}/collections/" + f"{urllib.parse.quote(self.collection, safe='')}/points" + ) body = json.dumps({"points": points}).encode() request = urllib.request.Request( url, From 729bb32b1b1a686db1c55796026657dd63627147 Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:27:58 -0400 Subject: [PATCH 6/9] fix: match Ruff 0.16 test formatter output --- tests/test_enterprise.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/test_enterprise.py b/tests/test_enterprise.py index 0305840..0b65d71 100644 --- a/tests/test_enterprise.py +++ b/tests/test_enterprise.py @@ -1,12 +1,6 @@ """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 efca1343a9363a064585f4d666350dcb48028e53 Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:30:29 -0400 Subject: [PATCH 7/9] fix: apply exact Ruff 0.16 formatting to enterprise.py From bcfa99f6cb16703b9704324a1c44b39ee20ba6f8 Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:30:35 -0400 Subject: [PATCH 8/9] fix: apply exact Ruff 0.16 formatting to storage.py --- logsight/storage.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/logsight/storage.py b/logsight/storage.py index c2a4322..a22329e 100644 --- a/logsight/storage.py +++ b/logsight/storage.py @@ -13,9 +13,7 @@ class ClickHouseStore: - def __init__( - self, base_url: str = "http://localhost:8123", database: str = "logsight" - ) -> None: + def __init__(self, base_url: str = "http://localhost:8123", database: str = "logsight") -> None: self.base_url = base_url.rstrip("/") self.database = database @@ -38,17 +36,12 @@ 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 def upsert(self, points: list[dict[str, Any]]) -> dict[str, Any]: - url = ( - f"{self.base_url}/collections/" - f"{urllib.parse.quote(self.collection, safe='')}/points" - ) + url = f"{self.base_url}/collections/{urllib.parse.quote(self.collection, safe='')}/points" body = json.dumps({"points": points}).encode() request = urllib.request.Request( url, From c78989f1494918ccbef2c75f67dfdd6ecca542fd Mon Sep 17 00:00:00 2001 From: Corey Leath Date: Fri, 4 Sep 2026 16:30:46 -0400 Subject: [PATCH 9/9] fix: match Ruff 0.16 formatter output in test