From 9fd19f5522bb2be58e87044dd18b39c17eaeaa78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rouzbeh=E2=80=A0?= <78313022+rqzbeh@users.noreply.github.com> Date: Fri, 21 Aug 2026 10:41:14 +0330 Subject: [PATCH] fix(settings): add customSystemPrompt fields to updateSettingsSchema (#10865) (#10890) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reconciliado com a release (mesmo drift dos PRs irmãos em typecheck-baseline/glm.ts/fetchTimeout.ts/stryker.conf.json). Validado: lint limpo, teste focado passando. Fix real (schema Zod não incluía customSystemPromptEnabled/customSystemPrompt, causando perda silenciosa da configuração). CI vermelho é o base-red já rastreado em #9985. Obrigado! --- src/shared/validation/settingsSchemas.ts | 2 ++ ...tom-system-prompt-settings-persistence.test.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 tests/unit/custom-system-prompt-settings-persistence.test.ts diff --git a/src/shared/validation/settingsSchemas.ts b/src/shared/validation/settingsSchemas.ts index 83d87893f9..7bfc8c031f 100644 --- a/src/shared/validation/settingsSchemas.ts +++ b/src/shared/validation/settingsSchemas.ts @@ -174,6 +174,8 @@ export const updateSettingsSchema = z.object({ ) .optional(), customBannedSignals: z.array(z.string().max(200)).optional(), + customSystemPromptEnabled: z.boolean().optional(), + customSystemPrompt: z.string().max(10000).optional(), // #9817: opt-in (default off) — lets a probe-origin (model test-all) // failure deactivate a connection like real traffic. Off by default: // probe failures are recorded but never mutate routing state. diff --git a/tests/unit/custom-system-prompt-settings-persistence.test.ts b/tests/unit/custom-system-prompt-settings-persistence.test.ts new file mode 100644 index 0000000000..2947c5af90 --- /dev/null +++ b/tests/unit/custom-system-prompt-settings-persistence.test.ts @@ -0,0 +1,15 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { updateSettingsSchema } from "@/shared/validation/settingsSchemas"; + +test("updateSettingsSchema preserves customSystemPromptEnabled and customSystemPrompt fields", () => { + const input = { + customSystemPromptEnabled: true, + customSystemPrompt: "Always respond politely", + }; + + const parsed = updateSettingsSchema.parse(input); + + assert.equal(parsed.customSystemPromptEnabled, true); + assert.equal(parsed.customSystemPrompt, "Always respond politely"); +});