047aff41d9
Task Status Center: save progress
2026-07-04 15:34:02 +03:00
61f3e6db75
feat: Git manager UI — панель управления Git + HelpTooltip + ReviewToggle
...
- GitManager: переработан в GitWorkspacePanel с вкладками
- Добавлен GitLifecycleHeader с быстрыми действиями
- RepositoryDashboardGrid: поддержка ReviewToggle, badges, env filter
- HelpTooltip: универсальный компонент подсказок с тестами
- GitManagerModel: доработаны экшены, добавлен isReady, loadDefaultBranch
- Локализация en/ru для Git UI
- tailwind: добавлен animation-delay-200
- ConfirmDialog: a11y-атрибуты для кнопок
2026-07-04 15:01:45 +03:00
0237e2f7e8
chore: добавить пример Fernet-ключа в .env.example
...
- Сгенерированный пример ENCRYPTION_KEY с командой для генерации
- Пометка 'сгенерируйте свой для прода'
2026-07-04 15:01:23 +03:00
b78493aeb7
chore: добавить примеры значений в .env.example
...
- backend/.env.example — пример DATABASE_URL с комментарием
- root/.env.example — заполнены примеры для всех переменных
(AUTH_SECRET_KEY, DATABASE_URL, INITIAL_ADMIN_PASSWORD, POSTGRES_PASSWORD)
2026-07-04 14:59:39 +03:00
ec9bc76a37
cleanup: убрать мёртвые env-переменные, консолидировать чтение в agent/_config.py
...
Удалены из кода:
- JWT_SECRET — мёртвая (decode_token использует AUTH_SECRET_KEY)
- SESSION_SECRET_KEY — заменён на прямой AUTH_SECRET_KEY
- POSTGRES_URL — deprecated fallback, удалён из database.py и reencrypt.py
Консолидировано чтение env-переменных agent-модуля:
- Создан agent/_config.py — единый модуль для FASTAPI_URL,
SERVICE_JWT, GRADIO_*, STORAGE_ROOT, AGENT_* (9 констант)
- Все agent/*.py импортируют из _config вместо разрозненных os.getenv
Удалены or-дефолты (безопасность):
- agent/langgraph_setup.py — удалён hardcoded DB URL postgres:postgres
- agent/langgraph_setup.py — удалены fallback API URL и model name
- scripts/reencrypt.py — удалён hardcoded DB URL postgres:postgres
- plugins/llm_analysis/service.py — удалены or-дефолты URL/app name
.env.example — минимализация:
- backend/.env.example: только 4 обязательные переменные
- root/.env.example: обязательные + docker + SSO/админ
Обновлены тесты (139 passed)
2026-07-04 14:58:43 +03:00
a99c1d6d01
Improve agent UX and spec sync
2026-07-03 16:47:10 +03:00
500491c281
test(tls): add encrypted (passphrase-protected) private key integration tests
...
- ca_chain fixture: add server_key_encrypted (BestAvailableEncryption) +
server_key_passphrase to returned dict; existing fields unchanged
- TestEncryptedPrivateKey: 6 new tests covering
- ssl.SSLContext.load_cert_chain() with correct/wrong/missing passphrase
- asyncio SSL server end-to-end with encrypted key + full chain trust
- openssl rsa -check with wrong/missing passphrase (CLI validation)
- All 6 tests pass; 14/14 in test_superset_tls_custom_ca.py
2026-07-03 16:46:12 +03:00
89b340c64f
fix(agent): debug panel copyDebugInfo — full state snapshot (was 9 fields, now all model atoms)
...
Previously copyDebugInfo() only exported 9 hand-picked fields
(conversation_id, thread_id, connection/streaming state, user, env,
message count, truncated tool calls, error). The debug panel was
missing LLM health (status, retry, banner), confirmation/HITL state
(pending_tool, args, risk), queue position, message previews, full
tool call objects, and UI flags (sidebar, debug panel, cancelled).
Now:
- Full model snapshot with all fields
- active_tool_calls_full — complete ToolCall objects
- last_message_preview — first 200 chars of last message
- LLM status, banner dismiss, retry countdown
- HITL confirmation state (pending_tool_name, args, risk, level)
- Conversations count, queue position, user_cancelled flag
- Visual debug panel grid: 5-column layout with new rows for
LLM health, confirmation, queue, sidebar, convs_count
2026-07-03 15:35:22 +03:00
53eb2b1cca
Improve reports UI and task drawer UX
2026-07-03 14:50:05 +03:00
33ee976c48
feat(reports): Task Status Center — unified /reports dashboard
...
Страница /reports трансформирована в Центр статусов задач:
Backend:
- GET /api/reports/summary — агрегированные счётчики тип×статус (5 корзин)
- GET/PUT /api/settings/reports — глобальные настройки отчётов
- _filter_tasks_by_rbac() — row-level фильтрация по роли
- normalize_task_report: LLM-валидация с ошибками → FAILED/PARTIAL
- get_summary(): 5 корзин pending/running/awaiting_input/success/failed
Frontend:
- TaskCenterModel.svelte.ts (400 строк) — Screen Model
- SummaryPanel — сводная панель с цветовым кодированием и active filter
- ReportCard — humanized labels, duration, task_id, failed border
- FilterBar — search + sort + time range с label'ами
- Pagination — showingText, уникальные id для select
- Quick views: «Упавшие», «В работе», «Успешные»
- TaskDrawer: scroll-to-error, footer скрыт для terminal, «Н/Д» fix
Тесты: 48 backend + 38 frontend (2521 всего)
Build: ✅ Console errors: 0
2026-07-02 18:53:58 +03:00
8c10632494
feat(semantic): curator-driven protocol hardening — decision memory + relation repair
...
- Add @RATIONALE/@REJECTED to 103+ C4/C5 contracts across backend core, services, API routes, and frontend models
- Fix 109 unresolved @RELATION edges (Auth.*, SupersetClient.*, AgentChat.*, ADR cross-refs)
- Add 13 @ingroup tags for DSA/HCA attention grouping
- Repair 29 stale graph edges via index rebuild
- Update .kilo agent prompts and skills for GRACE-Poly v2.6 compliance
- Git integration: merge routes, branch lifecycle, remote providers, UX components
- 0 broken anchor pairs, index rebuilt with 0 parse warnings
2026-07-02 08:53:19 +03:00
64564da988
fix(git): fix 17 missing async/await bugs + UX overhaul
...
Backend:
- fix 17 missing 'await' in git route handlers causing silent no-ops
(branches, diff, history, commit, push, pull, merge, promote, sync)
- fix async coroutine passed to run_blocking in git_plugin.py
Frontend:
- add collapsible 'How it works' onboarding (GitHelpPanel)
- add status legend with color-coded repository statuses
- i18n: add 50+ missing keys, replace hardcoded strings
- add Refresh button in modal header
- add PROD deploy confirmation dialog (replaces browser prompt())
- add CommitHistory to workspace tab with timeline nodes
- add post-commit success banner with next-step guidance
- increase success toast duration to 8s
- group local/remote branches in selector (optgroup)
- format last_modified dates timezone-aware
- change PROD badge from red to neutral indigo
- extract shared resolveGitStatusToken to git-utils.ts
- fix 'slug' label regression
- remove dead init_repo_button key
UI/UX audit fixes:
- add descriptions to Create/Init buttons in init panel
- add actionable CTA to server mismatch warning
- improve checkbox text phrasing
2026-07-01 20:47:25 +03:00
7613ad37ae
fix(agent): minimal safety net, zero-config router, LLM provider status UI
...
- Remove deterministic intent matching (keyword lists, infer_tool,
fast_confirmation, negation guard, classification sets)
- Embedding descriptions auto-generated from tool docstrings
- LLM provider health endpoint GET /api/agent/llm-status
- 3 error codes: LLM_PROVIDER_UNAVAILABLE, LLM_TIMEOUT, LLM_AUTH_ERROR
- Frontend banner with auto-retry 30s + input disable
- i18n for LLM status messages (assistant.json ru/en)
- 138 passing backend tests
2026-07-01 16:47:21 +03:00
12118ac4ec
fix(security): resolve Critical+High findings from module audit — agent, translate, superset_client
...
P0 — CRITICAL (CWE-798): JWT_SECRET crash-early
Replace hardcoded super-secret-key fallback with os.environ["JWT_SECRET"]
and ${JWT_SECRET:?} syntax in app.py + docker-compose files
P1 — HIGH: Frontend dependency CVEs
Upgrade svelte 5.43.8 → 5.56.4 — resolves devalue DoS (GHSA-g2pg-6438-jwpf)
and svelte XSS (GHSA-crpf-4hrx-3jrp, GHSA-m56q-vw4c-c2cp, GHSA-rcqx-6q8c-2c42)
P2 — MEDIUM: Logging hygiene + contract gaps + tool resolver refactor
Apply _redact_sensitive_fields() in middleware + event streaming
Truncate LLM error body to 100 chars
Add @RATIONALE/@REJECTED to HandleResume + SaveConversation
Refactor deterministic intent matching → LLM-driven tool resolution
P3 — LOW: Translate logging hardening
Move _sanitize_url() to _utils.py (shared, no circular imports)
Sanitize base_url before logging in _llm_call.py and _llm_async_http.py
Emit EXPLORE warning when LLM_SSL_VERIFY=false disables TLS
superset_client module: passed clean — no changes needed
2026-07-01 13:17:29 +03:00
1e24452b1a
chore(opencode): remove closure-gate agent; swarm-master emits summary itself
...
Eliminates closure-gate as a separate subagent. Swarm-master now
performs the closure audit and emits the user-facing summary
directly per a new SELF-CLOSURE CONTRACT (§VIIa):
- audit_contracts to verify no broken contracts post-implementation
- audit_belief_protocol to verify C5 contracts have @RATIONALE/@REJECTED
- read_events to check for runtime errors
- Noise reduction (raw dumps, browser transcripts suppressed)
- One closure summary: Applied | Verified | Remaining | Decision
Memory | Next Action
Also fixes pre-existing anchor corruption in swarm-master.md
(duplicate #endregion at file tail) per semantics-contracts §VIII.
Files changed:
- Deleted: .opencode/agents/closure-gate.md
- Deleted: .agents/agents/closure-gate.md
- Modified: .opencode/agents/swarm-master.md
- Modified: .agents/agents/swarm-master.md
2026-07-01 12:37:28 +03:00
e174c11d4a
tasks 033 updated
2026-06-30 19:05:17 +03:00
f1810090b6
feat(opencode): add security-auditor agent + /security.audit command
...
Read-only security audit tooling aligned with GRACE-Poly v2.6 and
axiom MCP scan capabilities. Combines code+secrets (S1–S3),
supply-chain (S4), and runtime/config (S5–S7) projections into a
single severity-ranked report with OWASP/CWE references.
Agent: .opencode/agents/security-auditor.md
- mode: all, edit: deny (hard read-only contract)
- 7 orthogonal projections with pattern catalogs for secrets, Python
SAST, Svelte/TS SAST, dependency audit, config/runtime, contract
coverage, and logging hygiene
- Maps findings to CVSS v3.1 severity bands, CWE, and OWASP Top 10
- Mirrors qa-tester P1–P7 anti-loop protocol for [ATTEMPT: N] ladder
- Anti-corruption §VIII: tooling absence is reported as Info finding,
never silently dropped
Command: .opencode/command/security.audit.md
- Dispatches security-auditor subagent via axiom MCP scan
- Supports --floor, --profile, --ci (exit code 0/1/2 for CI gates)
- PCAM worker packet contract; severity floor + suppression footer
Mirrored to .agents/agents/ and .agents/commands/ per repo convention.
2026-06-30 18:44:52 +03:00
e40724a0fe
fix: timezone handling across fullstack — UTC parsing + display in configured TZ
...
Root cause: backend returned naive ISO datetimes (no Z/offset) → JS parsed them as
browser local time → 3h drift for MSK users → '3ч' instead of 'только что'.
Backend:
- schemas/agent.py: add field_serializer('Z' suffix) for ConversationItem.updated_at
and MessageItem.created_at — naive datetimes serialized as UTC
- routes/agent_conversations.py: datetime.utcnow() → datetime.now(timezone.utc) (3x)
Frontend:
- New: stores/timezone.svelte.ts — global reactive appTimezone store
- dateFormat.ts: add parseDateUTC() (appends 'Z' to naive ISO), all format*()
functions now use parseDateUTC + { timeZone: appTimezone.current }
- ~25 files: replace new Date(apiString) → parseDateUTC(apiString),
add timeZone: appTimezone.current to toLocaleString()/toLocaleDateString()
- SystemSettings.svelte + HealthCenterModel sync appTimezone to global store
- ConversationList.svelte: fix relativeTime() and date grouping (the '3ч' bug)
Verified: backend schema test, frontend 2501 tests pass, build succeeds,
browser validation on /agent and /settings.
2026-06-30 18:11:42 +03:00
60674c8639
fix(logging): defensive trace_id seed + falsy error/payload in CotJsonFormatter
...
log_requests middleware (BaseHTTPMiddleware) showed no-trace
because anyio.create_task_group() in Starlette 0.50.0 does not
always propagate ContextVar from raw ASGI TraceContextMiddleware.
Fix 1: defensive get_trace_id() check at log_requests entry —
if empty, seed_trace_id() to ensure every request has one.
Fix 2: CotJsonFormatter used 'if error:' and 'if payload:' which
silently drop empty strings (str(e)='') and empty dicts.
Changed to 'is not None' checks — preserves all data.
Root cause: 12 EXPLORE-without-error entries from belief_scope's
exception handler where Exception() has empty message.
2026-06-30 17:41:13 +03:00
2f238dee13
fix(agent): seed trace_id for agent process lifecycle
...
Agent logs had trace_id='no-trace' because the Gradio process
never called seed_trace_id(). The CotJsonFormatter reads trace_id
from ContextVar — without seeding, it defaults to empty string
displayed as 'no-trace'.
Fix:
- app.py: seed_trace_id() on every agent_handler invocation
- run.py: seed_trace_id() on agent startup (for LLM config fetch)
Each Gradio submit gets a fresh trace_id, making agent logs
correlatable with downstream FastAPI calls.
2026-06-30 17:33:21 +03:00
79d0f8f678
feat(agent-superset): extend SupersetClient with agent-critical methods + DDL/DML guard + tests (126 passed)
...
Ported from mcp-superset research module, integrated into existing async SupersetClient:
New mixins (4 files):
- safety.py: DDL/DML guard (13 keywords), comment/string stripping, viz_type validation
- _sql_lab.py: execute_sql, format_sql, results, estimate, CSV export, query history
- _saved_queries.py: saved queries CRUD (5 methods)
- _audit.py: permissions audit matrix (user × dashboard × dataset × RLS)
Extended mixins (4 files):
- _dashboards_write.py: +create, +update (general), +copy, +publish, +unpublish
- _dashboards_crud.py: +standalone get_dashboard_charts/datasets, +get_dashboard
- _datasets.py: +create, +delete, +duplicate, +refresh_schema, +get_or_create, +export/import
- _databases.py: +update, +test_connection, +schemas/tables/catalogs, +validate_sql, +select_star, +table_metadata
FastAPI proxy (2 files):
- agent_superset.py (284L): SQL Lab + Dashboards/Datasets write endpoints
- agent_superset_explore.py (240L): DB explore + Audit + Saved Queries endpoints
Agent tools (2 files):
- tools.py: +7 LangChain @tools (24 total), intent-routing keywords
- _tool_resolver.py: updated SAFE/GUARDED/FAST_CONFIRM classification sets
Tests (3 files, 126 tests):
- test_superset_safety.py (51): DDL/DML bypass/legitimate/safe scenarios
- test_superset_extended.py (42): all mixin methods with mock AsyncAPIClient
- test_superset_tools.py (33): agent tool registration, intent matching, @tool .ainvoke()
2026-06-30 17:26:51 +03:00
a0619ca049
fix(agent): unify logging API + add molecular-cot coverage to agent module
...
Phase 1 — API unification:
- Replace direct log() from cot_logger with canonical logger.reason/reflect/explore
across _confirmation.py, _persistence.py, _tool_resolver.py, app.py
Phase 2 — Gap filling:
- tools.py: add REASON/REFLECT/EXPLORE to 17 C3 tool functions (was 0 logs)
- app.py agent_handler (C4): add lifecycle REASON on entry, REFLECT on exit,
EXPLORE on OutputParserException + general exception
- langgraph_setup.py create_agent (C4): add REASON with model/config_source,
EXPLORE on env-var/InMemorySaver fallback, REFLECT on graph compilation
- _tool_resolver.py infer_tool_from_text (C3, 13 branches): REASON on inference
- _persistence.py: REFLECT on save_conversation success, EXPLORE on prefetch
Phase 3 — Plain log migration:
- middleware.py: plain logger.info() -> logger.reason()
- run.py: 7 plain logger.info/warning/error -> molecular REASON/EXPLORE
Phase 4 — Cleanup:
- cot_logger.py: deprecate MarkerLogger (@DEPRECATED + @REPLACED_BY)
- molecular-cot-logging SKILL.md: remove cot_span Section IV (never implemented),
renumber sections V-VII -> IV-VI, add cot_span rejection rationale
Verification: pytest 27/27, axiom rebuild 5844/2993/0 warnings
2026-06-30 15:48:46 +03:00
131c7cdfa4
chore: remaining pre-existing changes (storage, stream processor, tests, run.sh)
2026-06-30 15:21:15 +03:00
3b4ac807a5
feat(agent+ui): fullstack agent module refactoring + UI/UX improvements
...
## Backend: agent module GRACE-Poly compliance
- Split app.py (749→~280 lines) into _tool_resolver, _confirmation, _persistence
- All 18 naked functions wrapped in #region/#endregion contracts
- Fixed @DEFGROUP→@defgroup typos; added @DATA_CONTRACT, @SIDE_EFFECT, CoT logs
- Conversation list API: added last_role, has_tool_calls, has_error, risk_level fields
- Message state detection: Russian/English error patterns (недоступен, unavailable)
- State field preserved in save_conversation messages
- HITL titles: descriptive tool names instead of generic "HITL resume"
## Backend: conversation title generation (two-layer)
- Layer 1: clean_title() — rule-based, strips file markers, pre-fetch blocks, JSON/CSV,
URLs, code; truncates at 80 chars word boundary (25 unit tests, all edge cases)
- Layer 2: generate_llm_title() — async best-effort LLM titling via /v1/chat/completions
with per-conversation lock, graceful degradation on failure
## Frontend: conversation list indicators (orthogonal system)
- Status dot (green/yellow/red/blue) per conversation state
- Icon column: tool activity, errors, waiting, completed
- Risk stripe (left border accent) + message count badge + relative time
- Fixed group labels: "Сегодня"/"Вчера" instead of "3 ч"/"5 ч"
- Hide "Окружение: —" when env is empty
## Frontend: guardrails card verification + fixes
- Confirmed all interaction modes: Enter/click confirm, Escape/click deny
- Auto-populate envId from environmentContextStore in DashboardDetailModel
- Better error message: missing_context_hint with recovery guidance
## Design system: semantic tokens
- Added category-* gradient tokens to tailwind.config.js
- Sidebar + Breadcrumbs use semantic tokens (10 categories)
- Raw Tailwind reduced from ~50 to 6 occurrences
- Added skip-to-content link in root layout (+layout.svelte)
- Added aria-label on DashboardDataGrid row checkboxes
## Protocol: INV_7 pragmatic exception
- Modules may exceed 400 lines when contract-dense (every function has #region)
- Recorded in semantics-core SKILL.md with rationale
Total: 5841+ contracts, 2993+ edges, backend 41/41, frontend 2501/2501
2026-06-30 15:21:05 +03:00
e8d6d7d0db
fix(agent): critical agent chat bugs — backend startup & frontend streaming state
...
Backend (tools.py):
- Add Python docstrings to all 17 @tool functions (LangChain ValueError)
- Add @INVARIANT ADR: docstring requirement documented in module header
- Fix 2 f-string escaped-quote syntax errors (Python 3.13)
Frontend — compile errors (+page.svelte):
- Fix mismatched <button>/</Button> tags
- Fix missing Button import for mobile sidebar close
Frontend — streaming state loss on conversation switch (AgentChatModel):
- Add _commitStreamingPartial() helper — saves in-progress text before cancelling
- selectConversation() commits partial text to OLD conversation before switching
- createConversation() commits partial text before clearing state
- loadHistory() sets _userCancelled=true to suppress fallback messages
Frontend — ConnectionManager:
- Pass error reason through onDisconnectedPermanent callback → model.error
Frontend — null safety:
- Guard _client.submit() calls against null _client in _sendNow and resumeConfirm
2026-06-30 13:25:28 +03:00
7090ec979f
fix(run.sh): correct PID capture with process substitution, add SIGTERM trap, 3-phase cleanup
...
Problem: pipeline cmd | awk & captured awks PID instead of Python PID.
When cleanup killed AGENT_PID, awk died but Gradio kept port 7860 occupied.
Fix:
- Replace | awk & with > >(awk) 2>&1 & (process substitution) so 0 gives real PID
- Trap SIGTERM + SIGHUP in addition to SIGINT
- Three-phase cleanup: SIGTERM -> wait 1s -> SIGKILL -> fuser port fallback
2026-06-29 17:43:42 +03:00
12678c637b
fix(agent-chat): streaming state leak, document parser magic bytes, HITL flow
...
### Bugfixes — Agent Chat 'Думаю' State Leak
- fix(agent-chat): loadHistory() now resets streamingState/idle + cancels stale
submission — prevents 'Думаю' state leak across conversation switches
- fix(agent-chat): onDisconnected/onDisconnectedPermanent cascade to
streamingState — prevents permanent hang on connection loss during stream
- fix(agent-chat): guard on isLoadingHistory — prevents false commit
of 'agent unavailable' fallback when switching conversations
- fix(agent-chat): remove race in _sendNow empty-response check vs Svelte
microtask (duplicate logic removed, handles correctly)
- fix(stream-processor): confirm_resolved now appends msg.text to partialText
instead of dropping it
### Bugfixes — Backend PDF Upload
- fix(document-parser): _detect_format_by_magic() — reads file header magic
bytes as fallback when Gradio loses filename
- fix(document-parser): improved name extraction — tries orig_name, path stem
- fix(document-parser): @RELATION AgentChatTypes -> AgentChat.Types
### HITL Flow & Agent Chat Improvements
- feat(agent): HITL resume confirm/deny with userId/userJwt/envId propagation
- feat(agent): confirm_required metadata fallback via aget_state() after
'Event loop is closed' error during interrupt
- feat(agent): interrupt_before re-enabled via AGENT_CONFIRM_TOOLS env var
- feat(frontend): debug panel with connection/stream state monitoring
- feat(frontend): AgentChatModel constructor options + onBeforeSend callback
- feat(frontend): crypto.randomUUID() for local conversation ID on first send
### Backend Agent Refactoring
- refactor(agent): langgraph_setup — monkey-patch for PydanticSerializationError
- refactor(agent): tools.py — dual identity headers, expanded tool set
- refactor(agent): run.py — _find_free_port, Gradio server port fallback
- refactor(agent): app.py — file size validation, message truncation, HITL path
### Frontend
- feat(dashboard-hub): DashboardHubModel with filters, pagination, git actions
- feat(ui): DateRangeFilter component
- feat(i18n): new dashboard keys; cache tooltips fix
- fix(i18n): full run tooltips — cache is NOT ignored
### Semantic Protocol
- chore(agents): update all agents with canonical format
- chore(skills): sync semantics-core, semantics-contracts, molecular-cot-logging
### Housekeeping
- chore: remove stale semantic reports (10 files, Jan 2026)
- chore: update 033-gradio-agent-chat specs, contracts, UX, tasks, tests
- chore: add .agents/ directory (mirrors .opencode/ agent layouts)
- chore: update run.sh with DEV_MODE, port management
2026-06-29 17:15:25 +03:00
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
3b8d4c3821
Merge branch '034-task-status-center' into master
2026-06-19 16:15:25 +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
e07bf46b2b
test: integration + unit tests for cache fix and OUTPUT_SAFETY_FACTOR
...
## TestClassifyCacheSourceLang (8 tests) — regression for source-lang exclusion
- test_source_lang_in_tls_cache_all_translations: exact prod bug scenario
(detected_lang=ru, tls=[ru,en,fr,zh], cache={en,fr,zh} → pre_rows not LLM)
- test_source_lang_in_tls_cache_missing_one_translation: partial cache → LLM
- test_detected_und_tls_includes_und: und excluded correctly
- test_empty_detected_lang_no_exclusion: '' → no filtering
- test_source_lang_not_in_tls: no-op exclusion when lang not in tls
- test_multi_row_mixed_source_lang_cache: 4 rows, correct split
- test_all_same_lang_short_circuit: single target lang shortcut
- test_case_insensitive_detected_lang_matching: RU→ru
## TestBatchPipelineE2E (3 tests) — full pipeline integration
- test_warm_cache_full_pipeline_no_llm: 17 rows all cached → 0 LLM
- test_cold_cache_pipeline_all_llm: no cache → all LLM
- test_partial_cache_pipeline_split: 5 cached + 5 not → correct split
## TestOutputSafetyFactor (4 tests) — OUTPUT_SAFETY_FACTOR invariants
- test_output_safety_factor_not_above_070: ≤0.70 guard
- test_max_rows_by_output_qwen_flash_4langs: 14-24 range
- test_output_safety_factor_consistent_with_per_row: manual = actual
- test_single_lang_output_rows_above_20: ≥20 rows for 1 lang
## Semantic fixes
- Add missing #endregion TestClassifyCacheSourceLang
- Move floating @BRIEF tags inside their regions (REASONING_OVERHEAD, DICT_TOKENS_PER_ENTRY)
- Add @BRIEF to OUTPUT_PER_ROW_PER_LANG region
Verification: 705 tests pass (0 failures, 2 pre-existing warnings)
2026-06-19 14:59:05 +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
190b913ae4
fix(dashboard): async git status enrichment — await get_repo()
...
_get_git_status_for_dashboard was sync but called async git_service.get_repo()
without await. Coroutine was always truthy, so active_branch access failed
silently and returned None. Made function async, added await, updated tests.
2026-06-18 10:04:10 +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
4726fd110d
fix(core): centralize async/sync bridge for APScheduler scheduled jobs
...
Create AsyncJobRunner — centralized bridge between APScheduler
(BackgroundScheduler, sync thread pool) and async coroutines.
Fixes:
- P0: execute_run() called without await from APScheduler thread,
causing coroutine to be silently discarded (root cause: no
translation history)
- P0: get_async_job_runner() deadlock when called from APScheduler
thread pool without running event loop
- P1: ID mismatch in disable_schedule/delete_schedule routes
(job_id passed instead of schedule_id)
- P1: asyncio.run() in APScheduler callbacks incompatible with
running event loop
- Delete unused llm_analysis/scheduler.py (not used in production)
Changes:
core/async_job_runner.py — new: AsyncJobRunner class
core/scheduler.py — use runner.run()/run_later()
translate/scheduler.py — use runner.run() for execute_run
mapping_service.py — remove unused BackgroundScheduler
dependencies.py — add get_async_job_runner() DI
app.py — init runner in lifespan
api/routes/migration.py — use runner.run()
_schedule_routes.py — fix ID mismatch
plugins/migration.py — use runner.run()
llm_analysis/scheduler.py — delete (unused)
tests: 151 new/updated tests, all passing
2026-06-17 16:22:30 +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