[loop-cycle-7] fix: Configure mypy with explicit-package-bases for proper src/ layout (#1346) (#1359)
Some checks failed
Tests / lint (push) Failing after 6s
Tests / test (push) Has been skipped

This commit was merged in pull request #1359.
This commit is contained in:
2026-03-24 09:39:12 +00:00
parent 91d06eeb49
commit 002ace5b3c
6 changed files with 37 additions and 10 deletions

View File

@@ -167,3 +167,29 @@ directory = "htmlcov"
[tool.coverage.xml] [tool.coverage.xml]
output = "coverage.xml" output = "coverage.xml"
[tool.mypy]
python_version = "3.11"
mypy_path = "src"
explicit_package_bases = true
namespace_packages = true
check_untyped_defs = true
warn_unused_ignores = true
warn_redundant_casts = true
warn_unreachable = true
strict_optional = true
[[tool.mypy.overrides]]
module = [
"airllm.*",
"pymumble.*",
"pyttsx3.*",
"serpapi.*",
"discord.*",
"psutil.*",
"health_snapshot.*",
"swarm.*",
"lightning.*",
"mcp.*",
]
ignore_missing_imports = true

View File

@@ -40,6 +40,7 @@ from dashboard.routes.experiments import router as experiments_router
from dashboard.routes.grok import router as grok_router from dashboard.routes.grok import router as grok_router
from dashboard.routes.health import router as health_router from dashboard.routes.health import router as health_router
from dashboard.routes.hermes import router as hermes_router from dashboard.routes.hermes import router as hermes_router
from dashboard.routes.legal import router as legal_router
from dashboard.routes.loop_qa import router as loop_qa_router from dashboard.routes.loop_qa import router as loop_qa_router
from dashboard.routes.memory import router as memory_router from dashboard.routes.memory import router as memory_router
from dashboard.routes.mobile import router as mobile_router from dashboard.routes.mobile import router as mobile_router
@@ -49,8 +50,8 @@ from dashboard.routes.monitoring import router as monitoring_router
from dashboard.routes.nexus import router as nexus_router from dashboard.routes.nexus import router as nexus_router
from dashboard.routes.quests import router as quests_router from dashboard.routes.quests import router as quests_router
from dashboard.routes.scorecards import router as scorecards_router from dashboard.routes.scorecards import router as scorecards_router
from dashboard.routes.legal import router as legal_router
from dashboard.routes.self_correction import router as self_correction_router from dashboard.routes.self_correction import router as self_correction_router
from dashboard.routes.seo import router as seo_router
from dashboard.routes.sovereignty_metrics import router as sovereignty_metrics_router from dashboard.routes.sovereignty_metrics import router as sovereignty_metrics_router
from dashboard.routes.sovereignty_ws import router as sovereignty_ws_router from dashboard.routes.sovereignty_ws import router as sovereignty_ws_router
from dashboard.routes.spark import router as spark_router from dashboard.routes.spark import router as spark_router
@@ -63,7 +64,6 @@ from dashboard.routes.tools import router as tools_router
from dashboard.routes.tower import router as tower_router from dashboard.routes.tower import router as tower_router
from dashboard.routes.voice import router as voice_router from dashboard.routes.voice import router as voice_router
from dashboard.routes.work_orders import router as work_orders_router from dashboard.routes.work_orders import router as work_orders_router
from dashboard.routes.seo import router as seo_router
from dashboard.routes.world import matrix_router from dashboard.routes.world import matrix_router
from dashboard.routes.world import router as world_router from dashboard.routes.world import router as world_router
from timmy.workshop_state import PRESENCE_FILE from timmy.workshop_state import PRESENCE_FILE

View File

@@ -92,7 +92,7 @@ class HotMemory:
now = datetime.now(UTC).strftime("%Y-%m-%d %H:%M UTC") now = datetime.now(UTC).strftime("%Y-%m-%d %H:%M UTC")
lines = [ lines = [
"# Timmy Hot Memory\n", "# Timmy Hot Memory\n",
f"> Working RAM — always loaded, ~300 lines max, pruned monthly", "> Working RAM — always loaded, ~300 lines max, pruned monthly",
f"> Last updated: {now}\n", f"> Last updated: {now}\n",
] ]

View File

@@ -1,7 +1,6 @@
from unittest.mock import MagicMock, patch from unittest.mock import patch
import pytest import pytest
from scripts.llm_triage import ( from scripts.llm_triage import (
get_context, get_context,
get_prompt, get_prompt,
@@ -9,6 +8,7 @@ from scripts.llm_triage import (
run_triage, run_triage,
) )
# ── Mocks ────────────────────────────────────────────────────────────────── # ── Mocks ──────────────────────────────────────────────────────────────────
@pytest.fixture @pytest.fixture
def mock_files(tmp_path): def mock_files(tmp_path):

View File

@@ -10,8 +10,9 @@ Covers the public API and internal helpers not exercised in other test files:
- Disabled-engine guard for every mutating method - Disabled-engine guard for every mutating method
""" """
from unittest.mock import MagicMock, patch
import pytest import pytest
from unittest.mock import patch, MagicMock
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
@@ -128,11 +129,10 @@ class TestGetSparkEngineSingleton:
mock_settings = MagicMock() mock_settings = MagicMock()
mock_settings.spark_enabled = False mock_settings.spark_enabled = False
with patch("spark.engine.settings", mock_settings, create=True): with patch("spark.engine.settings", mock_settings, create=True):
from spark.engine import get_spark_engine, reset_spark_engine from spark.engine import reset_spark_engine
reset_spark_engine() reset_spark_engine()
# Patch at import time by mocking the config module in engine # Patch at import time by mocking the config module in engine
import spark.engine as engine_module import spark.engine as engine_module
original_func = engine_module.get_spark_engine
def patched_get(): def patched_get():
global _spark_engine global _spark_engine
@@ -181,8 +181,8 @@ class TestModuleLevelGetattr:
class TestOnTaskPostedWithoutCandidates: class TestOnTaskPostedWithoutCandidates:
def test_no_eidos_prediction_when_no_candidates(self): def test_no_eidos_prediction_when_no_candidates(self):
"""When candidate_agents is empty, no EIDOS prediction should be stored.""" """When candidate_agents is empty, no EIDOS prediction should be stored."""
from spark.engine import SparkEngine
from spark.eidos import get_predictions from spark.eidos import get_predictions
from spark.engine import SparkEngine
engine = SparkEngine(enabled=True) engine = SparkEngine(enabled=True)
eid = engine.on_task_posted("t1", "Background task", candidate_agents=[]) eid = engine.on_task_posted("t1", "Background task", candidate_agents=[])
@@ -208,6 +208,7 @@ class TestOnTaskCompletedWithBid:
def test_winning_bid_stored_in_data(self): def test_winning_bid_stored_in_data(self):
"""winning_bid is serialised into the event data field.""" """winning_bid is serialised into the event data field."""
import json import json
from spark.engine import SparkEngine from spark.engine import SparkEngine
from spark.memory import get_events from spark.memory import get_events
@@ -220,6 +221,7 @@ class TestOnTaskCompletedWithBid:
def test_without_winning_bid_is_none(self): def test_without_winning_bid_is_none(self):
import json import json
from spark.engine import SparkEngine from spark.engine import SparkEngine
from spark.memory import get_events from spark.memory import get_events

View File

@@ -10,7 +10,6 @@ from __future__ import annotations
import ast import ast
import math import math
import subprocess import subprocess
from pathlib import Path
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
import pytest import pytest