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.

652 B
Raw Blame
"""Wave 2 (W2.2) - the opt-in backtest hit-rate approval gate."""

from __future__ import annotations

from app.api.v1.endpoints.detection_proposals import _backtest_max_hit_rate


def test_gate_disabled_by_default(monkeypatch):
    monkeypatch.delenv("AISOC_BACKTEST_MAX_HIT_RATE", raising=False)
    assert _backtest_max_hit_rate() is None


def test_gate_reads_threshold(monkeypatch):
    monkeypatch.setenv("AISOC_BACKTEST_MAX_HIT_RATE", "0.5")
    assert _backtest_max_hit_rate() == 0.5


def test_gate_ignores_garbage(monkeypatch):
    monkeypatch.setenv("AISOC_BACKTEST_MAX_HIT_RATE", "not-a-number")
    assert _backtest_max_hit_rate() is None