Commit Graph

246 Commits

Author SHA1 Message Date
55eef20958 refactor(frontend): extract ValidationTasksListModel for validation tasks list
Validation tasks list: 521→204 lines (-61%).
Model: paginated list with search, inline CRUD (run/delete/toggle),
debounced search, isMounted guard, initFromLoad() pattern.

7→6 oversized pages remaining.
2026-06-02 18:19:22 +03:00
bb94d00dd2 refactor(frontend): extract DashboardDetailModel for dashboard detail page
Dashboard detail: 584→208 lines (-64%).
DashboardDetailModel.svelte.ts: 14 atoms, 10 async actions,
Git status delegation via GitStatusModel.
Static utilities (formatDate, getValidationStatus, etc.).

8→7 oversized pages remaining.
2026-06-02 18:16:19 +03:00
e171155dba refactor(frontend): extract MigrateDashboardModal + BackupDashboardModal
Dashboard hub page: 1341→808 lines (-533, -40%).
Two modal components extracted yielding line reduction:
- MigrateDashboardModal.svelte: 378-line migration form with dry-run
- BackupDashboardModal.svelte: 158-line backup schedule form

Build passes, all 699 tests pass.
2026-06-02 18:06:37 +03:00
cf7b3556f7 refactor(frontend): enforce semantic tokens + extract 3 Screen Models
Color tokens: 3658→0 violations across 186 .svelte/.svelte.ts files.
All raw Tailwind colors (bg-blue-*, text-gray-*, border-red-*, etc.)
replaced with semantic tokens from tailwind.config.js in 5 perl passes.

Model extraction (11→8 oversized pages):
- LLMReportModel.svelte.ts: LLM report page 413→221 lines
- DatasetDetailModel.svelte.ts: dataset detail page 416→218 lines
- DatasetsHubModel.svelte.ts: datasets hub page 468→246 lines

Tests: 14 assertions updated (color classes + model refs).
Build: 1 duplicate class:text-primary fix in ValidationTaskForm.
All 699/699 tests pass.
2026-06-02 17:58:36 +03:00
29acfb4e69 freeze fix 2026-06-02 16:36:00 +03:00
01e0d1c529 fix(frontend): persist active run in sessionStorage — survive tab close/reopen
Problem: closing and reopening the translate job page (or tab close+reopen)
lost the progress bar because the in-memory store starts fresh. The backend
keeps translating, but the UI shows no progress.

Fix:
- Store: save {runId, jobId, isFullRun} to sessionStorage on startTranslationRun()
  via _saveToSessionStorage()
- Store: add reconnectToRun() — re-establishes WS without resetting store state,
  preserving any progress data already received
- Store: add getStoredActiveRun() — public reader for sessionStorage
- Store: clear sessionStorage via _clearSessionStorage() on terminal states
  (added to _cleanup() called by WS terminal, max-reconnects, stop, reset)
- Page: add  that checks getStoredActiveRun() after job loads
  and calls reconnectToRun() to pick up the live progress

Edge cases handled:
- Store already connected to same run → skip (no duplicate WS)
- sessionStorage unavailable → silent catch
- SPA navigation → store already has the run, WS still connected → skip
- Page reload → sessionStorage has the run, reconnects
- Tab close + reopen → same as reload
- Run completes while away → sessionStorage cleared by _cleanup()
- Run already finished → getStoredActiveRun() returns null → skip

Build  698 tests 
2026-06-02 15:22:30 +03:00
ad62f02ad8 fix(frontend): add WS reconnect + timeout safety nets for translate runs
QA found critical regression: after removing HTTP polling, a WS
disconnect left the UI permanently stuck (uxState='running' forever).

Fixes:
- WS reconnect: up to 3 attempts with 10s backoff on close (non-1000/1005)
- App timeout: 600s (10 min) max — transitions to failed if stuck
- Stale log message: removed 'falling back to polling' (no longer exists)
- Contract header: updated @BRIEF, restored @UX_STATE/@UX_FEEDBACK/@UX_RECOVERY
- cleanup(): unified WS close + timer clear (used by stop, timeout, terminal)
- onclose handler: triggers reconnect via _handleWsFailure()
- onerror handler: defers to onclose (fires after error)
- onopen handler: resets _reconnectCount on successful connect
- Terminal states: call _cleanup() to stop reconnect timer + timeout

Build  698 tests 
2026-06-02 15:01:15 +03:00
6e4ffd00b6 refactor(frontend): remove HTTP polling fallback — WS-only for translate runs
Previously startTranslationRun() used both WebSocket + 2s HTTP polling.
After WS debug logging was added, the HTTP fallback is no longer needed:
- WS streams status every 1s from backend
- WS handler already detects terminal states + fires onComplete
- WS errors are now logged (onerror → console.warn)

Removed: pollStatus(), _pollingInterval, _pollCount, MAX_POLLS,
         fetchRunStatus import, setInterval in startTranslationRun,
         clearInterval in stopTranslationRun.

Build  698 tests 
2026-06-02 14:44:47 +03:00
5a377dffa5 fix(frontend): add WebSocket debug logging — silent failures now visible
Before: _connectWebSocket swallowed all errors silently.
- onerror → silent null
- onclose → silent null
- catch → silent null

Now:
- onopen: console.debug with runId
- onerror: console.warn — fallback to polling
- onclose: console.debug with code/reason
- catch: console.warn with error string

This helps diagnose WS auth failures (wrong token, CORS, etc.)
vs successful WS connections in browser console.
2026-06-02 14:37:53 +03:00
f87092c4a7 feat(translate): add cache_hits counter — backend + frontend
Backend:
- TranslationRun model: add cache_hits Integer column (default 0)
- TranslationRunResponse schema: add cache_hits field
- _helpers.py/_run_list_routes.py/orchestrator_aggregator.py: include
  cache_hits in all run API responses
- _batch_proc.py: count pre_rows served from translation cache per
  batch, return cache_hits in batch result
- executor.py: accumulate cache_hits across batches, persist to run
- Alembic migration: dabc9709 — add cache_hits column to translation_runs

Frontend:
- translationRun.svelte.ts: add cacheHits to store state, WS handler,
  polling handler
- TranslationRunProgress.svelte: 5-col stats grid with purple Cache card
- TranslationRunGlobalIndicator.svelte: 5-col stats with Cache
- TranslationRunResult.svelte: 5-col detail stats with Cache card
- History page: cache_hits shown in run list row + detail panel

Visual: cache hits shown in purple alongside green/yellow/red metrics
(total/success/failed/skipped). Visible during run + in history.

Tests: backend 69/69 translate tests , frontend 698/698 tests ,
frontend build 
2026-06-02 11:59:57 +03:00
7f48b19f28 fix 2026-06-02 11:46:00 +03:00
a95f070441 feat(frontend): add DashboardHub components, EmptyState, and validation scaffold
- DashboardHubModel.svelte.ts: Screen Model for dashboard listing hub
  with filters, pagination, and selection state.
- DashboardRow.svelte: Individual dashboard card with Git/health badges.
- ColumnFilterPopover.svelte: Column-based filter dropdown for dashboards.
- dashboard-helpers.ts: Shared dashboard utility functions.
- EmptyState.svelte: Reusable empty state component with icon and CTA.
- validation route scaffold for per-dashboard validation views.
2026-06-02 09:56:25 +03:00
8219540ade feat(backend): add v2 LLM validation fields to health service
- DashboardHealthItem schema: add run_id, policy_id, execution_path,
  issues_count, timings, token_usage, screenshot_paths, chunk_count,
  dashboard_name fields for v2 LLM validation reporting.
- HealthService: populate v2 fields from validation run records.
- ValidationService: update to support v2 validation run fields.
- validation_tasks route: minor fix for v2 field handling.
- tailwind.config.js: refactor design tokens — add success/warning/info
  palettes, surface/border/text hierarchy, semantic action colors.
- Agent configs: update svelte-coder and semantics-svelte for
  .svelte.ts runes and Screen Model patterns.
2026-06-02 09:54:42 +03:00
4fc3356312 refactor(frontend): migrate Svelte stores from .ts to .svelte.ts runes
- Delete legacy .ts stores (auth, activity, assistantChat, datasetReview, environmentContext, health, sidebar, taskDrawer, translationRun)
- Create new .svelte.ts runes-based stores using  reactive primitives
- Migrate i18n: /i18n → /i18n/index.svelte.js
- Migrate toasts: /toasts → /toasts.svelte.js
- Update all component imports across 180+ files: components, pages, routes, lib
- Remove fromStore() wrappers — use store.value directly with Svelte 5 runes
- Update test mocks for new import paths
- Add @DEPRECATED annotation to legacy  alias
2026-06-02 09:54:18 +03:00
f16096cbcd fix(api): add missing fetchApiBlob to api export object
downloadSkippedCsv and downloadFailedCsv call api.fetchApiBlob()
but it was not exposed on the api object — causing
"o.fetchApiBlob is not a function" at runtime.
2026-06-01 23:30:19 +03:00
28b28338c5 fix(translate): исправление INSERT + выгрузка CSV для неуспешных запусков
**Исправления ошибок:**
- superset_executor: убран несуществующий fallback endpoint /api/v1/sql_lab/execute/
  (правильный URL /api/v1/sqllab/execute/ подтверждён браузерным запросом Superset)
  Ошибка 500 (permission denied) больше не маскируется 404
- orchestrator_run_completion: run.status=FAILED при провале insert
  (раньше всегда ставился COMPLETED). timeout тоже treated as failure
- test_orchestrator: assertion обновлён COMPLETED→FAILED

**Новая функция — выгрузка CSV:**
- GET /api/translate/runs/{run_id}/failed.csv — возвращает CSV с успешно
  переведёнными, но не вставленными записями (status=SUCCESS)
- Колонки: record_id, source_*, target_sql, source_data (JSON), языки, error_message
- Метаданные запуска (run_status, insert_status, run_error) в конце файла
- Кнопки скачивания в 3 местах фронта:
  - История запусков (при status=FAILED)
  - TranslationRunProgress (insert_failed)
  - TranslationRunResult (failed/partial/insert_failed)
- downloadFailedCsv() через fetchApiBlob + Blob URL
2026-06-01 22:38:52 +03:00
40e364d9f6 fix 2026-06-01 17:09:40 +03:00
4c5da7e4d9 alembic fix 2026-06-01 16:34:07 +03:00
e12a9ddfce fix(tests): fix all 3 remaining pre-existing test failures
All 651 tests pass, 71 test files, 0 failures.

Changes:
1. dashboard-profile-override (×2):
   - Mock call count race condition: getDashboards fires extra call on mount
   - Fix: use mockImplementation with override tracking instead of mockResolvedValueOnce
   - No more brittle call-count assertions

2. dataset_review_workspace:
   - goto mock not connected: /navigation mock created standalone vi.fn()
     instead of reusing hoisted mockedGoto
   - postApi resolved immediately, too fast for waitFor to catch 'importing'
   - Fix: deferred postApi promise + fixed goto mock reference
   - Also added missing import { goto } from '/navigation' in page component

3. Earlier fixes (from previous commit):
   - TargetSchemaHint: result.missing_columns → res?.missing_columns
   - CorrectionCell: border-blue-300 → border-blue-600
   - TranslationPreview: @UX_STATE: → @UX_STATE (no colon)

Attempts summary:
  - [ATTEMPT: 1] TS migration complete, 6 pre-existing failures
  - [ATTEMPT: 2] Fixed 3 stale assertions (border-blue, @UX_STATE, result. → res?.)
  - [ATTEMPT: 3] Fixed remaining 3 (mock race, goto connection, missing import)
2026-06-01 15:58:20 +03:00
6b4c3d45ee fix(tests): fix 3 stale test assertions — 6 fail → 3 fail
Fixed:
  - TargetSchemaHint: result.missing_columns → res?.missing_columns (component uses res?)
  - CorrectionCell: border-blue-300 → border-blue-600 (class changed)
  - TranslationPreview: @UX_STATE: → @UX_STATE (no colon per GRACE format)

3 remaining pre-existing failures (not from migration):
  - dashboard-profile-override (×2): vi.fn() mock call count race condition
  - dataset_review_workspace: waitFor timeout, unreachable DOM state

Before: 641 pass / 6 fail
After:  648 pass / 3 fail
2026-06-01 15:49:37 +03:00
52bea154b7 feat(ts-migration): final cleanup — 3 more files JS→TS
Deleted stale .js files (taskService, toolsService, report_page.contract.test)
7 .svelte.js test files intentionally preserved (Svelte 5 convention)

Final metrics:
  - Production JS files: 0
  - Production TS/TSX/Svelte files: all
  - npm run build 
  - npm run test  (645 passed, 6 pre-existing)
2026-06-01 15:44:52 +03:00
ed4562d199 feat(ts-migration): Phase 3-4 — all components + tests JS→TS
Converted 11 remaining production files:
  - services/*.ts (toolsService, taskService, git-utils, storageService,
    adminService, gitService)
  - lib/auth/permissions.ts
  - lib/components/layout/sidebarNavigation.ts
  - lib/components/reports/reportTypeProfiles.ts
  - components/git/useGitManager.ts
  - routes/datasets/review/useReviewSession.ts
  - routes/datasets/review/review-workspace-helpers.ts
  - routes/settings/settings-utils.ts

All production files have proper GRACE contracts:
  - C2/C3 with @BRIEF, @PRE, @POST, @SIDE_EFFECT, @RELATION
  - Generic <T = unknown> for API calls
  - Typed interfaces for state/options

Phase 3: 126 .svelte components → <script lang="ts">
Phase 4: 53 test .js files → .ts

Final verification:
  - npm run build 
  - npm run test  (66 passed, 6 pre-existing failures unchanged)

Total: 0 .js files remain in production code
2026-06-01 15:43:20 +03:00
03557d38cc feat(ts-migration): Phase 2.4 — all stores JS→TS with contracts
Converted 10 files:
  - stores.ts [C:3] — plugins, tasks, selection stores + fetchPlugins/fetchTasks
  - stores/health.ts [C:3] — health summary with polling dedup + derived failingCount
  - stores/activity.ts [C:2] — derived active task count for navbar badge
  - stores/sidebar.ts [C:3] — sidebar expansion, navigation, mobile overlay + localStorage persist
  - stores/taskDrawer.ts [C:3] — drawer open/close, resource-to-task mapping, auto-open pref
  - stores/environmentContext.ts [C:3] — environment selector, localStorage persist, derived env
  - stores/assistantChat.ts [C:3] — panel toggle, conversation binding, seed messages, focus target
  - stores/datasetReviewSession.ts [C:4] — session CRUD, dirty flag, UiPhase derivation
  - stores/translationRun.ts [C:4] — WebSocket + polling, uxState FSM, derived active/finished
  - stores/maintenance.svelte.ts [C:4] — Svelte 5 runes (), WS reconnect, CRUD

Build: npm run build passes
2026-06-01 15:24:10 +03:00
3ef06da8a2 feat(ts-migration): Phase 2.3 — all API satellite modules JS→TS with full contracts
Converted 12 files:
  - api/assistant.ts [C:3] — chat, conversations, history, confirm/cancel
  - api/reports.ts [C:3] — list/detail fetch with query builder
  - api/datasetReview.ts [C:3] — optimistic-lock, conflict detection, DTO normalization
  - api/maintenance.ts [C:3] — start/end events, settings, banners
  - api/translate.ts [C:2] — barrel re-export
  - api/translate/jobs.ts [C:2] — CRUD + duplicate
  - api/translate/runs.ts [C:2] — trigger, status, history, retry, cancel, metrics
  - api/translate/dictionaries.ts [C:3] — dictionary + entry CRUD, import
  - api/translate/datasources.ts [C:2] — columns, preview, approve/edit/reject rows
  - api/translate/corrections.ts [C:2] — inline edit, bulk replace, CSV download
  - api/translate/schedules.ts [C:2] — cron CRUD, enable/disable, next executions
  - api/translate/target-schema.ts [C:2] — schema validation with graceful error fallback

Each function:
  - Typed parameters + generic <T = unknown> return
  - @POST / @SIDE_EFFECT / @RELATION DEPENDS_ON chains
  - Normalized TranslateApiError pattern (message, code, retryable)
  - checkTargetTableSchema has @RATIONALE for graceful error handling

Build: npm run build passes cleanly
2026-06-01 15:21:41 +03:00
50f5c4ce4d feat(ts-migration): Phase 1 — core API layer JS→TS with full GRACE contracts
Converted:
  - toasts.js → toasts.ts (typed Writable<Toast[]>, typed addToast/removeToast)
  - api.js → api.ts (C5 module with 12 nested C2/C4 function contracts)
  - utils.js → utils.ts, utils/debounce.js → debounce.ts
  - Updated 67 import references across src/ (.js extension stripped)
  - Added types/api.ts, types/models.ts, types/validation.ts (foundation DTOs)

api.ts contracts:
  - Top-level: [C:5] with @INVARIANT, @DATA_CONTRACT, @RATIONALE, @REJECTED
  - C4 functions: buildApiError, notifyApiError, shouldSuppressApiErrorToast
  - C2 helpers: getWsUrl, getTaskEventsWsUrl, getMaintenanceEventsWsUrl,
    getTranslateRunWsUrl, getAuthHeaders
  - C4 fetch/request wrappers: fetchApi, fetchApiBlob, postApi, deleteApi, requestApi
  - C3 endpoint registry: api.* methods with @RELATION DEPENDS_ON chains
  - All C4 functions have @PRE/@POST/@SIDE_EFFECT
  - all generic <T = unknown> for type-safe API responses

Build: npm run build passes cleanly
2026-06-01 15:11:35 +03:00
b4b0deb856 js - ts + fix 2026-06-01 14:40:17 +03:00
79d8d5f7bb fix(ui): normalize screenshot field names in run detail load function
API returns 'screenshot_paths' but frontend template reads 'screenshots'.
Without field mapping, screenshots are never displayed.

Fix: map screenshot_paths -> screenshots and logs_sent_to_llm -> logs_sent
in the +page.js load function.

Also verifies that /api/storage/file endpoint exists (mounted at /api/storage)
and the frontend API_BASE_URL='/api' correctly prefixes /storage/file.
2026-06-01 08:44:28 +03:00
f388961b9f fix(ui): prevent duplicate key error in issues table
Svelte each block key used , but when
two issues share the same message text (e.g. 'Main content area
is completely blank') and have no id, the key collides.

Fix: use composite key
as fallback when issue.id is missing.
2026-06-01 08:33:05 +03:00
2760fa09ea feat(validation): chunk screenshots by max_images limit + fix websocket crash
- analyze_dashboard_multimodal now splits screenshots into chunks
  of max_images (from provider config) and sends them in parallel
- Results merged: worst status, deduped issues by (severity, msg, loc)
- New helper methods: _deduplicate_issues, _merge_chunk_results, _call_llm_for_images
- Plugin passes db_provider.max_images to the LLM client
- Report UI shows 'Chunked ×N' badge when analysis used multiple chunks
- i18n: added 'chunked' / 'По частям' key to validation.json
- Fix: isinstance(StopIteration) -> isinstance(_ws_exc, StopIteration)
  which crashed the websocket and broke task execution mid-flight
- Fix: update test mocks (_FakeLLMClient, _FakeScreenshotService)
2026-05-31 22:43:06 +03:00
40c9f849b2 feat(validation): v2 frontend — pages, components, stores, i18n
Frontend implementation for v2 LLM dashboard validation:
- validation-tasks/ pages (list, create, edit, detail, runs, history)
- ValidationTaskForm with 5-step wizard, LLM provider selector
- ValidationTaskReport with collapsible dashboard issue cards
- WebSocket task drawer with progress tracking and reconnect logic
- Dashboard page integration with validation status, history, health
- API layer: fetchApi/requestApi wrappers with trace_id propagation
- CoT logger (frontend) for structured JSON logging
- i18n: validation.json with 117 keys each for en/ru
- Settings refactor: consolidated admin settings, provider bindings
- ScheduleAtAGlance health widget, sidebar navigation update
2026-05-31 22:32:27 +03:00
431330231f cleanup(validation): remove v1 validation routes and frontend pages
Delete deprecated code that has been fully replaced by v2:
- backend: validation.py routes, validation_run_service.py
- frontend: validation.js API module, validation/ pages
2026-05-31 22:32:14 +03:00
5e5f958eaa feat(llm): auto-detect max images per request for LLM providers
Add binary-search probe endpoint POST /providers/{id}/probe-max-images
that discovers the per-request image limit by sending incrementally
more 1x1 JPEGs via the provider's own API. Result is cached in the
new max_images column on the provider config.

- LLMProviderConfig: add max_images: int | None
- LLMProvider (SQLAlchemy): add max_images column
- Migration ed28d34edde7: clean ADD COLUMN
- LLMProviderService: create/update/set_max_images
- POST /providers/{id}/probe-max-images: binary search + error parsing
- ProviderConfig.svelte: 'Detect' button in edit modal + HelpTooltip
- i18n (en/ru): 11 new keys for probe UI
2026-05-31 22:31:36 +03:00
e17f4f64a9 websocket add 2026-05-31 17:17:30 +03:00
15b466a918 feat(translate): move write settings to Target Config tab + fix datasource name lookup
Fixes:
- Move batch size, upsert strategy, include source reference
  from Config tab to Target Config tab (Write Settings section)
- Fix 'Dataset #26' fallback — look up real datasource name
  via API when source_table is not saved in job data
- Persist include_source_reference in save payload and
  restore from job data on load (was a pre-existing gap)

QA review fixes:
- Update @BRIEF contracts for both tabs
- Fix import indentation in +page.svelte

Other: help tooltips on translate pages, flow hint on list page,
git migration manager components, dashboard hub pages,
migration settings pages
2026-05-31 09:59:09 +03:00
9ef9fae206 fix: critical QA findings — dead code and prop mismatch
1. Remove get_config_manager() call from translate_run_websocket
   (@app.websocket /ws/translate/run/{run_id}) — was not imported
   and unused. Also remove unused from sqlalchemy.orm import Session.
2. Fix prop name mismatch: showBulkReplace -> showPageBulkReplace
   in RunTabContent. Use () for reactive two-way binding.
3. Add ('DRAFT') for status prop in RunTabContent.
2026-05-29 16:47:50 +03:00
db7e5e3863 feat(translate): add WebSocket endpoint for real-time run progress
Backend:
- Add /ws/translate/run/{run_id} WebSocket endpoint in app.py
- Streams structured run status every second (total_records,
  successful_records, failed_records, progressPct, batch_count, etc.)
- Auto-detects terminal states (COMPLETED, FAILED, CANCELLED) and closes
- Authenticated via JWT/API key token query param

Frontend:
- Add getTranslateRunWsUrl() URL builder in api.js
- Update translationRunStore to use WebSocket instead of log stream
- WebSocket receives structured status JSON, updates store reactively
- Falls back to polling silently if WebSocket fails
- Keep polling as fallback for insert phase
2026-05-29 16:42:59 +03:00
1aceba465b fix: remove orphaned functions, add for auto-load columns
Clean up remaining orphaned references after tab extraction:
- Remove loadColumnsForDatasource, searchDatasources, selectDatasource
  etc. from page (moved to ConfigTabForm)
- Add  on datasourceId in ConfigTabForm for auto-loading
  columns when parent sets datasourceId (loadJob)
- Fix stray braces, remove dead isVirtual function
- Page now 779 lines (down from 1519, -49%)
2026-05-29 16:35:50 +03:00
ffa6234a36 refactor: remove orphaned functions after tab extraction
Remove loadColumnsForDatasource, searchDatasources, selectDatasource,
toggleContextColumn, toggleSourceKeyCol, updateTargetKeyCol, isVirtual
from page — all moved to ConfigTabForm.svelte.

Add  on datasourceId in ConfigTabForm to auto-load columns
when parent sets datasourceId (loadJob) or user selects a datasource.
2026-05-29 16:33:15 +03:00
ebc00bbb0e refactor(translate): extract ConfigTabForm, TargetTabForm, RunTabContent from page
Page reduced from 1519 to 909 lines (-40%). Extracted:
- ConfigTabForm.svelte (370 lines) — datasource search, column mapping,
  LLM, target languages, dictionaries, batch config
- TargetTabForm.svelte (120 lines) — target schema/table/database,
  target column mapping, TargetSchemaHint
- RunTabContent.svelte (170 lines) — run cards, progress, history

All three components use () props for seamless parent
state sync. Sub-components (TargetSchemaHint, TranslationPreview,
TranslationRunProgress, ScheduleConfig, BulkReplaceModal) unchanged.
2026-05-29 16:30:09 +03:00
05fda8310d refactor(translate): add UX contracts to translation job page
Add comprehensive UX contract header documenting:
- @UX_STATE: all states of the page-level state machine (idle, loading,
  configured, saving, validation_error, datasource_unavailable, error)
- @UX_STEP: 5 logically separated steps/tabs (Config, Preview, Target, Run, Schedule)
- @UX_FEEDBACK: toasts, modals, inline progress, schema validation
- @UX_RECOVERY: retry paths for save/preview/run failures
- @UX_REACTIVITY: props, local state, derived, effects, store bindings
- @UX_DEPENDENCY: data flow between datasource selection, env switching,
  config validity, and tab availability
- @UX_TEST: test scenarios for the automated Judge Agent

Also remove leftover sourceDialect/targetDialect selects from UI
(now sent as sensible defaults in save payload).

Sub-components (TargetSchemaHint, TranslationPreview, TranslationRunProgress,
ScheduleConfig, BulkReplaceModal) already have UX contracts.
2026-05-29 16:25:14 +03:00
c9fb994728 fix(translate): remove source/target dialect selects from UI
These fields were showing database types (PostgreSQL, ClickHouse)
as human language options for the LLM prompt, which was confusing.
Now sending sensible defaults (source='SQL', target='en') directly
in the save payload without exposing them in the UI.

The backend already has fallbacks:
  _llm_call.py: source_language = job.source_dialect or 'SQL'
  _batch_proc.py: target_langs = or [job.target_dialect or 'en']
2026-05-29 16:16:05 +03:00
5deb01e182 fix 2026-05-29 16:15:41 +03:00
e7d4121dc9 fix(translate): replace DB types with human languages in source/target dialect selects
sourceDialect/targetDialect select options contained database types
(PostgreSQL, ClickHouse, MySQL...) while these fields are used as
human language indicators for the LLM prompt:
  _llm_call.py: source_language = job.source_dialect or 'SQL'

Changed to use the existing LANGUAGES list (from LANGUAGE_LABELS:
ru, en, de, fr, es, etc.) plus 'SQL' option for source dialect.
Defaults updated: source='SQL' (SQL-like expressions), target='en'.
2026-05-29 16:14:49 +03:00
b850fad7a7 fix(translate): restore environmentId before loading databases in loadJob
Bug: loadDatabases() was called at line 374 while environmentId still
held the FIRST environment from initialization (line 259), because
environmentId = j.environment_id was not set until line 391 (inside
the datasource block). Only after that was environmentId correct.

This caused the database dropdown to show databases from a different
environment than the job's actual environment. For example, db_id=2
is DEV Greenplum in 'dev' but Prod Clickhouse in 'preprod'. The user
would select Greenplum from the dev list, but the job would use
preprod where db_id=2 is ClickHouse.

Fix: set environmentId from the job's stored environment BEFORE
calling loadDatabases(), and outside the datasource conditional
so it runs for all existing jobs.
2026-05-29 16:11:10 +03:00
525e0a56af fix(translate): add database_id to datasources response + auto-select on frontend
Root cause: fetch_available_datasources did not return database_id,
so frontend could not auto-set target_database_id when user selected
a datasource. User then had to manually pick a database on Target Config
tab — and could accidentally select the wrong one.

Backend changes:
- Add 'database_id' field to datasources response (from db_info.get('id'))
- Add _database_name tracking in SupersetSqlLabExecutor with getter
- Add database_name + database_backend to TargetSchemaValidationResponse
- Enrich resolve_database_id logging with database_name and all_keys

Frontend changes:
- In selectDatasource(), auto-set targetDatabaseId from ds.database_id
  when present, so the correct target DB is used for schema checks.
2026-05-29 15:36:36 +03:00
477e30a9f2 git 2026-05-27 23:24:12 +03:00
3619a2ae78 feat(assistant): implement tool registry and expand assistant capabilities
Introduce a centralized tool registry system for the assistant to manage
executable operations, permissions, and tool catalogs. This refactors
the assistant dispatch logic from a monolithic approach to a modular,
decorator-based registry.

Key changes:
- Implement `AssistantToolRegistry` to handle tool registration,
  permission checks, and safe operation identification.
- Add a suite of new assistant tools: backup, commit, branch creation,
  deployment, health summary, environment listing, LLM operations,
  maintenance, migration, and dashboard searching.
- Refactor `_dispatch.py` and `_llm_planner.py` to utilize the new
  registry for intent resolution and tool catalog building.
- Enhance the LLM planner to support more descriptive clarification
  responses in Russian when intents are ambiguous.
- Update the frontend to support the new tool-based workflow, including
  improved i18n labels for assistant operations and a new step-by-step
  wizard for the migration page.
- Add ADR-0008 to document the architectural decision for the tool
  registry.
2026-05-27 18:05:28 +03:00
8db2b1bb6b fix: replace hardcoded UI labels with i18n translations
- Add missing i18n keys to common.json, reports.json, dashboard.json,
  tasks.json, git.json (EN + RU)
- Replace all hardcoded labels in LLM report page with .reports.* keys
- Replace hardcoded tab labels (Linked resources, Git history) in
  DashboardDetail page
- Replace hardcoded RU text in DashboardGitManager with .git.* keys
- Remove hardcoded fallback strings from DashboardHeader, DashboardTaskHistory
2026-05-27 16:53:20 +03:00
ee08e2f3dd fix 2026-05-26 18:15:37 +03:00
f49b7d909e feat: GRACE-Poly protocol optimization — ~3200→10 warnings (↓99.7%)
Full optimization cycle:

Protocol (15 files):
- 4-layer SSOT architecture for agent prompts & skills
- Anti-Corruption Protocol consolidated from 5 duplicates
- Tag-to-tier permissiveness matrix (all @tags allowed at all tiers)

Axiom config:
- complexity_rules: all 22+ tags available on C1-C5
- contract_type_overrides: removed (was narrowing per-type)
- 18 new tags added, LAYER enum expanded (Infra, Frontend, Atom, etc.)
- RELATION predicates expanded (USES, CONTAINS, BELONGS_TO, etc.)

Code fixes:
- 2216 @TAG: normalized to @TAG (colon→space)
- 518 [DEF] blocks migrated to #region/#endregion (37 files)
- VERIFIES→BINDS_TO, :Class/:Function suffixes removed, paths→IDs
- 1173-line _external_stubs.py deleted (EXT: handled natively)
- Batch EXT: reference audit (240 targets: 132 external, 99 internal, 9 fix)
- QA regression check: 0 regressions across all checks

Infrastructure:
- DuckDB rebuild stabilized (appender API, INSERT OR IGNORE)
- Anchor regex fix (parent-child BINDS_TO now resolves)
- EXT:*/DTO:/NEED_CONTEXT: regex fixed in validator
- 34MB Doxygen API portal (3194 contract pages)
2026-05-26 11:14:25 +03:00