Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(metering): delete a constant nothing reads, and say that a failed import stops (#1296)

Beenu Arora8565297806e8
diff --git a/services/api/app/services/usage_metering.py b/services/api/app/services/usage_metering.py
index 0080c8ce8..3bd55d92a 100644
--- a/services/api/app/services/usage_metering.py
+++ b/services/api/app/services/usage_metering.py
@@ -91,9 +91,6 @@ NON_MODEL_TIERS: Final[tuple[str, ...]] = ("cached", "deterministic", "memory")
MODEL_RUNS: Final[tuple[str, ...]] = tuple(f"{AUTO_TRIAGE_PREFIX}{tier}" for tier in MODEL_TIERS)
NON_MODEL_RUNS: Final[tuple[str, ...]] = tuple(f"{AUTO_TRIAGE_PREFIX}{tier}" for tier in NON_MODEL_TIERS)
-#: Kept because `replay_redaction` and the entitlement limit both name it.
-DETERMINISTIC_RUN: Final[str] = f"{AUTO_TRIAGE_PREFIX}deterministic"
-
#: The approval tier `services/actions` grades a submission at, recorded on
#: the action row at submit time. `automatic` is the only value that means
#: the platform would run it unattended; everything else needed a human or
diff --git a/tests/isolation/test_usage_lake_meter_live.py b/tests/isolation/test_usage_lake_meter_live.py
index 82b4be970..23ada2581 100644
--- a/tests/isolation/test_usage_lake_meter_live.py
+++ b/tests/isolation/test_usage_lake_meter_live.py
@@ -97,10 +97,14 @@ def lake():
try:
import clickhouse_driver as driver # noqa: PLC0415 — live-only dependency
except ImportError as exc: # pragma: no cover — only on a misconfigured runner
- pytest.fail(
+ # `raise` rather than a bare `pytest.fail(...)`: Failed is a
+ # BaseException and the call never returns, but that is not visible
+ # to static analysis, which then reads `driver` below as possibly
+ # unbound. Raising the same failure says so in the syntax.
+ raise pytest.fail.Exception(
f"ISOLATION_CLICKHOUSE_HOST is set, so this is a live run, but clickhouse_driver is missing ({exc}). "
"Install it in the job rather than letting the suite skip."
- )
+ ) from exc
client = driver.Client(
host=os.environ["ISOLATION_CLICKHOUSE_HOST"],
port=int(os.environ.get("ISOLATION_CLICKHOUSE_PORT", "9000")),