Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

test(watchers): every text a user or model reads is English; settings row label shared

purpled1f4b9761015
diff --git a/src/components/settings/InlineToggle.tsx b/src/components/settings/InlineToggle.tsx
index 4f58c139..ffbf871c 100644
--- a/src/components/settings/InlineToggle.tsx
+++ b/src/components/settings/InlineToggle.tsx
@@ -7,12 +7,15 @@ import type { ReactNode } from 'react'
* Import zurueck in `SettingsPage.tsx` waere ein Zyklus gewesen, eine
* zweite Kopie waere die naechste Divergenz. Also hierhin, einmal.
*/
+/** The label of a settings row, shared with rows that are not a switch. */
+export const ROW_LABEL = 'text-[0.7rem] text-gray-700 dark:text-gray-400'
+
export function InlineToggle({ label, enabled, onChange, icon }: { label: string; enabled: boolean; onChange: () => void; icon?: ReactNode }) {
return (
<div className="flex items-center justify-between py-0.5">
<div className="flex items-center gap-1.5">
{icon}
- <span className="text-[0.7rem] text-gray-700 dark:text-gray-400">{label}</span>
+ <span className={ROW_LABEL}>{label}</span>
</div>
<button
onClick={onChange}
diff --git a/src/components/settings/WatcherSettings.tsx b/src/components/settings/WatcherSettings.tsx
index 013364a8..04374f5a 100644
--- a/src/components/settings/WatcherSettings.tsx
+++ b/src/components/settings/WatcherSettings.tsx
@@ -1,7 +1,7 @@
// Settings → Agent → Watchers: the notification of the system when a watcher
// ran. Three rows and nothing else (David, 14.11.2026): on or off, the sound,
// and whether a result is worth a notification or only an error.
-import { InlineToggle } from './InlineToggle'
+import { InlineToggle, ROW_LABEL } from './InlineToggle'
import { useWatcherSettingsStore, type WatcherNotifyOn } from '../../stores/watcherStore'
const CHOICES: { value: WatcherNotifyOn; label: string }[] = [
@@ -14,13 +14,13 @@ export function WatcherSettings() {
return (
<div className="space-y-1">
<p className="t-micro text-gray-500 leading-relaxed pb-1">
- A notification of the system when a watcher has run, also with the window closed. Watchers are made in the chat
- (&ldquo;at 18:00 check …&rdquo;) and run as long as LU runs.
+ System notifications when a watcher has run, also with the window closed. Watchers are made in the chat
+ (&ldquo;at 18:00 check …&rdquo;) and run as long as LU is open or in the tray.
</p>
<InlineToggle label="Notifications" enabled={notify} onChange={() => update({ notify: !notify })} />
<InlineToggle label="Sound" enabled={sound && notify} onChange={() => update({ sound: !sound })} />
<div className="flex items-center justify-between py-0.5">
- <span className="t-control font-normal text-gray-700 dark:text-gray-400">Notify on</span>
+ <span className={ROW_LABEL}>Notify on</span>
<div className="flex items-center gap-3" role="radiogroup" aria-label="Notify on">
{CHOICES.map((c) => (
<button
diff --git a/src/lib/watchers/__tests__/watcher-texts-are-english.test.ts b/src/lib/watchers/__tests__/watcher-texts-are-english.test.ts
new file mode 100644
index 00000000..07af7722
--- /dev/null
+++ b/src/lib/watchers/__tests__/watcher-texts-are-english.test.ts
@@ -0,0 +1,76 @@
+// Watchers: every text a user or a model reads is English (David, 14.11.2026:
+// a notification read "LU-wächter"). The feature is "Watchers", one is a
+// "Watcher". German only lives in the lists that READ what a user typed
+// ("jeden Morgen", "um 18 Uhr"), and those are never shown.
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+import { WATCHER_TOOLS } from '../../../api/mcp/watcher-tools'
+import { WATCHER_PROMPT_LINE } from '../../watcher-tool-names'
+import { repeatText, rightsText, whenText } from '../schedule'
+import { watcherPrompt, summaryOf } from '../runner'
+import { stripLine, rowState } from '../../../components/chat/WatcherStrip'
+import { NO_RIGHTS, type Watcher } from '../types'
+
+const ROOT = resolve(__dirname, '../../../..')
+const GERMAN = /[äöüÄÖÜß]|\b(waechter|wächter|uhr|jeden|täglich|einstellung|benachrichtigung|löschen|pausieren|fortsetzen|nächste|ergebnis|fehler)\b/i
+
+/** The files whose string literals are shown, with the lines that only read input. */
+const SHOWN: Record<string, RegExp | null> = {
+ 'src/components/chat/WatcherStrip.tsx': null,
+ 'src/components/settings/WatcherSettings.tsx': null,
+ 'src/lib/watchers/schedule.ts': null,
+ 'src/lib/watchers/runner.ts': null,
+ 'src/lib/watchers/caps.ts': null,
+ 'src/lib/watchers/tool-exec.ts': /\.test\(t\)/, // intent patterns over the user's own words
+ 'src/api/mcp/watcher-tools.ts': null,
+ 'src-tauri/src/watchers.rs': null,
+}
+
+/** String literals of a line, without comments. */
+function literals(line: string): string[] {
+ const code = line.replace(/^\s*(\/\/|\*|\/\*).*$/, '').replace(/\s\/\/\s.*$/, '')
+ return [...code.matchAll(/'([^'\\]|\\.)*'|"([^"\\]|\\.)*"|`([^`\\]|\\.)*`/g)].map((m) => m[0])
+}
+
+describe('the watcher texts are English', () => {
+ it('no string literal a user or model reads carries German or an umlaut', () => {
+ const found: string[] = []
+ for (const [file, readsInput] of Object.entries(SHOWN)) {
+ const lines = readFileSync(resolve(ROOT, file), 'utf8').split('\n')
+ let inTests = false
+ lines.forEach((line, i) => {
+ if (file.endsWith('.rs') && line.startsWith('#[cfg(test)]')) inTests = true
+ if (inTests || (readsInput && readsInput.test(line))) return
+ for (const lit of literals(line)) if (GERMAN.test(lit)) found.push(`${file}:${i + 1} ${lit}`)
+ })
+ }
+ expect(found).toEqual([])
+ })
+
+ it('the tool texts and the prompt line are plain ASCII English', () => {
+ const all = [WATCHER_PROMPT_LINE, JSON.stringify(WATCHER_TOOLS)]
+ for (const t of all) {
+ expect(t).not.toMatch(GERMAN)
+ expect(/^[\x20-\x7e…–]*$/.test(t.replace(/\\n/g, ' ')), t.slice(0, 80)).toBe(true)
+ }
+ for (const tool of WATCHER_TOOLS) expect(tool.name).toMatch(/^watcher_[a-z]+$/)
+ })
+
+ it('what the line, the list and a run produce is English', () => {
+ const now = new Date(2026, 10, 14, 12, 0).getTime()
+ const w: Watcher = {
+ id: 'w', name: 'Prices', task: 'Check.', schedule: { kind: 'daily', hour: 8, minute: 0, days: [0, 1, 2, 3, 4] },
+ rights: { ...NO_RIGHTS, files: true }, folder: '/x/shop', model: null, paused: true, created_at: 0,
+ next_at: now + 3600_000, running_since: null, conversation_id: null, origin_conversation_id: null,
+ runs: [{ at: now - 60_000, ms: 1, status: 'failed', summary: '' }],
+ }
+ const out = [
+ stripLine([w], [], now), stripLine([w, { ...w, id: 'v', paused: false }], [{ id: 'h', name: 'News', was_next: now }], now),
+ stripLine([], [{ id: 'h', name: 'News', was_next: null }], now), rowState(w, now), repeatText(w.schedule),
+ repeatText({ kind: 'interval', minutes: 30 }), repeatText({ kind: 'once', at: now }), rightsText(w.rights, w.folder),
+ rightsText(NO_RIGHTS, null), whenText(now + 26 * 3600_000, now), watcherPrompt(w, now), summaryOf('**done**'),
+ ]
+ for (const t of out) expect(t ?? '').not.toMatch(GERMAN)
+ })
+})