From 4746af2f3efa2f1a0ea5a805cceee0010d1d1110 Mon Sep 17 00:00:00 2001 From: busya Date: Wed, 16 Sep 2026 16:11:02 +0300 Subject: [PATCH] fix(health): address consolidation review findings --- backend/src/api/routes/health.py | 4 ++-- .../api/test_assistant_command_parser.py | 3 +-- backend/tests/api/test_assistant_tools.py | 1 - backend/tests/api/test_health.py | 2 +- .../agentchat_handler_dashboard_context.json | 4 ++-- frontend/src/lib/api/__tests__/api.test.ts | 2 +- .../health/ScenarioScheduleGlance.svelte | 6 +++-- .../__tests__/sidebarNavigation.test.ts | 22 +++++++++++++++---- .../components/layout/sidebarNavigation.ts | 4 ++-- .../src/lib/i18n/locales/en/assistant.json | 1 - .../src/lib/i18n/locales/ru/assistant.json | 1 - .../src/routes/dashboards/health/+page.svelte | 2 +- .../__tests__/health_page.integration.test.ts | 1 + .../agentchat_handler_dashboard_context.json | 4 ++-- 14 files changed, 35 insertions(+), 22 deletions(-) diff --git a/backend/src/api/routes/health.py b/backend/src/api/routes/health.py index a3b2f6014..5c738e4e8 100644 --- a/backend/src/api/routes/health.py +++ b/backend/src/api/routes/health.py @@ -23,7 +23,7 @@ router = APIRouter(prefix="/api/health", tags=["Health"]) # @RELATION CALLS -> [Services.HealthServiceClass] @router.get("/summary", response_model=HealthSummaryResponse) async def get_health_summary( - environment_id: str | None = Query(None), + env_id: str | None = Query(None), db: Session = Depends(get_db), config_manager = Depends(get_config_manager), _ = Depends(has_permission("plugin:migration", "READ")) @@ -35,7 +35,7 @@ async def get_health_summary( if not config_manager.get_config().settings.features.health_monitor: raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Health monitor feature is disabled") service = HealthService(db, config_manager=config_manager) - return await service.get_health_summary(environment_id=environment_id or "") + return await service.get_health_summary(environment_id=env_id or "") # #endregion Api.Health.GetHealthSummary diff --git a/backend/tests/api/test_assistant_command_parser.py b/backend/tests/api/test_assistant_command_parser.py index 80e45dffb..eb6554c5e 100644 --- a/backend/tests/api/test_assistant_command_parser.py +++ b/backend/tests/api/test_assistant_command_parser.py @@ -309,8 +309,7 @@ class TestParseCommandLlmProviders: assert result["operation"] == "list_llm_providers" def test_llm_status_via_parser(self): - """'llm провер' routes to get_llm_status now that the legacy - run_llm_validation branch (which shadowed this keyword) is removed.""" + """'llm провер' routes to get_llm_status after legacy validation removal.""" from src.api.routes.assistant._command_parser import _parse_command cm = _make_config_manager() result = _parse_command("llm провер", cm) diff --git a/backend/tests/api/test_assistant_tools.py b/backend/tests/api/test_assistant_tools.py index a5f06c2b4..f8f93c0f0 100644 --- a/backend/tests/api/test_assistant_tools.py +++ b/backend/tests/api/test_assistant_tools.py @@ -90,7 +90,6 @@ class TestToolCapabilities: {"operation": "deploy_dashboard"}, {"operation": "execute_migration"}, {"operation": "run_backup"}, - {"operation": "run_llm_validation"}, {"operation": "run_llm_documentation"}, {"operation": "get_task_status"}, {"operation": "get_health_summary"}, diff --git a/backend/tests/api/test_health.py b/backend/tests/api/test_health.py index 5b10e1bfd..124e18447 100644 --- a/backend/tests/api/test_health.py +++ b/backend/tests/api/test_health.py @@ -92,7 +92,7 @@ class TestGetHealthSummary: with patch("src.api.routes.health.HealthService", return_value=mock_service): from src.dependencies import get_config_manager client = _make_client({get_config_manager: lambda: _enabled_config()}) - resp = client.get("/api/health/summary?environment_id=prod") + resp = client.get("/api/health/summary?env_id=prod") assert resp.status_code == 200 mock_service.get_health_summary.assert_called_with(environment_id="prod") diff --git a/backend/tests/fixtures/agent/agentchat_handler_dashboard_context.json b/backend/tests/fixtures/agent/agentchat_handler_dashboard_context.json index 5e05eaf3d..af65cfa0b 100644 --- a/backend/tests/fixtures/agent/agentchat_handler_dashboard_context.json +++ b/backend/tests/fixtures/agent/agentchat_handler_dashboard_context.json @@ -12,8 +12,8 @@ "env_id": "ss-dev" }, "expected": { - "tool_count": 9, - "tool_names": ["search_dashboards", "get_health_summary", "deploy_dashboard", "run_llm_validation", "run_llm_documentation", "execute_migration", "create_branch", "commit_changes", "show_capabilities"], + "tool_count": 8, + "tool_names": ["search_dashboards", "get_health_summary", "deploy_dashboard", "run_llm_documentation", "execute_migration", "create_branch", "commit_changes", "show_capabilities"], "uicontext_injected": true, "runtime_context_contains": ["[USER CONTEXT]", "Отчёт по энергопотреблению", "dashboards/42"] } diff --git a/frontend/src/lib/api/__tests__/api.test.ts b/frontend/src/lib/api/__tests__/api.test.ts index b927fa697..c7004458f 100644 --- a/frontend/src/lib/api/__tests__/api.test.ts +++ b/frontend/src/lib/api/__tests__/api.test.ts @@ -1370,7 +1370,7 @@ describe('ApiModule — registry methods', () => { expect(fetch).toHaveBeenCalledWith('/api/security/encryption/recover', expect.objectContaining({ method: 'POST' })); }); - // ── getValidationStatusBatch with actual params ────────────────── + // ── task API params ───────────────────────────────────────────── it('getTasks with search param', async () => { vi.mocked(fetch).mockResolvedValue(await _okJson({ tasks: [], total: 0 })); diff --git a/frontend/src/lib/components/health/ScenarioScheduleGlance.svelte b/frontend/src/lib/components/health/ScenarioScheduleGlance.svelte index ad81f4271..8afdf7edd 100644 --- a/frontend/src/lib/components/health/ScenarioScheduleGlance.svelte +++ b/frontend/src/lib/components/health/ScenarioScheduleGlance.svelte @@ -15,7 +15,6 @@