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).
This commit is contained in:
2026-06-03 11:44:14 +03:00
parent 1729739624
commit 236dadb914

View File

@@ -16,6 +16,10 @@
// in arrow functions: onTriggerRun={(full) => m.handleTriggerRun(full)}.
// @REJECTED Converting methods to arrow class fields rejected — it would conflict with the Svelte 5
// `$state` rune initialization order for non-primitive state atoms in the constructor.
// @REJECTED includeSourceReference ($state at line 52) has no backend column or schema field.
// It is a UI-only checkbox; the value always resets to `true` on page load.
// The backend TranslateJobCreate/Update/Response schemas lack `include_source_reference`.
// Requires a DB migration + Pydantic schema update to persist. Not implemented as of 2026-06-03.
import { api } from '$lib/api.js';
import { log } from '$lib/cot-logger';
import { addToast } from '$lib/toasts.svelte.js';
@@ -210,6 +214,7 @@ export class TranslationJobModel {
this.contextColumns = (job.context_columns as string[]) || [];
this.dictionaryIds = (job.dictionary_ids as string[]) || [];
this.upsertStrategy = (job.upsert_strategy as string) || 'MERGE';
this.disableReasoning = (job.disable_reasoning as boolean) ?? false;
this.databaseDialect = (job.db_dialect as string) || '';
this.datasourceId = (job.source_datasource_id as string) || '';
this.status = (job.status as string) || 'DRAFT';
@@ -273,6 +278,8 @@ export class TranslationJobModel {
context_columns: this.contextColumns,
dictionary_ids: this.dictionaryIds,
upsert_strategy: this.upsertStrategy,
disable_reasoning: this.disableReasoning,
database_dialect: this.databaseDialect || undefined,
target_schema: this.targetSchema || undefined,
target_table: this.targetTable || undefined,
target_database_id: this.targetDatabaseId || undefined,