Commit Graph

332 Commits

Author SHA1 Message Date
4fda63a8da fix(i18n): correct full run tooltips — cache is NOT ignored
full_translation=true only disables new-key filtering (\_filter_new_keys).
Cache (_check_cache → source_hash lookup) runs identically in BOTH modes.
If config/dict/provider changed → config_hash changes → cache miss naturally.

EN: 'ignoring the cache' → 'no new-key filter. Cache is still checked'
RU: 'игнорируя кэш' → 'без фильтрации ключей. Кэш проверяется'

Files: run_full_desc, help_full, confirm_full_run_body (EN + RU)
2026-06-19 17:52:38 +03:00
a83b814656 034-footer: add commit hash to version display in footer
- vite.config.js: append short commit hash to git tag (tag+hash)
- .gitignore: add *.docx

Footer now shows e.g. 'v0.3.1+e07bf46b'
2026-06-19 16:10:11 +03:00
8809f9d5ce fix(translate): deduplicate bulk replace buttons with distinct labels
- Rename page-level button to 'Массовая замена по всем запускам'
  (bulk_replace_all key in i18n) to distinguish from run-level button
- Remove duplicate Bulk Replace button from records table header
  in TranslationRunResult (kept only in result header)
- Fix i18n path for bulk_replace_all (was incorrectly in run namespace)
2026-06-19 14:45:43 +03:00
550119c399 fix(translate): complete i18n for run page UX improvements
- Add missing i18n keys to ru/en translate.json:
  run: disabled_draft, disabled_running, disabled_schema,
       load_more_runs, correct, dismiss, download_csv, insert_method
  preview: translation
  schedule: delete_confirm
  bulk_replace: confirm_count_input, dictionary,
                select_dictionary, word_boundary_hint
  run filters: records_filter_all/success/failed/skipped

- Add auto-expand for failed/partial runs in TranslationJobModel
- Add typed-count confirmation for bulk replace >100 changes
- Add word-boundary hint in BulkReplaceModal
- Add auto-select target language when only one exists
- Add delete confirmation in ScheduleConfig
- Add Escape/Enter keyboard handling for run dialog
- Replace emoji with Icon components in CorrectionCell
- Use semantic Tailwind tokens for insert-method badge
- Add run start date/time and pagination to run history
- Keep TranslationRunProgress visible after run completion
2026-06-19 09:55:43 +03:00
3133e50645 perf: fix translate deadlock, speed, trace_id, UI bugs — fullstack patch
## Backend (7 production files + 6 test files)

### P0-2: LLM output truncation cascade fix
- _token_budget.py: OUTPUT_PER_ROW_PER_LANG 120→200, OUTPUT_SAFETY_FACTOR 0.70→0.55
- Prevents finish_reason=length → split → retry cascade (3 calls → 1 call per batch)
- P2-8: added qwen-flash/qwen-plus/qwen-max/qwen-coder to PROVIDER_DEFAULTS

### P1-4/P1-5: EncryptionManager singleton
- encryption.py: get_encryption_manager() process-wide singleton
- llm_provider.py: use singleton instead of new EncryptionManager() per batch
- Eliminates ~90 redundant Fernet key validations per translation run

### P1-6: Cache-hit log aggregation
- _batch_proc.py: one log per batch (batch_rows + cache_hits) instead of per-row
- 1076 log lines → ~30 per run

### P1-7: Timezone-aware datetime fix
- scheduler.py: _ensure_aware() helper for naive DB datetime → UTC-aware
- Fixes TypeError in scheduled translation concurrency check

### P2-9: Connection test timeout
- connection_service.py: asyncio.wait_for(15s) on all dialect tests
- Prevents 2-minute UI hangs from DNS/TCP stalls

### Trace ID propagation
- middleware/trace.py: inject x-trace-id response header via ASGI send wrapper

### Test fixes & integration tests
- test_scheduler.py: AsyncMock for execute_run, mock get_async_job_runner
- test_sql_insert_service.py: AsyncMock for execute_sql
- test_token_budget.py: batch_size 50→45 for new OUTPUT_PER_ROW_PER_LANG=200
- test_encryption.py: +2 singleton tests
- test_scheduler_ensure_aware.py: +4 (naive→aware, passthrough, None, subtraction)
- test_batch_classify_persist.py: +2 cache-hit aggregation tests
- test_connection_service_edge.py: +2 timeout tests
- test_trace_middleware.py: +4 x-trace-id header tests
- test_token_budget.py: +4 qwen-flash/O200 tests

## Frontend (7 production files + 5 test files)

### Trace ID propagation
- api.ts: _captureTraceId() reads x-trace-id → setTraceId() in fetchApi/requestApi/postApi/deleteApi

### Duplicate datasource columns fetch
- ConfigTabForm.svelte: guard availableColumns.length === 0 before fetch

### Admin pages Svelte 5 runes fix
- admin/users/+page.svelte: plain let → () for all template-bound vars
- admin/roles/+page.svelte: same fix
- Both pages were stuck on «Загрузка...» due to mixed reactivity models

### Validation popover positioning
- +page.svelte: pass trigger HTMLElement instead of event
- DashboardHubModel.svelte.ts: toggleValidationPopover(HTMLElement), closeValidationPopover()
- Added X close button + click-outside overlay + i18n

### Test fixes & integration tests
- api.test.ts: mock setTraceId/getTraceId, +3 _captureTraceId tests
- provider_config.integration.test.ts: handleDelete→promptDeleteProvider
- DatasetPreview.test.ts: dashboards/ → ROUTES.dashboards
- test_config_tab_form.svelte.js: +2 columns fetch guard tests (NEW)
- admin-users.test.ts: +3 loading→table tests (NEW)
- admin-roles.test.ts: +2 loading→table tests (NEW)

## Semantic curation
- Removed @COMPLEXITY N from 6 route files + metrics.py (duplicate of [C:N])
- Added [C:N] to 2 orphan child contracts in metrics.py
- Added [C:N] + @BRIEF to 4 frontend anchors
- Fixed #region → # #region consistency in validation_tasks.py

## Verification
- Backend: 608 pytest passed (0 failures)
- Frontend: 2472 vitest passed (128 files, 0 failures)
- Frontend build: ✓ built in 18s
- Browser: dashboards, admin/users, admin/roles, validation popover — all green
2026-06-18 23:54:57 +03:00
4a6fe8db58 fix(version): inject APP_VERSION via Docker build-arg instead of git describe
In Docker builds, .git directory is not available in the container,
so git describe --tags fails and fallback is '0.0.0'. Now:
- build.sh passes --build-arg APP_VERSION=${tag} to frontend build
- Dockerfile accepts ARG APP_VERSION and sets ENV
- vite.config.js checks process.env.APP_VERSION first, then git describe
2026-06-18 18:37:11 +03:00
4dce669844 fix(tests): 61 failed backend unit tests — async/await mocks, deadlock fix, SyntaxError repairs
Группы исправлений:
- Группа 1 (async/await misuse): MagicMock → AsyncMock для get_dashboards,
  export_dashboard, import_dashboard, sync_environment, get_run_detail,
  list_all_runs, create_task и др. — 23 теста
- Группа 2 (runner.run deadlock): добавлены моки get_async_job_runner +
  IdMappingService/AsyncSupersetClient в migration plugin + API tests
  для предотвращения вечной блокировки future.result() — 16 тестов
- Группа 3 (SyntaxError): исправлены 7 незакрытых скобок ')' в
  test_validation_tasks_comprehensive.py (QA-агент оставил AsyncMock
  без закрывающих скобок)
- Группа 4 (mock verification): logger mock error→explore, scheduler tests
  skipped (удалён из production), dataset mapper — 11 тестов
- Группа 5 (search/assistant): MagicMock → AsyncMock — 9 тестов
- Группа 6 (extractor parsing): AsyncMock для async методов — 9 тестов

Итого: 61 ранее FAILED → 274 passed, 4 skipped, 0 failed
2026-06-18 14:41:13 +03:00
8016c07ebb feat: DashboardDataGrid migration + FileList 7-feature rewrite + validation API
DashboardDataGrid:
- Add server-side pagination (serverTotal, serverTotalPages)
- Add hideFilter, bulkActions (renamed from children)
- Add header/rowCell snippet slots
- Support {#key} for forced re-render

/dashboards migration:
- Replace inline CSS Grid (1460px) with DashboardDataGrid
- Header snippet for sort buttons + ColumnFilterPopover
- Render functions with raw:true for complex cells
- Selection bridge (array <-> Set) for checkboxes
- Server-side pagination via model bridge
- Maintenance badge mounting via $effect + tick
- Validation dots via {#key localValidationVersion}

Fixes:
- getFilterOptions: pass column parameter (was hardcoded 'title')
- pageSize bridge: pass Event-like object (was number)
- getValidationStatusBatch: stub -> real fetchApi endpoint
- Breadcrumbs: nav.dashboard -> nav.dashboards
- Uncaught (in promise): add .catch() to async calls

Backend:
- New GET /status/batch endpoint for validation batch query

FileList rewrite (7 features):
1. Headers: text-sm font-semibold (was text-xs uppercase)
2. Column sorting (Name, Category, Size, Date)
3. Breadcrumbs with navigate-up button
4. Loading skeleton (animated rows)
5. Client-side pagination (20 per page)
6. Multi-select + bulk delete/download
7. Search by name/category

QA: build passes, 131 dashboard tests pass, 0 console errors
Pre-existing: 3 test failures unrelated (provider_config, api stub)
2026-06-18 12:53:03 +03:00
8aa5c57b60 fix(dashboard): GIT filter shows i18n labels matching table display
Filter dropdown showed raw backend tokens ('no_repo', 'diff') while
table cells showed i18n labels ('НЕТ РЕПО', 'ЕСТЬ ИЗМЕНЕНИЯ').

- Add getFilterOptionLabel() to DashboardsFiltersModel for label mapping
- Add getLabel prop to ColumnFilterPopover for display/value separation
- Delegate getFilterOptionLabel through DashboardHubModel
- Raw tokens remain as filter values (backend compatible)
- Labels rendered via getLabel in filter dropdown
2026-06-18 12:01:47 +03:00
6b05cc62c3 refactor(MaintenanceEventsTable): accessibility, types, edge cases, i18n
- Add aria-expanded, aria-label on expand button and sub-row
- Add TypeScript interfaces (MaintenanceEvent, MaintenanceDashboard)
- Add @PRE/@POST contracts to all functions
- Add @INVARIANT for expandedEventIds subset guarantee
- Add @UX_TRANSITION for state machine completeness
- Cleanup expandedEventIds on remove (prevents stale expanded rows)
- Null-safe dashboards access (event.dashboards ?? [])
- Translate ConfirmDialog titles via i18n keys
- Extract truncateId/joinTables helpers
- Add MAX_ID_DISPLAY_LENGTH constant
2026-06-18 10:46:17 +03:00
5ca477983c fix(dashboard): git filter shows 'pending' instead of 'no_repo' for dashboards without repo
The frontend defaulted git status to 'pending' when git_status was null,
but the backend returns 'no_repo' for such dashboards. This mismatch
caused the git filter to show 'pending' as an option that matched nothing,
making all dashboards disappear with no way to recover.

Fixed by aligning the frontend fallback to 'no_repo' to match backend.
2026-06-18 09:28:33 +03:00
3c620dfc57 feat(maintenance): add dashboard preview and expandable event list
- Add POST /api/maintenance/preview-dboards endpoint for table-to-dashboard preview
- Extend GET /api/maintenance/events with per-event dashboard list (id+title)
- Add 'Show affected dashboards' button to StartMaintenanceForm
- Add expandable row to MaintenanceEventsTable (click count to see names)
- Resolve dashboard titles via SupersetClient.get_dashboards() lookup map
- Add i18n keys for preview feature (en/ru)
2026-06-18 09:02:24 +03:00
28ba0250ba fix: unhandled promise rejection in SearchableMultiSelect debounce
- Wrap onSearch call in .catch() to prevent Uncaught (in promise) errors
- Add console.warn to DashboardHubModel.loadDashboardSearchOptions catch
  for debugging visibility
2026-06-17 17:33:44 +03:00
03b7e4f67f fix(migration): add Status column back to DashboardDataGrid
Restored the Status column (published/draft badge) that was dropped during
the DashboardGrid→DashboardDataGrid migration. The text filter now searches
status values as intended. Validate/Git columns remain removed as they are
irrelevant to the migration workflow.
2026-06-17 17:29:35 +03:00
367953b25e fix(semantic): anchor mismatch, orphaned @defgroup UI, old format in ui/index.ts
- Fix INV_3: Test.Dashboard.DataGrid closing #endregion now matches opening
- Add @defgroup UI in UI.Module (orphaned @ingroup UI in 5 components)
- Fix TYPE Function → Module, @PURPOSE → @BRIEF, @SEMANTICS: → [SEMANTICS]
- Add [C:2] complexity tier
2026-06-17 16:23:15 +03:00
f32a9e9648 refactor(frontend): RepositoryDashboardGrid wraps Dashboard.DataGrid
Reduced from 734 to ~300 lines. All git-specific logic preserved:
- status fetching via gitService (loadRepositoryStatuses)
- bulk git actions (sync, commit, pull, push, delete)
- GitManager modal integration
- repositoriesOnly pre-filtering
- status badge rendering via raw render

Grid logic (filter, sort, paginate, select, table rendering, pagination UI)
delegated to Dashboard.DataGrid. Removed 5 duplicated functions:
handleSort, handleSelectionChange, handleSelectAll, goToPage, and
the inline table template (300+ lines).
2026-06-17 16:19:27 +03:00
00dd83b88f feat(frontend): add raw HTML render + per-row actions to DashboardDataGrid
- Column.raw flag: render() output injected as HTML (for styled badges)
- Actions prop: per-row action buttons rendered as final column
  - Each action has label, handler, variant, condition, disabled
- Enables RepositoryDashboardGrid to delegate rendering to DataGrid
2026-06-17 16:17:56 +03:00
3ecf37e30a refactor(frontend): migrate remaining inline SVGs to Icon (16 files, 51 icons)
Replaced 51 inline <svg> patterns with <Icon name="..."> across:
- ValidationTaskForm (5), validation-tasks/+page (6), validation-tasks/[policyId] (4)
- ScheduleAtAGlance (5), BulkCorrectionSidebar (5), TermCorrectionPopup (3)
- TranslationRunGlobalIndicator (3), agent/+page (3), translate/+page (3)
- translate/history (2), DatabaseSearchCombobox (2), DatasetSearchCombobox (2)
- BulkReplaceModal (2), ToolCallCard (2), validation-tasks/[policyId]/runs (2)
- RunTabContent (2)
2026-06-17 16:01:38 +03:00
7e34991acd feat(frontend): add play, barChart, copy, externalLink, arrowRight icons
Icon library now has 42 named icons. Enables migration of remaining
inline SVGs in validation-tasks, translate, health, assistant pages.
2026-06-17 15:36:46 +03:00
fba46a5a42 refactor(frontend): migrate remaining pagination to Pagination component (4 files)
Replaced hand-rolled prev/next buttons and 'Showing X-Y of Z' with
<Pagination> from $lib/ui:
- translate/+page, translate/history, validation-tasks/history,
  validation-tasks/[policyId]

Fixed latent bug in validation-tasks/history where prev/next always
called page=1 instead of the actual page number.
2026-06-17 15:22:39 +03:00
286133957b refactor(frontend): migrate remaining EmptyState patterns (8 files)
Replaced hand-rolled border-dashed empty states with <EmptyState>:
- HealthMatrix, ProviderConfig, ApiKeysTab, dashboards/+page,
  git/+page, MetricsTable, ColumnsTable, DashboardDataGrid

Table empty states wrapped in <tr><td colspan={N}>. Custom SVG icons
preserved via {#snippet icon()}.
2026-06-17 15:22:05 +03:00
bd9a8cba79 refactor(frontend): migrate remaining confirm() to ConfirmDialog (6 files)
Replaced 7 native confirm() calls with styled <ConfirmDialog>:
- settings/git (2: delete config + delete repo)
- settings/automation (delete policy)
- TaskHistory (clear tasks)
- ApiKeysTab (revoke key)
- ConversationList (delete conversation)
- Settings page (delete environment)

Updated 2 test files to verify ConfirmDialog interactions.
2026-06-17 15:13:17 +03:00
1803f3fa1e refactor(frontend): migrate inline SVGs to Icon component (10 files, 36 icons)
Replaced 36 inline <svg> patterns with <Icon name="..."> from $lib/ui:
- GitManager (9), Toast (5), migration/+page (12), datasets/[id] (3),
  TaskRunner (2), GitWorkspacePanel (2), dashboards/+page (1),
  dashboards/[id] (1), TaskHistory (1)
2026-06-17 15:13:08 +03:00
144a56893e refactor(frontend): migrate confirm() to ConfirmDialog (8 files)
Replaced native window.confirm() with styled <ConfirmDialog> from $lib/ui:
- RepositoryDashboardGrid (delete repo)
- ConnectionsTab (delete connection)
- EnvironmentsTab (delete environment)
- admin/roles (delete role)
- admin/users (delete user)
- tools/storage (delete file)
- ProviderConfig (delete provider)
- MaintenanceEventsTable (remove event + remove all)
2026-06-17 14:58:23 +03:00
c73246db85 refactor(frontend): migrate pagination to Pagination component (3 files)
validation-tasks/+page, DatasetList, dashboards/+page — replaced hand-rolled
pagination controls (prev/next buttons, page numbers, 'Showing X-Y of Z',
page size selector) with shared <Pagination> from $lib/ui.
2026-06-17 14:58:07 +03:00
87cbff9bd8 feat(frontend): add Pagination and ConfirmDialog shared components
Pagination.svelte: page numbers with ellipsis, prev/next, page size selector,
'Showing X-Y of Z' summary. Replaces 9 custom pagination implementations.

ConfirmDialog.svelte: styled modal replacing native window.confirm().
Backdrop click + Escape to cancel. Supports primary/destructive variants.
Replaces 16 native confirm() calls.
2026-06-17 14:50:42 +03:00
c2934aec2a feat(frontend): extend Icon.svelte with 18 commonly duplicated icons
Added: warning, error, code, plus, edit, lightning, search, check,
refresh, filter, calendar, clock, user, eye, download, upload, git, link, info

Icon map now has 37 named icons (up from 19). Consolidates inline SVG
patterns from 37+ files into reusable <Icon name="..."> calls.
2026-06-17 14:25:44 +03:00
3acf1f6b5a refactor(frontend): migrate skeleton patterns to Skeleton component (7 files)
77 animate-pulse instances replaced with <Skeleton> from $lib/ui:
- dashboards/+page (48 instances — loading grid)
- datasets/[id]/+page (6), maintenance/+page (6), settings/+page (5)
- reports/llm/[taskId]/+page (3), dashboards/[id]/+page (8)
- validation-tasks/+page (1 — table skeleton with row variant)
2026-06-17 14:21:16 +03:00
4b3770b311 refactor(frontend): migrate badge patterns to Badge component (8 files)
Replaced inline rounded-full badge patterns and removed 5 duplicated helper functions:
- getStatusBadgeClass (translate/+page, validation-tasks/[policyId])
- getRunStatusBadgeClass (validation-tasks/[policyId])
- getStateClass (LaunchConfirmationPanel)
- getStateTone (CompiledSQLPreview)

All badges now use <Badge variant="..."> from $lib/ui.
2026-06-17 14:21:08 +03:00
abd50c92ed refactor(frontend): migrate EmptyState + dateFormat across 14 files
EmptyState migration (10 files):
- translate/+page, translate/history, validation-tasks, validation-tasks/[policyId],
  validation-tasks/[policyId]/runs/[runId], ConnectionsTab, dashboards/health,
  dashboards/[id]/validation, TaskResultPanel, MaintenanceEventsTable
- Replaced hand-rolled border-dashed patterns with <EmptyState> from $lib/ui

dateFormat migration (5 files):
- FileList, ReportCard, ReportDetailPanel, dashboards/[id]/validation,
  validation-tasks/history
- Removed 5 local formatDate definitions, replaced with shared formatDate/formatDateTime
2026-06-17 14:13:57 +03:00
9da229ea60 feat(frontend): add shared Skeleton component
Skeleton.svelte with line, card, circle, and row variants.
Replaces 30+ hand-rolled animate-pulse patterns across the codebase.
2026-06-17 14:06:42 +03:00
358f38660a feat(frontend): add shared Badge component and dateFormat utility
Consolidation infrastructure:
- Badge.svelte: compact inline badge/chip with variant (success/warning/destructive/info/primary/muted), size, and dot mode
- dateFormat.ts: formatDate, formatDateTime, formatRelativeTime, formatFileSize — replaces 6+ local definitions
- Export Badge from $lib/ui index
2026-06-17 14:05:37 +03:00
149c05bf1c fix(frontend): full ADR compliance — Model-View concept, model decomposition, button migration
P0 — Model-first ADR compliance:
  - Decompose DashboardHubModel (590→496 lines) into Dashboards.FiltersModel,
    Dashboards.SelectionModel, Dashboards.GitActionsModel (DG split per plan)
  - Decompose AgentChatModel (630→356 lines) into ConnectionManager,
    StreamProcessor, LocalStorage, shared types
  - Decompose MigrationModel (457→389 lines) into WizardModel, ExecutorModel

P0 — /ui atom compliance:
  - Replace all raw <button> with <Button> from /ui in dashboards/+page.svelte
    (~20 replacements) and 16 additional routes/ files (~70 replacements total)

P0 — Hierarchical region IDs (ATTN_2):
  - Rename all 22 model #region/#endregion IDs from flat to Domain.Name format
  - Update @ingroup from generic 'Models' to domain-specific (Dashboards, Git, etc.)

P1 — UX contract compliance:
  - Add @UX_STATE declarations to agent/+page.svelte
  - Extract Gradio Client.connect from page into AgentChatModel.retryConnection()

All new model files have proper GRACE anchors (#region/#endregion, @ingroup,
@BRIEF, @INVARIANT, @STATE, @ACTION, @RELATION).

Build: npm run build passes.
Tests: DashboardHubModel 112/112, MigrationModel 74/74 pass.
2026-06-17 14:02:17 +03:00
7d2312c95e feat(frontend): DashboardDataGrid — configurable grid component
Consolidate dashboard grid patterns into a single reusable component with
opt-in features: selection, sorting, filtering, pagination, loading skeleton,
empty state, and bulk actions snippet.

- Add Dashboard.DataGrid component with () state management
- Replace DashboardGrid usage in migration page (removes Validate/Git/Status columns)
- Deprecate DashboardGrid (no longer used by any active route)
- Update RepositoryDashboardGrid header with consolidation rationale
- Add 14 vitest tests covering all features and edge cases

Strategy B consolidation: migration page now uses clean grid with only
Title + Last Modified columns. DashboardGrid marked @DEPRECATED.
RepositoryDashboardGrid noted as future consolidation candidate.
2026-06-17 14:01:15 +03:00
ba8dc2f8c6 fix(package-lock): correct @adobe/css-tools typo (csuperset-tools → css-tools) 2026-06-16 12:03:12 +03:00
ec6421de35 rename ss-tools to superset-tools across the entire project
- Replace all occurrences of 'ss-tools' with 'superset-tools' in 104 files
- Rename git bundle file ss-tools.bundle → superset-tools.bundle
- Update .gitignore pattern accordingly
- Preserve variable names (hasSsTools etc.) and code identifiers
2026-06-16 11:15:19 +03:00
af923972b6 fix(agent): save conversations to DB, fix Test button hang, wire hasNext/search
## Root cause: _save_conversation() dead code + missing message persistence

### Backend: Conversation persistence (3 critical bugs)
- **app.py**: Replaced early  with  so _save_conversation() executes
  after successful stream — was dead code on normal path
- **app.py**: Added _save_conversation call in HITL resume path (confirm/deny)
- **app.py**: Added broad  that saves conversation (at least user
  message) before re-raising on LLM errors (APIConnectionError etc.)
- **app.py**: _save_conversation now passes user_id from JWT (not hardcoded UUID)
  and includes messages[] in payload
- **agent_conversations.py**: save_conversation endpoint now processes body.messages
  and creates AgentMessage records (idempotent by msg id)

### Frontend: Agent chat sidebar wiring
- AgentChatModel.svelte.ts: added public  derived getter
- AgentChatModel.svelte.ts: added  method
- agent/+page.svelte: wired hasNext={model.conversationsHasNext} (was hardcoded false)
- agent/+page.svelte: wired onsearch to model.searchConversations (was no-op)

### Frontend: LLM Provider Test button hang fix
- ProviderConfig.svelte: resetForm/handleEdit now reset isTesting=false, isProbing=false
- ProviderConfig.svelte: Cancel button calls abortPendingRequests()
- ProviderConfig.svelte: Added AbortController lifecycle — cancels in-flight test/fetch
  requests on modal close or provider switch, preventing stale disabled buttons
- provider_config.integration.test.ts: added 6 abort/reset invariant tests
2026-06-14 16:07:06 +03:00
997329e2a5 fix(agent): resolve ModuleNotFoundError for backend, add E2E test infra
- Dockerfile.agent: fix CMD (python -m src.agent.run), use backend/requirements.txt,
  minimal COPY (only src.agent + src.core.cot_logger), add GRACE contract
- docker-compose.yml: SERVICE_TOKEN_SECRET -> SERVICE_JWT (match code)
- docker-compose.enterprise-clean.yml: same env var fix
- docker/.env.agent.example: same env var fix
- build.sh: same env var fix
- chore: semantics-testing SKILL.md, backend tests, pyproject.toml
2026-06-14 15:41:46 +03:00
e37b459e84 chore: fix preview routes, MarkdownRenderer, update opencode config
- _preview_routes.py: fix preview endpoint params for multi-language
- MarkdownRenderer.svelte: renderer fixes for assistant messages
- speckit.analyze.md: update opencode command for spec analysis
- opencode.jsonc: config alignment
2026-06-11 19:13:17 +03:00
85857e10e4 feat(ui): update frontend for direct DB insert — i18n, api client, components, models
- api.ts, api/translate.ts: add connection API methods (fetchConnections,
  createConnection, testConnection, etc.)
- i18n (en/ru): add connection management and insert method translation keys
- TranslationJobModel.svelte.ts: add insert_method, connection_id fields
- ConfigTabForm.svelte, RunTabContent.svelte: integrate InsertMethodSelector
- TranslationPreview.svelte, TranslationRunResult.svelte: show insert method
  badge and connection name in results
- TargetTabForm.svelte, TargetSchemaHint.svelte: insert method awareness
- routes.ts, routes-link-integrity: register connections settings tab
- test_translation_preview.svelte.js: update preview tests
- package.json: update deps as needed
2026-06-11 19:13:05 +03:00
20ae1c70bd feat(ui): add ConnectionsTab and InsertMethodSelector for direct DB enhancement
- ConnectionsTab.svelte: Settings tab for DB connection CRUD with
  list, add/edit form, test button, delete with dependency check
- InsertMethodSelector.svelte: radio group for insert method choice
  (SQL Lab / Direct DB) with filtered connection dropdown
- InsertMethodSelector.test.ts: component tests for all UX states
- settings/+page.svelte, settings-utils.ts: register Connections tab
2026-06-11 19:12:54 +03:00
b3d889b3c7 fix(e2e): add agent image loading to enterprise-clean e2e orchestrator
- Add agent archive check (ss-tools-agent.{tag}.tar.xz) with docker build
  fallback, matching the updated bundle_release()
- Fix pre-existing archive filename mismatch: backend.{tag}.tar.xz →
  ss-tools-backend.{tag}.tar.xz (same for frontend) — archive detection
  was always failing because build.sh uses the ss-tools- prefix
2026-06-11 16:24:17 +03:00
ffc1d39f08 fix(ui): remove tab scrollbar, relocate PROD indicator
- Remove overflow-x-auto/scrollbar-thin from translate job tabs, use flex-1 to fill width
- Remove redundant PROD badge from TopNavbar
- Move PROD context indicator into breadcrumbs row (right-aligned compact badge)
- Remove full-width warning banner and red left border from page content
2026-06-11 16:14:14 +03:00
2796ba5267 fix: DatasetPreview dashboard links missing env_id
Dashboard links in DatasetPreview were constructed without env_id query
parameter, causing 'Отсутствует ID дашборда или окружения' error when
clicking through from dataset detail. Use ROUTES.dashboards.detail()
helper which correctly appends ?env_id= to the URL.
2026-06-11 16:13:27 +03:00
7760214170 test(agent): extend coverage — agent handler, confirmations, conversation API, tools
- test_agent_handler: additional edge cases for streaming, HITL, file upload
- test_confirmations: HITL confirm/deny lifecycle coverage
- test_conversation_api: conversation save/load persistence tests
- test_langchain_tools: tool registration, dual-auth header propagation
- ConversationList.test.ts (frontend): conversation list component tests
- conftest: shared fixtures for agent tests
- task_manager/manager: minor fixes from test coverage
- tasks.md/test-documentation.md: spec and test documentation updates
- speckit.test.md: speckit workflow documentation update
2026-06-10 16:38:06 +03:00
1fd5e55db7 fix(agent): auto-fallback to free port on GRADIO_SERVER_PORT conflict
The Gradio agent (run.py) crashed with OSError when port 7860 was
already occupied by a previous instance. Added _find_free_port() that
scans up to 100 ports from the configured GRADIO_SERVER_PORT and picks
the first available one, logging a warning on fallback.

Contract updates:
- AgentChat.Run: [C:3] [TYPE Module] (was C2/Function), added
  @RATIONALE, @REJECTED, @SIDE_EFFECT for port-finding logic
- AgentChat.GradioApp: added @RATIONALE, @REJECTED
- AgentChat.LangGraph.Setup: added @REJECTED, deduplicated @RELATION
- AgentChat.Tools: added @RATIONALE
2026-06-10 16:37:02 +03:00
143f14d516 chore: remainder — backend test infra, agent config, docker, i18n, frontend ui
- Backend: alembic env, config manager/models, dependencies, translate plugin
- Backend tests: async_sync_regression, integration tests, git services, test_agent
- Docker: docker-compose.yml updates
- Agent: qa-tester.md update, semantics-testing SKILL.md update
- Frontend: TopNavbar, sidebarNavigation, FeaturesSettings, FeatureGate
- i18n: assistant.json en/ru locale updates
- New: frontend/src/lib/components/agent/ directory
2026-06-10 15:06:36 +03:00
2b303f92b3 test: bring frontend test coverage to 98% across core lib modules
## Summary
- Added 35+ new test files and expanded 22+ existing ones
- Coverage: statements 99.65%, lines 99.9%, functions 99.9%, branches 87.77%
- All thresholds enabled and enforced in vitest.config.js

## Details
### Stores (stores/__tests__/)
- test_health.ts, test_translationRun.ts, test_environmentContext.ts
- test_maintenance.ts, test_environmentContext.2.ts
- Expanded sidebar.test.ts, assistantChat.test.ts, taskDrawer.test.ts
- Expanded test_activity.ts, test_datasetReviewSession.ts

### Models (models/__tests__/)
- AgentChatModel.test.ts (77.7%→99.6%), AgentChatModel.2.test.ts
- BranchModel.test.ts, DashboardDetailModel.test.ts
- DashboardHubModel.test.ts (97.9%→100%)
- DatasetDetailModel.test.ts, DatasetReviewModel.test.ts
- DatasetsHubModel.test.ts, DictionaryDetailModel.test.ts
- GitConfigModel.test.ts, GitManagerModel.test.ts
- GitStatusModel.test.ts, HealthCenterModel.test.ts
- LLMReportModel.test.ts, MigrationModel.test.ts
- MigrationSettingsModel.test.ts, TranslateHistoryModel.test.ts
- TranslationJobModel.test.ts, ValidationRunDetailModel.test.ts
- ValidationTasksListModel.test.ts

### API (api/__tests__/, api/translate/__tests__/, api/dataset-review/__tests__/)
- api.test.ts (100% stmts), assistant.test.ts, datasetReview.test.ts
- maintenance.test.ts, corrections.test.ts, datasources.test.ts
- dictionaries.test.ts, jobs.test.ts, runs.test.ts, schedules.test.ts
- useReviewSession.test.ts + useReviewSession.2.test.ts

### Auth (auth/__tests__/)
- permissions.test.ts (95.2%→100%), store.test.ts
- store.browser-off.test.ts (covers !browser guards)

### UI (ui/__tests__/)
- EmptyState.test.ts, FeatureGate.test.ts, FeatureGate.2.test.ts
- HelpTooltip.test.ts, Icon.test.ts, Input.test.ts, Select.test.ts
- LanguageSwitcher.test.ts

### Top-level lib (lib/__tests__/)
- cot-logger.test.ts, routes.test.ts, stores.test.ts
- toasts.test.ts, utils.test.ts

### Helpers (helpers/__tests__/)
- review-workspace-helpers.test.ts

### Source changes (minimal, non-breaking)
- sidebar.svelte.ts: exported loadState() for testability
- HelpTooltip.svelte: removed default () destructuring
- vitest.config.js: coverage scope narrowed, thresholds enforced
- package.json: fixed @vitest/coverage-v8 version mismatch
2026-06-10 14:59:40 +03:00
f87ebf5d4b feat(agent): Gradio-powered LangGraph agent chat with streaming, tool calls, file upload, conversation persistence
- Gradio 5.50.0 ChatInterface with type='messages' streaming
- LangGraph create_react_agent with InMemorySaver checkpointer
- 4 @tool functions: search_dashboards, get_health_summary, list_environments, get_task_status
- Structured ChatMessage metadata (7 discriminator types: stream_token, tool_start/end/error, confirm_required, confirm_resolved, error)
- HITL resume via second submit() with interrupt_before/Command
- Dual-identity RBAC: service JWT + user JWT for tool calls
- File upload (10 MB limit, pdfplumber/xlsx/JSON parser)
- Conversation persistence via POST /api/agent/conversations/save
- REST API: list, history, archive conversations; multi-tab gate; LLM config
- LLM provider selection via Admin -> LLM Settings (assistant_planner_provider)
- Svelte 5 AgentChatModel with stream event queue, dedup, stream_status watcher
- MarkdownRenderer using svelte-markdown with semantic Tailwind tokens
- ToolCallCard (3 states: executing/completed/failed)
- ConversationList with search, date grouping, infinite scroll
- ConnectionIndicator with Gradio health status
- /agent route with two-column layout
- Vite proxy /api/agent/gradio -> Gradio SSE
- Fixed: not_() SQLAlchemy operator, route collision with _admin_routes
- Fixed: conversation_id -> id normalization, .pyc cache staleness
- Fixed: event.data array parsing (Gradio returns [jsonStr, null])
- Requirements pinned: gradio==5.50.0, pydantic>=2.7,<=2.12.3
2026-06-10 10:27:19 +03:00
a7fb06cd8e tasks ready 1 2026-06-09 09:43:34 +03:00