Files
Shadowbroker/backend/tests/test_gt_lean_profile.py
T
Shadowbroker cfbeabda1e Feat/gt analytics openclaw (#392)
* feat(telegram): auto-translate OSINT channel posts to English

Cherry-picked from @Bobpick PR #391 (telegram-only slice): server-side translation during fetch, SHOW ORIGINAL toggle in TelegramOsintPopup, and on-demand /api/telegram-feed?lang=.

Co-authored-by: Robert Pickett <bobpickettsr@yahoo.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

* feat(gt): experimental Derived OSINT analytics with lean-node safeguards

Cherry-picked from @Bobpick PR #391 (GT + OpenClaw slice): Bayesian strategic-risk engine, map overlay, OpenClaw commands, and telegram_rhetoric watchdog. Off by default (GT_ANALYTICS_ENABLED=false, gt_risk layer false). 1 vCPU nodes get cgroup detection, UI warning on layer toggle, and lean profile that skips scheduled ingest/Louvain unless GT_ANALYTICS_ACK_LOW_CPU=true. Backtest HUD removed from dashboard (OpenClaw/API regression only).

Co-authored-by: Robert Pickett <bobpickettsr@yahoo.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Robert Pickett <bobpickettsr@yahoo.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 17:05:46 -06:00

36 lines
1.3 KiB
Python

"""Lean-profile gating for Strategic Risk Analytics."""
from __future__ import annotations
import pytest
from analytics.integration import get_gt_engine, maybe_refresh_gt_analytics, reset_gt_engine
from analytics.settings import gt_engine_operational, gt_scheduled_ingest_enabled
def test_gt_engine_blocked_on_lean_without_ack(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("GT_ANALYTICS_ENABLED", "true")
monkeypatch.setenv("GT_ANALYTICS_PROFILE", "lean")
monkeypatch.delenv("GT_ANALYTICS_ACK_LOW_CPU", raising=False)
reset_gt_engine()
assert gt_engine_operational() is False
assert get_gt_engine() is None
def test_gt_engine_allowed_on_lean_with_ack(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("GT_ANALYTICS_ENABLED", "true")
monkeypatch.setenv("GT_ANALYTICS_PROFILE", "lean")
monkeypatch.setenv("GT_ANALYTICS_ACK_LOW_CPU", "true")
reset_gt_engine()
assert gt_engine_operational() is True
assert get_gt_engine() is not None
def test_scheduled_ingest_skipped_on_lean(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setenv("GT_ANALYTICS_ENABLED", "true")
monkeypatch.setenv("GT_ANALYTICS_PROFILE", "lean")
monkeypatch.delenv("GT_ANALYTICS_ACK_LOW_CPU", raising=False)
reset_gt_engine()
assert gt_scheduled_ingest_enabled() is False
maybe_refresh_gt_analytics()