Commit Graph

302 Commits

Author SHA1 Message Date
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
8e8a3c3235 feat: attention-optimized semantic protocol v2.7
Core changes:
- Add @defgroup/@ingroup to 1791 C2+ contracts (555 files) for HCA 128× pre-training DSA grouping
- Add §0.1 Pre-Training Frequency matrix to semantics-core
- Add §VIII Attention Architecture rules (ATTN_1-4) with MLA/CSA/HCA/DSA mechanics
- Add @defgroup/@ingroup to canonical syntax (§II) and all contract examples

Agent prompts (5 files):
- Add ZERO-STATE RATIONALE with MLA/CSA/HCA/DSA compression mechanics
- Add pre-training note: @RATIONALE/@REJECTED are in-context learned tags
- svelte-coder: add missing #region contract, fix Svelte rule violations
- python-coder/fullstack-coder: honor function contracts from speckit plan
- qa-tester: add attention compliance audit (P3 ATTN_1-4 checks)

Skills (6 files):
- Translate all axiom_config descriptions to English
- Fix doc_dirs to index .opencode/ and .specify/
- Deduplicate 5× complexity_rules → single global_tags catalog
- Reduce semantics-svelte 591→485 lines (remove duplicate code blocks)
- Fix semantics-testing: 'Short IDs' → 'Short hierarchical IDs'
- Fix all examples: flat IDs → hierarchical Domain.Name format
- Fix Svelte examples: replace raw Tailwind + <button> with semantic tokens + /ui

Speckit workflow (commands + templates):
- speckit.plan: add Function-Level Contracts for C3+ with @PRE/@POST/@TEST_EDGE
- speckit.plan: add Attention Compliance Gate (ATTN_1-4 before contract generation)
- speckit.tasks: add function contract inlining format (constraints in task description)
- speckit.specify: load semantics-core for spec density rules
- spec-template: add #region contract, @SEMANTICS grouping, hierarchical IDs
- ux-reference-template: add #region wrapper
- plan-template: add attention gate, @defgroup/@ingroup guidance
- tasks-template: add attention audit + rebuild + orphan check tasks
- constitution.md: translate to English, add Principle VIII (attention-optimized contracts)

Reference modules rewritten (hierarchical IDs + full contracts):
- Auth.Jwt: 6 child contracts with @RATIONALE/@REJECTED/@TEST_EDGE
- Api.Auth: 5 endpoints with @TEST_EDGE + molecular CoT markers
- Migration.Model: @defgroup Migration with 18 @ACTION + 6 @INVARIANT

Scripts:
- add_defgroup_ingroup.py: zero-risk additive @ingroup migration (1791 insertions)
- migrate_hierarchical.py: flat→hierarchical ID dry-run analysis (792 contracts)
- merge_prompts.py: merge all prompts/skills/commands into one review file

Config:
- axiom_config.yaml: 749→395 lines (-47%), English, doc_dirs include prompts
- Fix test_datasets.py import collision (rename → test_datasets_routes.py)
- Fix test_preview.py: SupersetClient→get_superset_client, AsyncMock, logger f-string
2026-06-08 16:30:59 +03:00
72fcf698af 033: fix preview_translation route + MultiSelect label regression
1. preview_translation route: missing await on async preview_rows()
   - preview_rows() is async def, called without await
   - returned coroutine object instead of result -> 'coroutine not iterable' error

2. MultiSelect.svelte: opt.label -> opt.name
   - option type is {code, name} but template used {opt.label}
   - rendered empty spans instead of language names
2026-06-05 11:38:35 +03:00
fe2602dc89 032: fix duplicate class:border-warning / class:bg-warning-light in TargetSchemaHint
Svelte 5 does not allow duplicate class: directives on the same element.
The two class:border-warning (and two class:bg-warning-light) conditions
were mutually exclusive but Svelte rejected them at compile time.
Merged into single || condition.
2026-06-04 23:56:00 +03:00
0721681cfe 032: fix(TargetSchemaHint) — differentiate transient errors (503/504) from table not found
HIGH: 'bodyClass' and display logic updated — 503/504 errors now show
warning (yellow) styling and 'Could not verify' message instead of
destructive (red) 'Table not found'. Backend now returns 503 on pool
exhaustion and 504 on upstream timeout after async refactoring.
2026-06-04 23:34:45 +03:00
41a3a41ec4 test(frontend): add model unit tests for Screen Models
Add L1 invariant tests for all Screen Models:
- DashboardDetailModel: test load, delete, pagination, column filter
- DashboardHubModel: test load, environment switching, selection, git actions
- DatasetDetailModel: test load, edit, delete
- DatasetsHubModel: test load, filter, pagination
- DictionaryDetailModel: test load entries, add, edit, delete, search
- LLMReportModel: test load, filter, report generation
- TranslateHistoryModel: test load runs, filter, pagination
- ValidationRunDetailModel: test load details, records
- ValidationTasksListModel: test load tasks, status transitions

Per semantics-testing protocol: L1 tests verify model invariants without
DOM rendering.
2026-06-04 16:17:59 +03:00
2f9058d888 feat(frontend): add admin/tools pages, i18n, UI improvements, route annotations
New pages:
- /admin: admin overview page with links to user/role/settings/LLM management
- /tools: tools overview page with links to mapper/debug/storage/backup tools

i18n:
- nav.json (en/ru): add description keys for admin and tools sub-items
- migration.json (en/ru): add help tooltips and step-by-step instructions
  for the database mapping workflow

UI components:
- EnvSelector: add optional helpText with HelpTooltip
- MappingTable: add HelpTooltip for status column
- MultiSelect: add id for accessibility, fix label element structure
- Input: fix reactive id assignment with ()
- Select: fix reactive id assignment with ()

Routes:
- routes.ts: add admin.overview() and tools.overview() routes
- dashboards/+page.svelte: add @RELATION BINDS_TO annotation
- migration/mappings/+page.svelte: add HelpTooltip, Card imports, help texts
- translate pages: minor annotation updates

Other:
- .gitignore: add backend/:memory (SQLite test artifact)
2026-06-04 16:17:52 +03:00
f6cbca2214 feat(frontend): update translate components + BackupManager
Translate components:
- BulkReplaceModal: add dictionary selection dropdown to save replacements
  directly to a dictionary after applying bulk find-replace
- CorrectionCell: improve inline edit UX with better state handling
- TermCorrectionPopup: enhanced popup for term corrections
- ConfigTabForm: update form field bindings
- RunTabContent: minor layout adjustments
- ScheduleConfig: improved schedule configuration UI
- TranslationPreview, TranslationRunGlobalIndicator, TranslationRunProgress:
  UX polish and state management improvements

BackupManager:
- Add AbortSignal.timeout(30s) to prevent infinite loading state
- Add onDestroy AbortController cleanup to prevent stale state
- Add error toasts for failure states (was missing — state hung forever)
- Import API_REQUEST_TIMEOUT from api.ts
2026-06-04 16:17:14 +03:00
26dfde81a5 refactor(frontend): migrate health center page to HealthCenterModel
Extract state management from inline health page into HealthCenterModel:

- HealthCenterModel.svelte.ts (new): hosts all state atoms (),
  derived values (), and core actions (load, filter, delete)
- health page reduced from ~120 to ~27 lines of script — thin shell
  delegating to model; only DOM/template concerns remain
- Integration test updated for model-based architecture
- HealthCenterModel.test.ts (new): model invariant tests
2026-06-04 16:17:03 +03:00
380fd4c2fa refactor(frontend): migrate dataset review to DatasetReviewModel
Extract all state management from the inline page into a dedicated
DatasetReviewModel class following the Screen Model pattern:

- DatasetReviewModel.svelte.ts (new): hosts all state atoms (),
  derived values (), and core actions (load, submit, export)
- review-workspace-helpers.ts moved from routes/ to /helpers/
- useReviewSession.ts moved from routes/ to /api/dataset-review/
- DatasetReviewModel.test.ts (new): model invariant tests
- [id]/+page.svelte: reduced from ~380 to ~190 lines — thin shell
  delegating to model; only navigation/DOM concerns remain inline
- Old files deleted: routes/datasets/review/{review-workspace-helpers,useReviewSession}.ts
- Updated ux test for new model-based architecture
2026-06-04 16:16:51 +03:00
76732d647b feat(frontend): add AbortSignal/timeout support to API client
- Add FetchOptions.signal for request cancellation (timeout or unmount)
- Propagate signal to native fetch() in fetchApi, fetchApiBlob, postApi,
  requestApi, patchApi, putApi, and deleteApi
- Export API_REQUEST_TIMEOUT constant (30s default)
- Add @INVARIANT for signal propagation contract
- Add @RATIONALE documenting the anti-loop protocol motivation
2026-06-04 16:16:25 +03:00
a1a855e670 feat(backend+frontend): add is_regex support to dictionary entries
Add support for regex-based dictionary entries across the full stack:

Backend:
- DictionaryEntry model: add is_regex column (Boolean, default False)
- DictionaryEntryCRUD: validate regex on add_entry(), compile on creation
- _enforce_dictionary: match by regex pattern when is_regex=True
- dictionary_filter: support is_regex in filter/query
- metrics: include is_regex entries in metrics calculations
- Alembic migration: 20260604_add_is_regex_to_dictionary_entries
- Merge migration: 351afb8f961a (merge is_regex + composite index heads)

Frontend:
- DictionaryDetailModel: add is_regex field to DictionaryEntry interface,
  EditForm, and addForm; sync edit/add form state with backend schema
2026-06-04 16:16:02 +03:00
339f4e0695 fix: QA issues — composite index, anchors, fallbacks
- Add composite index ix_translation_records_run_source_hash
  for NOT EXISTS dedup subquery performance + Alembic migration
- Remove duplicate #endregion in orchestrator.py (INV_3)
- Replace hardcoded RU fallback 'Статус' with 'Status'
- Add early return guard to loadMoreRecords()
- Show records summary always when recordsTotal > 0
2026-06-04 13:33:17 +03:00
15d47450a3 feat: add deduplicate + metrics to Run tab
Backend:
- deduplicate param in GET /runs/{id}/records — NOT EXISTS subquery
  with (created_at, id) tiebreaker for one row per source_hash
- source_data and source_hash added to records JSON response
- fix missing status import in _run_history_routes.py (NameError)
- fix tab/space mixup in orchestrator_aggregator.py
- remove duplicated @RELATION edges in metrics.py
- fix #region/#endregion style and @PURPOSE→@BRIEF in metrics.py

Frontend:
- RunTabContent: summary metrics bar (fetchJobMetrics) with HelpTooltips
- RunTabContent: trigger_type badge, duration, cache rate in run rows
- TranslationRunResult: deduplicate=true by default, paginated Load more
- TranslationRunResult: per-language token_count and estimated_cost
- TranslationRunResult: collapsible batch breakdown with timing
- TranslationRunResult: Bulk Replace button in header and records table
- TranslationRunResult: source_data key values shown under source text

i18n: all new keys in EN + RU (load_more_records, showing_records,
sum_*, help_sum_*, trigger_*, batch_*, duration_label, cost_label,
cache_rate, load_more_records)
2026-06-04 13:23:10 +03:00
371834cf43 chore: commit remaining maintenance and model changes 2026-06-03 23:26:20 +03:00
814f2da139 perf(translate): fix slow translation startup — CJK estimation, output budget, provider token config
Root cause: batch sizing underestimated CJK token density (1.5→1.0 chars/token)
and ignored output budget as primary constraint, causing cascading finish_reason=length.

Changes:
- _token_budget.py: CJK_RATIO 1.5→1.0, OTHER_RATIO 2.2→1.8, safety factors 0.75/0.70
- _token_budget.py: new _compute_max_rows_by_output() — output budget is PRIMARY constraint
- _batch_sizer.py: resolve_provider_config() with DB-level context_window/max_output_tokens
- _batch_sizer.py: INPUT_SAFETY_FACTOR applied, max_rows_by_output used as row cap
- _llm_http.py: log actual usage.prompt_tokens/.completion_tokens from provider
- _llm_call.py: retry only missing rows after finish_reason=length (save partial result)
- models/llm.py + schema: provider-level context_window / max_output_tokens (nullable)
- services/llm_provider.py: get_provider_token_config() helper
- Alembic migration: add columns to llm_providers
- Svelte ProviderConfig: collapsible Advanced: Token Limits section
- 12 new tests (token budget, batch sizer, provider config)
- All 492 tests pass
2026-06-03 23:25:08 +03:00
a819e1ec4d fix: resolve 60 unresolved @RELATION targets and add @RATIONALE to models
- Batch-fixed [ApiModule.xxx] → [xxx] in 60 @RELATION targets across 26 API files
- Fixed [ToastsModule.addToast] → [addToast:Function] in notifyApiError contract
- Added #region contracts for getMaintenanceEventsWsUrl and getTranslateRunWsUrl
- Added @RATIONALE belief protocol to ValidationTasksListModel, DeploymentModel, MigrationModel
- Semantic audit: unresolved_relation dropped 104 → 43 (-59%)
2026-06-03 16:11:03 +03:00
5e4b03a662 fix: resolve all 221 eslint errors across frontend
- svelte/no-unused-svelte-ignore (7→0): removed stale a11y ignore comments
- svelte/no-unnecessary-state-wrap (5→0): removed () around SvelteSet
- svelte/prefer-writable-derived (3→0): suppressed with eslint-disable comments
- svelte/no-at-html-tags (2→0): added eslint-disable-next-line comments
- no-self-assign (1→0): replaced self-assign with map-based array update
- no-unsafe-optional-chaining (21→0): added ?? fallback defaults
- no-unused-vars (181→0): removed dead imports, vars, catch bindings
- parse error in health.svelte.ts: fixed malformed import statement
- Removed deprecated .eslintignore file (config moved to eslint.config.js)
- Updated test assertion that checked for removed dead code

Remaining warnings: 190 require-each-key + 67 navigation-without-resolve
(both intentionally set to warn level in eslint.config.js)
2026-06-03 15:51:31 +03:00
ec57294920 chore: align eslint config with ainative approach
- Add typescript-eslint parser for .svelte.ts and <script lang='ts'>
- Disable no-console (CoT logging is intentional)
- Downgrade require-each-key and no-navigation-without-resolve to warn
- Add Svelte 5 runes (, , etc.) as globals for .svelte.ts
2026-06-03 14:43:46 +03:00
615b5fee9f fix: remove unused Tooltip import in CommitHistory (not exported from $lib/ui) 2026-06-03 14:38:21 +03:00
80e5ad5299 refactor(frontend): migrate legacy src/components/ → /components/, remove console.count from Sidebar 2026-06-03 14:32:13 +03:00
5ada8cf745 test(translate): add TranslationJobModel L1 tests for field mapping invariants
- 19 tests covering:
  - disableReasoning load from API (true, false, omitted, null)
  - disableReasoning save to API (POST new + PUT update)
  - databaseDialect save to API (populated, empty, PUT)
  - datasourceSearch name lookup on job page load
    (found by ID, found by string ID, not found, no ID, API error)
  - uxState transitions: loading→configured, idle on job fetch
    failure, idle on Promise.all entry failure

Also changed datasourceSearch lookup from fire-and-forget .then()
to awaited try/catch — guarantees name is populated before
uxState transitions to 'configured'.
2026-06-03 12:04:18 +03:00
ebbbd51230 fix(translate): restore datasource display name on job page load
When opening a saved translation job, the datasource search input was empty
because datasourceSearch was never populated from the loaded job data.
The raw datasourceId was loaded correctly, but the display name
("table_name (database · dialect)") was missing.

Added fetchDatasources lookup in loadInitialData after environmentId is set:
finds the matching datasource by ID in the list and sets datasourceSearch
to the same format used in selectDatasource().
2026-06-03 11:52:38 +03:00
399eb2ada7 feat(ui): refactor PolicyForm and automation page with atoms + i18n
- PolicyForm.svelte: replaced raw inputs/selects/buttons with /ui atoms
  (Button, Input, Select), added i18n for all labels and messages
- Automation page: replaced manual layout with PageHeader/Card/EmptyState
  atoms, added i18n everywhere, stripped debug logging
- Added i18n keys for en/ru (settings: 45 new keys, validation: 1 new key)
- Fixed validation new page description to use dedicated i18n key
2026-06-03 11:48:13 +03:00
c10cd6b4d5 fix(ui): provide explicit undefined defaults for optional props
Button.onclick, Input.id, Select.id were declared without defaults
(implicitly undefined) which could cause Svelte 5 warnings or incorrect
() destructuring behavior. Set explicit = undefined.
2026-06-03 11:48:08 +03:00
236dadb914 fix(translate): load/save disableReasoning and databaseDialect from/to API
- HIGH: disableReasoning was declared as  and bound in UI but never
  loaded from API (loadInitialData) nor sent in save payload. Checkbox was
  decorative — value always defaulted to false and never persisted.
  Backend fully supports disable_reasoning column + schema + runtime logic.
- MEDIUM: databaseDialect was loaded from API and displayed in UI but never
  returned in save payload, causing unnecessary back-end re-detection on
  every save.
- Documents includeSourceReference as known limitation (no backend column).
2026-06-03 11:44:14 +03:00
1729739624 fix(frontend): target column mapping fields not loaded from job
Three fields were never loaded from backend job data:
- targetLanguageColumn (job.target_language_column)
- targetSourceColumn (job.target_source_column)
- targetSourceLanguageColumn (job.target_source_language_column)

Caused empty inputs in Target Config tab after page load.

Also added missing target_source_language_column to save payload.

@RATIONALE The model's loadJob() method was incomplete — it only
loaded targetColumn but omitted the other three target mapping fields.
Save payload also omitted target_source_language_column.

Verification: browser reconfirmed — all 4 target columns pre-filled
with saved values after reload.
2026-06-03 11:38:38 +03:00
a697ff2c3d fix(frontend): environment select resets to default on click
Root cause: onchange on native <select> passes a DOM Event.
The parent handler used e.detail, which is always 0 for native events.
Sequence:
1. bind:value sets environmentId correctly
2. onchange fires -> handleEnvChange(0) overwrites to falsy
3. <select> re-renders showing 'Select environment...'

Fix:
- ConfigTabForm: onchange now passes e.target.value (the actual envId)
- +page.svelte: callback receives the envId string directly, not e.detail

@RATIONALE bind:value on <select> fires on the same change event.
The handler must not re-set the same bindable to a stale value.

Verification: browser reconfirmed — ss-dev stays selected after click.
2026-06-03 11:16:01 +03:00
3b5b228f96 fix(frontend): replace with getT()?. in all .svelte.ts model files
Following the documented pattern from 27435e4 (bug report:
docs/bug-reports/2026-06-02-svelte5-proxy-store-t-undefined.md).

$t.x references in .svelte.ts files are fragile — Svelte 5 compiler
can fail to detect the Proxy-based t store as subscribable, causing
ReferenceError: $t is not defined at runtime.

Changed 3 model files:
- DashboardDetailModel.svelte.ts — 8 $t.dashboard?.x → getT()?.dashboard?.x
- TranslateHistoryModel.svelte.ts — 4 $t.translate?.run?.x → getT()?.translate?.run?.x
- ValidationTasksListModel.svelte.ts — 2 $t.validation?.x → getT()?.validation?.x

All imports changed from { t } to { getT } (or { _, getT } for
TranslateHistoryModel which already used _() for keyed lookups).

@RATIONALE getT() returns the plain translation object directly,
bypassing the Proxy store entirely — this avoids Svelte 5's fragile
static store-detection on Proxy objects.

Verification: npm run build clean, browser renders for all 4 affected
routes with zero console errors.
2026-06-03 10:59:22 +03:00
b5e104c9e8 fix(frontend): replace t Proxy with _ function in ValidationRunDetailPage
The  export from i18n is a Proxy that supports property access (t.dashboard)
and .subscribe(), but is NOT callable as t(key). Passing it as a function
argument to getPathLabel() and getTriggerLabel() caused:
  TypeError: tFn is not a function at getPathLabel

Fix: import the callable  translation function (key: string) => string
and pass that instead. The  import is kept for template usage (t.nav?.home).

@RATIONALE Svelte 5 i18n Proxy () supports property access but not
function calls. The  function is the correct callable formatter.
2026-06-03 10:52:47 +03:00
27435e4d92 fix(frontend): replace $t with _t pattern in translate components
Svelte 5 compiler fails to detect Proxy-based i18n store `t` as a store
in deeply nested/complex templates and in `.svelte.ts` model files,
generating `ReferenceError: $t is not defined` at runtime.

Fix: replace `$t.` references with:
- Template: `_t.` where `const _t = $derived(getT())`
- Script:   `getT()?.` direct function call

Applied to:
- translate/[id]/+page.svelte (the failing page)
- TranslationJobModel.svelte.ts ($derived.by() in `tabs`)
- 12 translate components (ConfigTabForm, ScheduleConfig,
  TranslationPreview, TargetTabForm, RunTabContent, BulkReplaceModal,
  TranslationRunProgress, TranslationRunResult, TermCorrectionPopup,
  BulkCorrectionSidebar, TranslationMetricsDashboard, CorrectionCell,
  TranslationRunGlobalIndicator)

Verified all 5 tabs render correctly in browser:
Config, Preview, Target, Run, Schedule.

Build clean, 698/698 tests pass, 0 color violations.
2026-06-02 20:38:38 +03:00