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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
test(settings): der Reset-Knopf zeigt sichtbar, dass er scharf ist, und bleibt
purple24b528921048
diff --git a/src/components/settings/SettingsPage.tsx b/src/components/settings/SettingsPage.tsxindex d81cfd69..3f483917 100644--- a/src/components/settings/SettingsPage.tsx+++ b/src/components/settings/SettingsPage.tsx@@ -964,6 +964,15 @@ const SETTINGS_TABS: { id: SettingsTab; label: string; icon: ReactNode }[] = [// no confirm and no feedback, so users reported it as "does nothing". Now:// arm-then-confirm (second click within 4s), per-tab scope, and an explicit// success line after the reset.+//+// Nebenbefund 2 of the R9 re-measure (2026-08-30) read the first click as a+// dud. Checked and kept as it is: the armed button relabels to "Click again to+// reset <tab>", turns red and goes medium weight, and the first click writes+// nothing at all. That is the same arm-then-confirm the Cloud switch got in+// round 6, and the same reasoning holds here: two clicks on one control is the+// cheapest confirmation there is, no dialog and no mouse travel. The three+// visible signals are pinned by+// src/lib/__tests__/reset-arming-is-visible.test.ts.function ResetSection({ tab }: { tab: SettingsTab }) {const resetSettingsKeys = useSettingsStore((s) => s.resetSettingsKeys)const resetSettings = useSettingsStore((s) => s.resetSettings)diff --git a/src/lib/__tests__/reset-arming-is-visible.test.ts b/src/lib/__tests__/reset-arming-is-visible.test.tsnew file mode 100644index 00000000..e27da60b--- /dev/null+++ b/src/lib/__tests__/reset-arming-is-visible.test.ts@@ -0,0 +1,95 @@+/**+ * Nebenbefund 2 of the R9 re-measure (2026-08-30): "Reset AI Backends to+ * defaults" looked like a dud on the first click. It is not. It is the same+ * arm-then-confirm mechanic the Cloud switch got in round 6, and the round 6+ * decision was that two clicks on ONE control is the cheapest confirmation+ * there is, cheaper than a dialog.+ *+ * So this round changes no behaviour. It checks the only thing that was ever+ * in question: whether the armed state SAYS so on screen. It does, in three+ * ways at once, and this test pins all three so a later refactor cannot quietly+ * turn the first click into a dud for real.+ *+ * 1. the label swaps to "Click again to reset <tab>"+ * 2. the colour goes from grey to red+ * 3. the weight goes to medium+ *+ * Plus the two releases that keep an armed button from lying in wait: the 4 s+ * timeout and the disarm on a tab switch.+ *+ * Run: npx vitest run src/lib/__tests__/reset-arming-is-visible.test.ts+ */+import { describe, it, expect } from 'vitest'+import { readFileSync } from 'node:fs'+import { fileURLToPath } from 'node:url'+import { dirname, resolve } from 'node:path'++const here = dirname(fileURLToPath(import.meta.url))+const repo = resolve(here, '../../..')+const read = (rel: string) => readFileSync(resolve(repo, rel), 'utf8')++const settingsPage = read('src/components/settings/SettingsPage.tsx')+const cloudSwitch = read('src/components/cloud/CloudSwitch.tsx')++describe('the reset button is armed visibly, which is why it stays as it is', () => {+ it('the label says what the next click will do', () => {+ expect(settingsPage).toMatch(+ /armed === 'section' \? `Click again to reset \$\{tabLabel\}` : `Reset \$\{tabLabel\} to defaults`/,+ )+ })++ it('the reset-everything button relabels too', () => {+ expect(settingsPage).toMatch(+ /armed === 'all' \? 'Click again to reset everything' : 'Reset all settings'/,+ )+ })++ it('and the armed button turns red and heavier, not only wordier', () => {+ expect(settingsPage).toMatch(+ /armed === 'section' \? 'text-red-400 font-medium' : 'text-gray-500 hover:text-red-400'/,+ )+ })++ it('the first click changes nothing else: it only arms and returns', () => {+ expect(settingsPage).toMatch(+ /if \(armed !== which\) \{\s*setArmed\(which\)[\s\S]{0,200}return\s*\}/,+ )+ })+})++describe('an armed button is never lying in wait', () => {+ it('it disarms itself after four seconds', () => {+ expect(settingsPage).toMatch(/setTimeout\(\(\) => setArmed\(null\), 4000\)/)+ })++ it('and a tab switch disarms it, so General cannot fire on Agent', () => {+ expect(settingsPage).toMatch(/useEffect\(\(\) => \{ setArmed\(null\) \}, \[tab\]\)/)+ })+})++describe('the same mechanic the Cloud switch uses, on purpose', () => {+ it('the Cloud switch arms and relabels the same way', () => {+ expect(cloudSwitch).toMatch(/armed \? 'Switch to Cloud\?' : 'Cloud'/)+ expect(cloudSwitch).toMatch(/setArmed\(true\)/)+ })++ it('NEGATIVE CONTROL: neither control opens a confirm dialog, that was the choice', () => {+ // The round 6 reasoning: no dialog, no mouse travel, no second surface.+ expect(cloudSwitch).not.toMatch(/window\.confirm/)+ expect(settingsPage).not.toMatch(/window\.confirm\(/)+ })++ it('NEGATIVE CONTROL: the reset still needs the SECOND click to fire', () => {+ // resetSettingsKeys must sit AFTER the arm-and-return guard, never before.+ const guard = settingsPage.indexOf('if (armed !== which)')+ const fires = settingsPage.indexOf('resetSettingsKeys(SETTINGS_TAB_RESET_KEYS[tab])')+ expect(guard).toBeGreaterThan(-1)+ expect(fires).toBeGreaterThan(guard)+ })++ it('NEGATIVE CONTROL: the backends reset still hands the slot back to the engine', () => {+ expect(settingsPage).toContain(+ "if (tab === 'backends') useProviderStore.getState().resetProvidersToDefaults()",+ )+ })+})