From f31058fc3fc2e4eb6086703964655740fa36520e Mon Sep 17 00:00:00 2001 From: chihlasm Date: Sun, 1 Mar 2026 14:21:48 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20CI=20failures=20=E2=80=94=20ES?= =?UTF-8?q?Lint=20unused=20vars=20and=20AI=20chat=20tests=20in=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frontend: suppress unused-vars ESLint errors for callback params in MaintenanceFlowDetailPage and StepLibraryPage. Backend: add autouse fixture to mock settings.ai_enabled=True in test_ai_chat.py so tests pass in CI where no ANTHROPIC_API_KEY is set. Co-Authored-By: Claude Opus 4.6 --- backend/tests/test_ai_chat.py | 13 ++++++++++++- frontend/src/pages/MaintenanceFlowDetailPage.tsx | 1 + frontend/src/pages/StepLibraryPage.tsx | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/tests/test_ai_chat.py b/backend/tests/test_ai_chat.py index 0b52f650..bca1d2c9 100644 --- a/backend/tests/test_ai_chat.py +++ b/backend/tests/test_ai_chat.py @@ -3,11 +3,22 @@ These tests mock the AI provider to avoid real API calls. """ import pytest -from unittest.mock import AsyncMock, patch +from unittest.mock import AsyncMock, patch, PropertyMock pytestmark = pytest.mark.asyncio +@pytest.fixture(autouse=True) +def _enable_ai(): + """Ensure ai_enabled returns True even without API keys in CI.""" + with patch( + "app.core.config.Settings.ai_enabled", + new_callable=PropertyMock, + return_value=True, + ): + yield + + @pytest.fixture def mock_ai_provider(): """Mock AI provider that returns realistic responses.""" diff --git a/frontend/src/pages/MaintenanceFlowDetailPage.tsx b/frontend/src/pages/MaintenanceFlowDetailPage.tsx index d6c66080..caec519c 100644 --- a/frontend/src/pages/MaintenanceFlowDetailPage.tsx +++ b/frontend/src/pages/MaintenanceFlowDetailPage.tsx @@ -66,6 +66,7 @@ export default function MaintenanceFlowDetailPage() { load() }, [id, navigate]) + // eslint-disable-next-line @typescript-eslint/no-unused-vars const handleLaunched = (batchId: string, _count: number) => { setShowBatchModal(false) setBannerDismissed(false) diff --git a/frontend/src/pages/StepLibraryPage.tsx b/frontend/src/pages/StepLibraryPage.tsx index 5df23b20..5a58fe36 100644 --- a/frontend/src/pages/StepLibraryPage.tsx +++ b/frontend/src/pages/StepLibraryPage.tsx @@ -73,6 +73,7 @@ export default function StepLibraryPage() { } } + // eslint-disable-next-line @typescript-eslint/no-unused-vars const handleFormSuccess = (_step: Step) => { setCreateOpen(false) setEditingStep(null)