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.

tech(AS-10): zwei Zonen, die gruen aussahen, weil sie niemand geprueft hat

David2910d06a1343
diff --git a/eslint.config.js b/eslint.config.js
index 7e84df30..7a62404a 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -7,6 +7,22 @@ import { defineConfig, globalIgnores } from 'eslint/config'
export default defineConfig([
globalIgnores(['dist', '.claude']),
+
+ // ── Eine tote Unterdrueckung ist eine Luege ueber das, was geprueft wird ──
+ //
+ // Voreinstellung ist 'warn', und `npm run lint` ist `eslint .` ohne
+ // `--max-warnings 0`: eine Warnung faellt also durch jedes Gate hindurch.
+ // Gemessen am 01.09.2026 standen 10 solcher Direktiven im Baum, und die
+ // Haelfte davon unterdrueckte Regeln, die in KEINER der geerbten Configs
+ // eingeschaltet sind — `no-console` (3x), `no-await-in-loop`,
+ // `@typescript-eslint/no-use-before-define`, dazu `no-var-requires`, das es
+ // in typescript-eslint 8 nicht mehr gibt. Wer die Zeile schrieb, glaubte an
+ // ein Gate, das nie existiert hat. Genau das soll auffallen, und ein Fehler
+ // faellt auf, eine Warnung nicht.
+ {
+ linterOptions: { reportUnusedDisableDirectives: 'error' },
+ },
+
{
files: ['**/*.{ts,tsx}'],
extends: [
@@ -19,6 +35,80 @@ export default defineConfig([
ecmaVersion: 2020,
globals: globals.browser,
},
+ rules: {
+ // ── `_` heisst in diesem Baum "absichtlich ungenutzt" ──
+ //
+ // Ohne diese Muster meldete die Regel 43 Stellen. 40 davon trugen einen
+ // Unterstrich vor dem Namen — `_args`, `_opts`, `_dropped`, `_tag` —,
+ // also die Schreibweise, mit der dieses Projekt seit jeher sagt "steht
+ // in der Signatur, wird hier nicht gebraucht". Eine Regel, die genau die
+ // Konvention bestraft, mit der man ihr antwortet, erzieht dazu, den Lauf
+ // zu ignorieren.
+ //
+ // Der Beweis, dass das Muster trennscharf ist und nicht bloss den
+ // Zaehler senkt: von den 43 Meldungen ueberlebt genau eine ohne
+ // Unterstrich — `catch (fallbackErr)` in api/mcp/builtin-tools.ts, wo
+ // der Grund des Fallbacks weggeworfen und stattdessen der Fehler des
+ // ersten Wegs gemeldet wurde. Das war der einzige echte Fehler im
+ // ganzen Haufen, und er ist der einzige, den die Regel nach dieser
+ // Einstellung noch faengt (Sonde:
+ // src/api/mcp/__tests__/web-fetch-nennt-den-grund-des-fallbacks.test.ts).
+ //
+ // `ignoreRestSiblings` deckt das Weglass-Idiom `({ a, b, ...rest }) =>
+ // rest` ab — dort SIND `a` und `b` benutzt: sie benennen, was
+ // wegfaellt (stores/createStore.ts:897 haelt die Medien-Bytes so aus
+ // dem localStorage).
+ '@typescript-eslint/no-unused-vars': ['error', {
+ argsIgnorePattern: '^_',
+ varsIgnorePattern: '^_',
+ caughtErrorsIgnorePattern: '^_',
+ destructuredArrayIgnorePattern: '^_',
+ ignoreRestSiblings: true,
+ }],
+
+ // ── Ein leerer case kann nirgends durchfallen ──
+ //
+ // Gemessen: `case 'a': case 'b':` meldet die Regel nicht, aber
+ // `case 'a': /* warum */ case 'b':` meldet sie — mit
+ // `allowEmptyCase: false` (Voreinstellung) kostet der Kommentar den
+ // Fehler, nicht der Code. Alle drei Fundstellen im Baum lagen in
+ // api/agents/side-effect-key.ts und waren genau das: leere Labels, die
+ // erklaeren, warum sie sich einen Rumpf teilen.
+ //
+ // Die gefaehrliche Form — ein case MIT Anweisungen, der ohne `break` in
+ // den naechsten laeuft — bleibt gedeckt, und zwar zweifach: von dieser
+ // Regel (allowEmptyCase aendert daran nichts) und von tsc, das
+ // `noFallthroughCasesInSwitch: true` in tsconfig.app.json stehen hat.
+ // Sonde (laesst diese Config selbst laufen und misst beide Seiten der
+ // Grenze): src/lib/__tests__/das-gate-bleibt-scharf.test.ts
+ 'no-fallthrough': ['error', { allowEmptyCase: true }],
+
+ // ── react-refresh/only-export-components: aus, und hier steht warum ──
+ //
+ // 29 Meldungen, alle in src/components. Nachgemessen, was sie
+ // beanstanden (ueber die Import-Bezeichner, nicht ueber Namenstreffer):
+ // 23 der 29 exportierten Namen werden von einer Datei unter __tests__/
+ // IMPORTIERT — `groupCostHintText`, `computeFit`,
+ // `pickDefaultVariant`, `comfyViewUrlFromResult`, `toolBadgeTitle` und
+ // so weiter. Es sind keine Ausrutscher, es ist die Naht, an der dieses
+ // Projekt die Logik aus seinen Komponenten herausgezogen hat, um sie
+ // ohne DOM testen zu koennen. Von den uebrigen sechs ist `useCreateExp`
+ // der klassische Fall Provider + Hook in einer Datei (sieben
+ // Produktionsdateien lesen ihn).
+ //
+ // Was die Regel dafuer verlangt, steht in ihrer eigenen Meldung: "Use a
+ // new file". Das waeren rund 29 neue Dateien, deren einziger Zweck es
+ // ist, einer Regel zu genuegen. Was sie schuetzt, ist Fast Refresh im
+ // Dev-Server; ein Verstoss kostet einen vollen Reload statt eines
+ // zustandserhaltenden Updates. Kein ausgeliefertes Verhalten haengt
+ // daran — `vite build` kennt die Regel nicht.
+ //
+ // Bequemlichkeit gegen Testbarkeit, und die Regel steht auf der
+ // falschen Seite. `allowExportNames` waere die andere Moeglichkeit
+ // gewesen: eine Namensliste, also ein zweiter Pflegeweg neben dem Code.
+ // Genau davon hat dieses Projekt genug.
+ 'react-refresh/only-export-components': 'off',
+ },
},
// ── mobile-client/: the page a paired phone runs ──
//
@@ -38,10 +128,13 @@ export default defineConfig([
// The two relaxations below are this file's idiom, not a waiver: `catch(_){}`
// is how the client swallows a failed localStorage read, and the only unused
// bindings it has are catch parameters and unread arguments. Nothing else is
- // turned off — `npx eslint mobile-client` reports 5 real errors today (one
- // dead variable, four inert regex escapes) and they are left standing on
- // purpose, because T-75 ships the same page bytes it found. Fixing them is
- // its own change.
+ // turned off. (Der Satz hier lautete: "reports 5 real errors today (one
+ // dead variable, four inert regex escapes)". Nachgemessen am 01.09.2026:
+ // `npx eslint mobile-client` meldet nichts mehr, die fuenf sind inzwischen
+ // bezahlt. Und der Block prueft wirklich — Gegenprobe mit einem
+ // eingesetzten undefinierten Bezeichner: 61 Regeln greifen, no-undef und
+ // no-unused-vars melden ihn. Das ist nicht selbstverstaendlich; scripts/
+ // sah genauso gruen aus und hatte null Regeln.)
{
files: ['mobile-client/**/*.js'],
extends: [js.configs.recommended],
@@ -55,4 +148,43 @@ export default defineConfig([
'no-unused-vars': ['error', { args: 'none', caughtErrors: 'none' }],
},
},
+
+ // ── scripts/: die Zone, die nur so AUSSAH, als waere sie geprueft ──
+ //
+ // Gemessen am 01.09.2026: `npx eslint scripts` listete alle zehn .mjs-Dateien
+ // auf und meldete null Probleme. Nicht weil sie sauber waren, sondern weil
+ // KEINE EINZIGE REGEL auf sie zutraf: der TypeScript-Block oben greift
+ // `**/*.{ts,tsx}`, der mobile-client-Block greift `mobile-client/**/*.js`,
+ // und `.mjs` faellt zwischen beide. `npx eslint --print-config
+ // scripts/release-rules.mjs` sagte: 0 Regeln. Ein gruener Lauf ueber eine
+ // Zone, in der nichts geprueft wird, ist schlimmer als ein roter — er
+ // behauptet Deckung.
+ //
+ // Mit Regeln kamen 42 Meldungen zum Vorschein, darunter 11 `no-undef`. Die
+ // sind hier die eigentliche Begruendung fuer den Block: in einem Node-Modul
+ // ist ein unbekannter Bezeichner keine Stilfrage, sondern ein
+ // ReferenceError beim Lauf. (Die 11 gemessenen waren `window`/`document` in
+ // page.evaluate-Rueckrufen — die laufen wirklich im Browser, und die Datei
+ // sagt das jetzt selbst per `/* global */`-Zeile, statt dass diese Config
+ // pauschal Browser-Globals ueber alle Skripte schuettet und damit Tippfehler
+ // wie `name` oder `status` durchliesse.)
+ {
+ files: ['scripts/**/*.mjs', '*.mjs'],
+ extends: [js.configs.recommended],
+ languageOptions: {
+ ecmaVersion: 2023,
+ sourceType: 'module',
+ globals: globals.node,
+ },
+ rules: {
+ // Dieselbe Konvention wie im TypeScript-Block: `_` heisst absichtlich
+ // ungenutzt. Betrifft hier ausschliesslich `catch (_)`.
+ 'no-unused-vars': ['error', {
+ argsIgnorePattern: '^_',
+ varsIgnorePattern: '^_',
+ caughtErrorsIgnorePattern: '^_',
+ ignoreRestSiblings: true,
+ }],
+ },
+ },
])
diff --git a/scripts/bug2-logic-proof.mjs b/scripts/bug2-logic-proof.mjs
index ae1bd413..68b924a7 100644
--- a/scripts/bug2-logic-proof.mjs
+++ b/scripts/bug2-logic-proof.mjs
@@ -21,9 +21,9 @@ import { exit } from 'node:process'
function isSystemPromptEcho(content) {
if (!content) return false
const head = String(content).trim().slice(0, 240)
- if (/^(hello[!,\.]?\s+|hi[!,\.]?\s+|hey[!,\.]?\s+)?(i['’]?m|i am|you are)\s+(codex|an autonomous|the agent|an? ai)/i.test(head)) return true
+ if (/^(hello[!,.]?\s+|hi[!,.]?\s+|hey[!,.]?\s+)?(i['’]?m|i am|you are)\s+(codex|an autonomous|the agent|an? ai)/i.test(head)) return true
if (/^(i am|i['’]m)\s+ready\s+to\s+(receive|assist|help)/i.test(head)) return true
- if (/^(hello|hi|hey)[!,\.]?\s+i['’]?m\s+ready/i.test(head)) return true
+ if (/^(hello|hi|hey)[!,.]?\s+i['’]?m\s+ready/i.test(head)) return true
return false
}
@@ -164,7 +164,10 @@ console.log(' log:', scenarioA.log.join(' | '))
// ── 3. 5 tool errors in a row: should bail with the new guard ──
console.log('\n— scenario B: 5 consecutive tool errors (Bug 2 reproducer) —')
-const errCall = (i) => ({
+// Der Index dient nur den Aufrufstellen (`errCall(1) … errCall(5)` liest sich
+// als "fuenf Fehler hintereinander"); im Rumpf hat er nichts zu suchen, alle
+// fuenf Fehlschlaege sind absichtlich identisch.
+const errCall = (_i) => ({
content: '',
toolCalls: [{
function: { name: 'shell_execute', arguments: { command: 'mkdir client public' } },
diff --git a/scripts/mobile-all-modes.mjs b/scripts/mobile-all-modes.mjs
index a0c2c8aa..c4612e5d 100644
--- a/scripts/mobile-all-modes.mjs
+++ b/scripts/mobile-all-modes.mjs
@@ -12,7 +12,7 @@
*/
import { execSync } from 'node:child_process'
-import { mkdirSync, copyFileSync, existsSync, readFileSync, writeFileSync, renameSync, rmSync, statSync } from 'node:fs'
+import { mkdirSync, existsSync, readFileSync, writeFileSync, renameSync, rmSync } from 'node:fs'
import { argv, exit } from 'node:process'
function args() {
diff --git a/scripts/mobile-real-browser.mjs b/scripts/mobile-real-browser.mjs
index 7e3b17bc..6ead7a30 100644
--- a/scripts/mobile-real-browser.mjs
+++ b/scripts/mobile-real-browser.mjs
@@ -13,6 +13,13 @@
* node scripts/mobile-real-browser.mjs --url <full mobile url> --code <6 digit>
*/
+/* global window, document -- die page.evaluate-Rueckrufe weiter unten laufen
+ IM Browser, nicht in Node. Die Deklaration steht hier statt in
+ eslint.config.js, damit `no-undef` fuer die uebrigen Skripte scharf bleibt:
+ `name`, `status` und `location` sind Browser-Globals, und ein Tippfehler auf
+ einen davon waere in einem Node-Skript ein ReferenceError, den eine pauschal
+ gesetzte Browser-Umgebung durchliesse. */
+
import { chromium } from 'playwright'
import { mkdirSync, writeFileSync } from 'node:fs'
import { argv, exit } from 'node:process'
@@ -57,30 +64,17 @@ Schreib zum Schluss audit/REPORT.md mit einer Aufzählung welches Tool was gelie
Halt dich strikt an die Reihenfolge, übersprich KEINEN Schritt, leere Antworten zwischen den Schritten sind FEHLER.`
-// Tools the mobile_landing JS exposes. Source of truth is AGENT_TOOLS in
-// src-tauri/src/commands/remote.rs. Codex uses a subset.
-const AGENT_TOOL_NAMES = ['web_search','web_fetch','file_read','file_write','file_list','file_search','shell_execute','code_execute','system_info','process_list','screenshot','image_generate','get_current_time']
-const CODEX_TOOL_NAMES = ['file_read','file_write','file_list','file_search','shell_execute','code_execute','system_info','get_current_time','web_search','web_fetch']
-
-// Per-tool nudge text. The user types this verbatim into the chat as a
-// follow-up message when a tool was not exercised in the previous run.
-// Each phrasing is concrete enough that the model can't sidestep with
-// prose — it has to call the tool to comply.
-const TOOL_NUDGES = {
- web_search: 'Search the web for "ollama best small models 2024" with web_search and tell me the top result.',
- web_fetch: 'Use web_fetch to fetch https://example.com and report its <title>.',
- file_read: 'Read the file gemtest/index.html with file_read and quote the first <h1> tag.',
- file_write: 'Use file_write to create gemtest/notes.md with the text "Mobile E2E proof — all tools".',
- file_list: 'Use file_list with path "gemtest" recursive=true and list the entries.',
- file_search: 'Use file_search with path "gemtest" and query "Hello" and report any matches.',
- shell_execute: 'Run "echo hello-from-shell" via shell_execute and report stdout.',
- code_execute: 'Use code_execute with this Python: print(2+2). Report the stdout.',
- system_info: 'Call system_info and report the os + cpuCount.',
- process_list: 'Call process_list and report the top process by memory.',
- screenshot: 'Call screenshot once and report the image format from the response.',
- image_generate:'Call image_generate with prompt "test". Whatever response comes back, report its error or status field.',
- get_current_time:'Call get_current_time and report the iso_local field.',
-}
+// Hier standen AGENT_TOOL_NAMES, CODEX_TOOL_NAMES und TOOL_NUDGES; keines der
+// drei wurde je gelesen.
+//
+// Die beiden Namenslisten waren eine dritte, handkopierte Fassung dessen, was
+// scripts/remote-agent-e2e.mjs daneben schon fuehrt — dort einmal ABGELEITET
+// (`AGENT_TOOLS.map(t => t.name)`) und einmal von Hand. Eine Kopie, die
+// niemand liest, kann von der Quelle wegdriften, ohne dass etwas auffaellt;
+// das Einzige, was sie hier ungefaehrlich machte, war, dass sie tot war.
+//
+// TOOL_NUDGES widersprach dem Kopf dieser Datei: "No shortcuts. No auto-nudge."
+// Das Skript beobachtet absichtlich, statt nachzuhelfen.
async function main() {
const { url, code, mode, task, headless } = args()
@@ -94,7 +88,9 @@ async function main() {
const consoleLog = []
const chatEvents = []
const toolCalls = []
- const toolResults = []
+ // (Ein `toolResults`-Puffer stand hier, wurde nie gefuellt und nie
+ // geschrieben — saveAll() kennt ihn nicht. Was er halten sollte, traegt
+ // toolCalls[].responseBody bereits.)
let final = []
let elapsedMs = 0
@@ -120,7 +116,8 @@ async function main() {
writeFileSync(`${outDir}/tool-calls.json`, JSON.stringify(toolCalls, null, 2))
writeFileSync(`${outDir}/chat-events.json`, JSON.stringify(chatEvents, null, 2))
writeFileSync(`${outDir}/transcript.json`, JSON.stringify(final, null, 2))
- } catch (_) {}
+ } catch { /* saveAll laeuft auch aus dem finally: ein Schreibfehler hier
+ darf den Abbruchgrund nicht verdecken */ }
}
page.on('console', msg => {
@@ -140,7 +137,8 @@ async function main() {
if (h.includes('json') || h.includes('text')) {
body = await res.text()
}
- } catch (_) {}
+ } catch { /* Antwortkoerper nicht lesbar (abgebrochen/binaer) — der
+ Netzwerkeintrag unten wird trotzdem geschrieben */ }
networkLog.push({ phase: 'response', status: res.status(), url: u, body: body?.slice(0, 4000), at: Date.now() })
// Targeted parsing: tool calls + chat events
@@ -148,13 +146,13 @@ async function main() {
try {
const reqBody = res.request().postDataJSON()
toolCalls.push({ ts: Date.now(), tool: reqBody?.tool, args: reqBody?.args, chatId: reqBody?.chatId, status: res.status(), responseBody: (body||'').slice(0,800) })
- } catch (_) {}
+ } catch { /* kein JSON-Body am Request — dann gibt es nichts zu buchen */ }
}
if (u.endsWith('/remote-api/chat-event')) {
try {
const reqBody = res.request().postDataJSON()
chatEvents.push({ ts: Date.now(), role: reqBody?.role, content: (reqBody?.content||'').slice(0,500), status: res.status() })
- } catch (_) {}
+ } catch { /* dito */ }
}
})
diff --git a/scripts/remote-agent-e2e.mjs b/scripts/remote-agent-e2e.mjs
index 44f9be32..bae6a96c 100644
--- a/scripts/remote-agent-e2e.mjs
+++ b/scripts/remote-agent-e2e.mjs
@@ -192,9 +192,9 @@ function observationToString(data) {
function isSystemPromptEcho(content) {
if (!content) return false
const head = String(content).trim().slice(0, 240)
- if (/^(hello[!,\.]?\s+|hi[!,\.]?\s+|hey[!,\.]?\s+)?(i['’]?m|i am|you are)\s+(codex|an autonomous|the agent|an? ai)/i.test(head)) return true
+ if (/^(hello[!,.]?\s+|hi[!,.]?\s+|hey[!,.]?\s+)?(i['’]?m|i am|you are)\s+(codex|an autonomous|the agent|an? ai)/i.test(head)) return true
if (/^(i am|i['’]m)\s+ready\s+to\s+(receive|assist|help)/i.test(head)) return true
- if (/^(hello|hi|hey)[!,\.]?\s+i['’]?m\s+ready/i.test(head)) return true
+ if (/^(hello|hi|hey)[!,.]?\s+i['’]?m\s+ready/i.test(head)) return true
return false
}
@@ -202,7 +202,9 @@ function repairToolCallArgs(tc) {
if (!tc?.function) return tc
let a = tc.function.arguments
if (typeof a === 'string') {
- try { tc.function.arguments = JSON.parse(a) } catch (_) {}
+ // Kein JSON: dann bleibt der String stehen und der Aufrufer sieht ihn
+ // unveraendert — genau das ist die Reparatur, die diese Funktion anbietet.
+ try { tc.function.arguments = JSON.parse(a) } catch { /* String bleibt String */ }
}
return tc
}
diff --git a/scripts/remote-all-tools-e2e.mjs b/scripts/remote-all-tools-e2e.mjs
index 733f8f1f..dc54a1d6 100644
--- a/scripts/remote-all-tools-e2e.mjs
+++ b/scripts/remote-all-tools-e2e.mjs
@@ -89,7 +89,9 @@ async function main() {
})
// ── 3. file_write — index.html ──
- let writePath
+ // (Hier stand `let writePath`, ausserhalb des Schritts gehoben, damit ein
+ // spaeterer Schritt den Pfad lesen kann. Den Schritt gibt es nicht; die
+ // Zusicherung ueber den Pfad steht schon in Schritt 3 selbst.)
await step('3. file_write index.html — start the site build', async () => {
const w = await tool(base, token, chatId, T('file_write'), {
path: 'site/index.html',
@@ -99,7 +101,6 @@ async function main() {
})
check('file_write status=saved', w?.status === 'saved', JSON.stringify(w))
check('file_write path NOT in __remote__', NOT_REMOTE(w?.path), w?.path)
- writePath = w?.path
})
// ── 4. file_write — style.css ──
@@ -190,7 +191,7 @@ print('manifest written, file count =', len(files))
const r = await tool(base, token, chatId, T('file_read'), { path: 'manifest.json' })
check('manifest read', typeof r?.content === 'string', JSON.stringify(r))
let parsed = null
- try { parsed = JSON.parse(r.content) } catch (_) {}
+ try { parsed = JSON.parse(r.content) } catch { /* die naechste Zeile prueft genau das */ }
check('manifest is valid JSON', !!parsed, r?.content?.slice?.(0, 200))
check('manifest cwd is the override folder',
parsed && typeof parsed.cwd === 'string' && NOT_REMOTE(parsed.cwd),
diff --git a/scripts/remote-smoke.mjs b/scripts/remote-smoke.mjs
index a25cba7f..86ddc01d 100644
--- a/scripts/remote-smoke.mjs
+++ b/scripts/remote-smoke.mjs
@@ -25,7 +25,6 @@
*/
import { argv, exit } from 'node:process'
-import { join } from 'node:path'
// Der Sandkasten-Name kommt aus app-identity. Dieser Branch hängt einen Suffix
// an; eine fest verdrahtete Zusicherung wäre danach immer erfüllt und würde
// eine echte Regression nicht mehr fangen.
@@ -77,7 +76,9 @@ async function agentTool(base, token, chatId, tool, args) {
})
const text = await r.text()
let data = null
- try { data = JSON.parse(text) } catch (_) {}
+ // Nicht-JSON ist erlaubt: die naechste Zeile entscheidet anhand von
+ // `data === null` UND dem Status, ob das ein Fehler ist.
+ try { data = JSON.parse(text) } catch { /* data bleibt null */ }
if (!r.ok && !data) throw new Error(`HTTP ${r.status}: ${text}`)
return data ?? text
}
diff --git a/src/api/__tests__/bundles-installed-every-file.test.ts b/src/api/__tests__/bundles-installed-every-file.test.ts
index 310d1d81..f647857f 100644
--- a/src/api/__tests__/bundles-installed-every-file.test.ts
+++ b/src/api/__tests__/bundles-installed-every-file.test.ts
@@ -186,7 +186,9 @@ describe('the row a user actually reads names the cause that fits the file', ()
})
it('no dashes in either text (house rule) and both stay English', () => {
- // eslint-disable-next-line no-misleading-character-class
+ // (Die Unterdrueckung fuer no-misleading-character-class stand hier, ohne
+ // dass die Regel je etwas gemeldet haette — beide Code Points sind BMP
+ // und bilden kein Surrogatpaar.)
const dash = /[\u2013\u2014]/
return import('../../stores/downloadStore').then(({ invisibleFileMessage }) => {
expect(invisibleFileMessage(GGUF)).not.toMatch(dash)
diff --git a/src/api/__tests__/dynamic-workflow-strategy.test.ts b/src/api/__tests__/dynamic-workflow-strategy.test.ts
index 1e91589b..072570e0 100644
--- a/src/api/__tests__/dynamic-workflow-strategy.test.ts
+++ b/src/api/__tests__/dynamic-workflow-strategy.test.ts
@@ -1,4 +1,7 @@
import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { dirname, resolve } from 'node:path'
import { determineStrategy } from '../dynamic-workflow'
import type { CategorizedNodes, AvailableModels } from '../comfyui-nodes'
import type { ModelType } from '../comfyui'
@@ -279,9 +282,8 @@ describe('dynamic-workflow — determineStrategy', () => {
// read a non-existent `params.numFrames` (VideoParams only has `frames`).
describe('FramePack length wiring (source verification)', () => {
it('total_second_length is driven by params.frames, not the dead params.numFrames', () => {
- const { readFileSync } = require('fs')
- const { resolve } = require('path')
- const src = readFileSync(resolve(__dirname, '../dynamic-workflow.ts'), 'utf8')
+ const src = readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../dynamic-workflow.ts'), 'utf8')
expect(src).toContain('total_second_length: (params.frames || 49) / (params.fps || 16)')
// The dead field must be gone — otherwise FramePack silently pins to 49 frames.
expect(src).not.toContain('params.numFrames')
diff --git a/src/api/__tests__/ernie-image-workflow.test.ts b/src/api/__tests__/ernie-image-workflow.test.ts
index c3fd127d..4c233c42 100644
--- a/src/api/__tests__/ernie-image-workflow.test.ts
+++ b/src/api/__tests__/ernie-image-workflow.test.ts
@@ -9,6 +9,9 @@
* strategy determination — here we verify the actual workflow nodes.
*/
import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { dirname, resolve } from 'node:path'
import { classifyModel, MODEL_TYPE_DEFAULTS as COMFYUI_DEFAULTS, COMPONENT_REGISTRY, isImageModelType, type ModelType } from '../comfyui'
import { determineStrategy } from '../dynamic-workflow'
import { getImageBundles } from '../discover'
@@ -247,9 +250,8 @@ describe('ERNIE-Image bundles', () => {
describe('ERNIE-Image ConditioningZeroOut (source verification)', () => {
it('dynamic-workflow.ts uses ConditioningZeroOut for ernie_image negative', () => {
- const { readFileSync } = require('fs')
- const { resolve } = require('path')
- const src = readFileSync(resolve(__dirname, '../dynamic-workflow.ts'), 'utf8')
+ const src = readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../dynamic-workflow.ts'), 'utf8')
// The critical branching logic
expect(src).toContain("strategy === 'unet_ernie_image'")
@@ -259,9 +261,8 @@ describe('ERNIE-Image ConditioningZeroOut (source verification)', () => {
})
it('dynamic-workflow.ts uses EmptyFlux2LatentImage for ernie_image', () => {
- const { readFileSync } = require('fs')
- const { resolve } = require('path')
- const src = readFileSync(resolve(__dirname, '../dynamic-workflow.ts'), 'utf8')
+ const src = readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../dynamic-workflow.ts'), 'utf8')
// ernie_image shares Flux2 latent space
expect(src).toMatch(/unet_flux2.*unet_ernie_image|unet_ernie_image.*unet_flux2/)
@@ -269,9 +270,8 @@ describe('ERNIE-Image ConditioningZeroOut (source verification)', () => {
})
it('dynamic-workflow.ts uses flux2 clipType for ernie_image', () => {
- const { readFileSync } = require('fs')
- const { resolve } = require('path')
- const src = readFileSync(resolve(__dirname, '../dynamic-workflow.ts'), 'utf8')
+ const src = readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../dynamic-workflow.ts'), 'utf8')
expect(src).toMatch(/ernie_image.*flux2/)
})
diff --git a/src/api/__tests__/tool-description-parity.test.ts b/src/api/__tests__/tool-description-parity.test.ts
index a02c2ef6..effccb5b 100644
--- a/src/api/__tests__/tool-description-parity.test.ts
+++ b/src/api/__tests__/tool-description-parity.test.ts
@@ -93,10 +93,16 @@ function evaluateStringLiteralExpression(expr: string): string {
while ((m = re.exec(expr)) !== null) {
pieces.push(
m[2]
+ // NUL is used as a private placeholder, not matched as input: an
+ // escaped backslash is parked on a byte that cannot occur in a
+ // TypeScript source literal, the other escapes are resolved, and the
+ // last .replace puts it back. Any printable sentinel would be
+ // ambiguous with real content — which is the whole point.
.replace(/\\\\/g, '\x00') // placeholder so we do not re-process escaped backslashes
.replace(/\\'/g, "'")
.replace(/\\"/g, '"')
.replace(/\\n/g, '\n')
+ // eslint-disable-next-line no-control-regex
.replace(/\x00/g, '\\')
)
}
diff --git a/src/api/agents/side-effect-key.ts b/src/api/agents/side-effect-key.ts
index 6e67a34c..05d1e527 100644
--- a/src/api/agents/side-effect-key.ts
+++ b/src/api/agents/side-effect-key.ts
@@ -88,7 +88,7 @@ export function deriveSideEffectKey(
function normalizePath(p: string): string {
// Windows paths case-insensitively; Unix paths case-sensitively. Keep
// behaviour conservative: lowercase on Windows, preserve on Unix.
- const isWindowsLike = /^[A-Za-z]:[\\\/]/.test(p) || p.startsWith('\\\\')
+ const isWindowsLike = /^[A-Za-z]:[\\/]/.test(p) || p.startsWith('\\\\')
let out = p.trim().replace(/\\/g, '/')
// Collapse trailing slash so "./foo" and "./foo/" collide.
out = out.replace(/\/+$/, '')
diff --git a/src/api/discover.ts b/src/api/discover.ts
index 4c75d92b..9d4c9a06 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -642,7 +642,7 @@ export async function installBundleComplete(bundle: ModelBundle): Promise<void>
const errors: string[] = []
// Pre-check: which files already exist on disk (skip re-downloading them)
- let installedFiles = new Set<string>()
+ const installedFiles = new Set<string>()
try {
const checkFiles = bundle.files
.filter(f => f.subfolder && f.filename)
diff --git a/src/api/mcp/__tests__/external-client.test.ts b/src/api/mcp/__tests__/external-client.test.ts
index debd4ecf..d8ca503d 100644
--- a/src/api/mcp/__tests__/external-client.test.ts
+++ b/src/api/mcp/__tests__/external-client.test.ts
@@ -63,6 +63,12 @@ class FakeServer extends Emitter {
}
constructor() {
super()
+ // Not the `const self = this` idiom the rule is aimed at (that one is
+ // fixed by an arrow function). This hands the freshly built fake to the
+ // test file so assertions can reach the instance the code under test
+ // constructed — there is no other handle on it, and no arrow function
+ // would produce one.
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
lastServer = this
}
async spawn() {
diff --git a/src/api/mcp/__tests__/tool-catalog-tokens.test.ts b/src/api/mcp/__tests__/tool-catalog-tokens.test.ts
index 24b7358f..00d82a5d 100644
--- a/src/api/mcp/__tests__/tool-catalog-tokens.test.ts
+++ b/src/api/mcp/__tests__/tool-catalog-tokens.test.ts
@@ -184,7 +184,9 @@ describe.runIf(LIVE)('the same catalog through a real tokenizer', () => {
it('a plain coding step stays under the token ceiling', async () => {
const wire = codingWire()
const tokens = await countTokens(wire)
- // eslint-disable-next-line no-console
+ // Absichtliche Messausgabe (Lauf nur unter LIVE). Kein Unterdruecken
+ // noetig: `no-console` ist in eslint.config.js gar nicht eingeschaltet —
+ // gemessen 01.09.2026, 38 console-Aufrufe in src/, alle in api/lib/hooks.
console.log(`coding step: ${wire.length} chars, ${tokens} tokens (${TOKENIZER_MODEL})`)
expect(tokens).toBeLessThanOrEqual(CODING_TOKEN_CEILING)
}, 300000)
@@ -192,7 +194,7 @@ describe.runIf(LIVE)('the same catalog through a real tokenizer', () => {
it('the ungated coding catalog stays under its token ceiling', async () => {
const wire = fullWire()
const tokens = await countTokens(wire)
- // eslint-disable-next-line no-console
+ // Absichtliche Messausgabe, siehe oben.
console.log(`full catalog: ${wire.length} chars, ${tokens} tokens (${TOKENIZER_MODEL})`)
expect(tokens).toBeLessThanOrEqual(FULL_TOKEN_CEILING)
}, 300000)
diff --git a/src/api/mcp/__tests__/web-fetch-nennt-den-grund-des-fallbacks.test.ts b/src/api/mcp/__tests__/web-fetch-nennt-den-grund-des-fallbacks.test.ts
new file mode 100644
index 00000000..30b89a5b
--- /dev/null
+++ b/src/api/mcp/__tests__/web-fetch-nennt-den-grund-des-fallbacks.test.ts
@@ -0,0 +1,95 @@
+/**
+ * AS-10 — der eine echte Fehler unter den 43 `no-unused-vars`.
+ *
+ * `executeWebFetch` hat zwei Wege: erst den Rust-Befehl `web_fetch`, und wenn
+ * der wirft, den Browser-Fallback `fetchExternal` + `htmlToText`. Scheiterten
+ * BEIDE, stand da:
+ *
+ * } catch (fallbackErr) {
+ * return `Error: web_fetch failed: ${e instanceof Error ? e.message : String(e)}`
+ * }
+ *
+ * `fallbackErr` wurde benannt und dann weggeworfen; gemeldet wurde `e`, der
+ * Fehler des ERSTEN Wegs. Das ist kein Aufraeumfall, sondern ein Diagnosefehler:
+ * im Browser-/Dev-Modus ist der Rust-Befehl grundsaetzlich nicht erreichbar,
+ * `e` ist dort auf jedem Fehlschlag derselbe konstante Satz. Der einzige Text,
+ * der sagt, was wirklich passiert ist — DNS, CORS, 404, Timeout —, steckt in
+ * `fallbackErr`, und das Modell bekam ihn nie zu sehen. Es sieht auf jeden
+ * kaputten Link dieselbe Zeile und kann nichts daraus machen.
+ *
+ * Dreissig Zeilen weiter oben schreibt `executeWebSearch` die Regel selbst hin:
+ * ein still verschluckter Provider-Fehler "would look like search is broken".
+ *
+ * Run: npx vitest run src/api/mcp/__tests__/web-fetch-nennt-den-grund-des-fallbacks.test.ts
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+/** Was der Rust-Weg wirft. Im Browser-/Dev-Modus IMMER dasselbe. */
+const PRIMARY = 'Tauri backend not available'
+/** Was der Fallback wirft. Wechselt pro Seite — das ist die nuetzliche Haelfte. */
+let fallbackThrow: unknown = new Error('CORS policy blocked https://example.com')
+
+vi.mock('../../backend', () => ({
+ backendCall: vi.fn(async (cmd: string) => {
+ if (cmd === 'web_fetch') throw new Error(PRIMARY)
+ return { ok: true }
+ }),
+ fetchExternal: vi.fn(async () => {
+ throw fallbackThrow
+ }),
+}))
+vi.mock('../../agents/sub-agent', () => ({
+ DELEGATE_TASK_TOOL_DEF: { name: 'delegate_task', description: '', category: 'system', inputSchema: {} },
+ buildDelegateExecutor: () => async () => 'stub',
+}))
+vi.mock('../../../lib/workflow-engine', () => ({ WorkflowEngine: class {} }))
+
+import { registerBuiltinTools } from '../builtin-tools'
+import { ToolRegistry } from '../tool-registry'
+
+const registry = new ToolRegistry()
+registerBuiltinTools(registry)
+
+const fetchUrl = (url = 'https://example.com') =>
+ registry.execute('web_fetch', { url }) as Promise<string>
+
+beforeEach(() => {
+ fallbackThrow = new Error('CORS policy blocked https://example.com')
+})
+
+describe('web_fetch: scheitern beide Wege, zaehlt der Grund des zweiten', () => {
+ it('SONDE: der Grund des Fallbacks steht in der Meldung', async () => {
+ const out = await fetchUrl()
+ // Genau die Zeile, die der Fix einsetzt. Nimmt man ihn zurueck (also
+ // `fallbackErr` wieder wegwerfen und nur `e` melden), faellt dieses expect.
+ expect(out).toContain('CORS policy blocked https://example.com')
+ })
+
+ it('der Fehler des ersten Wegs bleibt als Kontext erhalten', async () => {
+ // Beide Haelften, nicht die eine gegen die andere getauscht: dass der
+ // Rust-Weg zuerst gescheitert ist, ist die Erklaerung dafuer, warum
+ // ueberhaupt ein Fallback lief.
+ const out = await fetchUrl()
+ expect(out).toContain(PRIMARY)
+ expect(out.startsWith('Error: web_fetch failed:')).toBe(true)
+ })
+
+ it('unterscheidbar: zwei verschiedene Fallback-Fehler geben zwei verschiedene Meldungen', async () => {
+ // Der eigentliche Schaden war nicht der fehlende Satz, sondern dass ALLE
+ // Fehlschlaege gleich aussahen. Vor dem Fix waren diese beiden Meldungen
+ // Zeichen fuer Zeichen identisch.
+ const a = await fetchUrl()
+ fallbackThrow = new Error('getaddrinfo ENOTFOUND example.invalid')
+ const b = await fetchUrl('https://example.invalid')
+ expect(a).not.toBe(b)
+ expect(b).toContain('ENOTFOUND')
+ })
+
+ it('ein Nicht-Error als Fallback-Grund wird trotzdem gemeldet, nicht verschluckt', async () => {
+ // `throw 'string'` kommt aus fremdem Code haeufiger vor als man denkt;
+ // String(fallbackErr) muss dann greifen statt einer leeren Stelle.
+ fallbackThrow = 'roher String statt Error'
+ const out = await fetchUrl()
+ expect(out).toContain('roher String statt Error')
+ })
+})
diff --git a/src/api/mcp/builtin-tools.ts b/src/api/mcp/builtin-tools.ts
index ec361139..de898789 100644
--- a/src/api/mcp/builtin-tools.ts
+++ b/src/api/mcp/builtin-tools.ts
@@ -504,7 +504,17 @@ async function executeWebFetch(args: ToolArgs): Promise<string> {
if (text.length > maxLength) return text.substring(0, maxLength) + '\n\n[...truncated]'
return text || 'Error: Page returned empty content'
} catch (fallbackErr) {
- return `Error: web_fetch failed: ${e instanceof Error ? e.message : String(e)}`
+ // The fallback's OWN reason comes first. `fallbackErr` was caught and
+ // then thrown away here, and that was not cosmetic: in browser/dev mode
+ // the Rust command is never reachable, so `e` is the same constant
+ // "backend unavailable" sentence on every single failure. The only text
+ // that says what actually went wrong — DNS, CORS, 404, timeout — lives
+ // in `fallbackErr`, and the model got none of it. Thirty lines up,
+ // executeWebSearch already writes the rule down: a silently swallowed
+ // provider error "would look like search is broken".
+ const why = fallbackErr instanceof Error ? fallbackErr.message : String(fallbackErr)
+ const primary = e instanceof Error ? e.message : String(e)
+ return `Error: web_fetch failed: ${why} (the backend path failed first: ${primary})`
}
}
}
diff --git a/src/api/ollama.ts b/src/api/ollama.ts
index 08dba970..e12b119a 100644
--- a/src/api/ollama.ts
+++ b/src/api/ollama.ts
@@ -368,7 +368,10 @@ export async function checkModelCapability(
signal,
})
if (res.ok) {
- try { await res.json() } catch {}
+ // Drain the body so the socket is released; the VERDICT is the status,
+ // not the payload. A malformed body on a 200 changes nothing this
+ // function reports, so there is nothing here to handle or to log.
+ try { await res.json() } catch { /* body only drained, never read */ }
return { name, ok: true, stale: false }
}
const { parseOllamaError, parseShowNotFound } = await import("../lib/ollama-errors")
@@ -420,8 +423,21 @@ export async function loadModel(name: string): Promise<void> {
log.warn(`[ollama] failed to load model "${name}"`, { status: res.status, message: parsed.message })
throw new ModelLoadError(parsed, name)
}
- // Consume response to ensure model is fully loaded
- try { await res.json() } catch {}
+ // Consume response to ensure model is fully loaded.
+ //
+ // Reading the body IS the wait — Ollama answers /api/generate with
+ // stream:false only once the weights are resident. So a body that fails to
+ // arrive means "we stopped waiting", not "loaded". We still do not throw:
+ // every caller treats loadModel as a warm-up (Header/ModelSelector warm the
+ // picked model, vram-handoff documents its restore as explicitly non-fatal),
+ // and turning a torn read into a user-facing error would be a behaviour
+ // change none of them asked for. What was wrong was doing it in SILENCE:
+ // the one case where "loaded" is a lie left no trace anywhere.
+ try {
+ await res.json()
+ } catch (e) {
+ log.warn(`[ollama] load of "${name}" returned but its body did not read back`, { err: e })
+ }
}
export async function unloadModel(name: string): Promise<void> {
diff --git a/src/api/providers/__tests__/ollama-error-extract.test.ts b/src/api/providers/__tests__/ollama-error-extract.test.ts
index 56f26287..1b2756ed 100644
--- a/src/api/providers/__tests__/ollama-error-extract.test.ts
+++ b/src/api/providers/__tests__/ollama-error-extract.test.ts
@@ -6,7 +6,7 @@ async function extractError(res: Response, fallback: string): Promise<string> {
try {
const data = await res.json()
const raw = data.error || fallback
- const m = typeof raw === 'string' && raw.match(/[\\'"]*([\w.:/\-]+?)[\\'"]*\s+does not support (chat|completion)/i)
+ const m = typeof raw === 'string' && raw.match(/[\\'"]*([\w.:/-]+?)[\\'"]*\s+does not support (chat|completion)/i)
if (m) {
const name = m[1]
return `Ollama rejected "${name}" — its manifest is stale (pulled before Ollama 0.15). Open a terminal and run: ollama pull ${name} Then reload the model.`
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index c6cdf40c..2da12ae6 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -1485,7 +1485,11 @@ export function useCreate() {
const cancel = useCallback(async () => {
abortRef.current?.abort()
if (trainingActive.current) {
- try { await cancelCharacterTraining() } catch {}
+ // Best effort, and deliberately not fatal: Stop's real job is the
+ // abandonPrompt below. A training cancel that fails must not stop us
+ // from taking the render out of the queue — that was the R32 defect
+ // (job left running, file on disk, nobody watching).
+ try { await cancelCharacterTraining() } catch { /* Stop continues regardless */ }
}
// Take OUR job out of the queue — do not blanket-/interrupt.
//
diff --git a/src/hooks/useModels.ts b/src/hooks/useModels.ts
index 9c048ed2..4f42930b 100644
--- a/src/hooks/useModels.ts
+++ b/src/hooks/useModels.ts
@@ -304,7 +304,9 @@ export function useModels() {
]
}
setModels([...allModels, ...comfyModels])
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
+ // (Die Unterdrueckung fuer no-use-before-define stand hier; die Regel
+ // ist in keiner der geerbten Configs an, sie hat nie etwas gemeldet.
+ // Function-Hoisting macht den Vorwaertsbezug ohnehin gueltig.)
if (inventoryOwesRetry(comfyAnswered)) armComfyInventoryRetry(fetchModels)
} catch (err) {
log.warn('[useModels] Model list refresh failed', { err })
diff --git a/src/lib/__tests__/das-gate-bleibt-scharf.test.ts b/src/lib/__tests__/das-gate-bleibt-scharf.test.ts
new file mode 100644
index 00000000..a4609422
--- /dev/null
+++ b/src/lib/__tests__/das-gate-bleibt-scharf.test.ts
@@ -0,0 +1,172 @@
+/**
+ * AS-10 — Sonde fuer die drei Lockerungen in eslint.config.js.
+ *
+ * Eine Regel weicher zu stellen ist der billigste Weg, einen Zaehler zu
+ * senken, und der teuerste, wenn dabei die gefaehrliche Form mit durchrutscht.
+ * Dieser Test misst genau die Grenze: was die Lockerung erlauben SOLL, muss
+ * sauber sein, und was sie NICHT erlauben soll, muss weiterhin ein Fehler
+ * sein. Er laesst dazu die echte eslint.config.js des Projekts laufen — kein
+ * Nachbau, keine zweite Wahrheit.
+ *
+ * Geprueft werden:
+ * 1. no-fallthrough mit allowEmptyCase: true
+ * Erlaubt: `case 'a': /* warum *\/ case 'b':` — ein LEERES Label kann
+ * nirgends hineinfallen, es laeuft kein Code. Gemeldet wurde es nur, weil
+ * ein Kommentar dazwischenstand; die Voreinstellung bestraft also das
+ * Erklaeren, nicht den Code.
+ * Weiterhin verboten: ein case MIT Anweisungen, der ohne `break` in den
+ * naechsten laeuft. Das ist die Form, die wirklich schadet.
+ *
+ * 2. @typescript-eslint/no-unused-vars mit ^_-Mustern
+ * Erlaubt: `catch (_err)`, `(_args) => …` — die Schreibweise, mit der
+ * dieser Baum seit jeher "absichtlich ungenutzt" sagt.
+ * Weiterhin verboten: ein gefangener Fehler OHNE Unterstrich, der nicht
+ * gelesen wird. Genau das war der eine echte Fehler unter den 43
+ * Meldungen (api/mcp/builtin-tools.ts, `catch (fallbackErr)`), und genau
+ * den muss die Regel nach der Lockerung noch finden.
+ *
+ * 3. reportUnusedDisableDirectives: 'error'
+ * Eine Unterdrueckung fuer eine Regel, die nichts meldet, ist eine Luege
+ * ueber das, was geprueft wird. Voreinstellung war 'warn', und
+ * `npm run lint` ist `eslint .` ohne --max-warnings 0: eine Warnung faellt
+ * durch jedes Gate hindurch.
+ *
+ * Run: npx vitest run src/lib/__tests__/das-gate-bleibt-scharf.test.ts
+ */
+import { describe, it, expect, beforeAll } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { dirname, resolve } from 'node:path'
+import { ESLint } from 'eslint'
+
+const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '../../..')
+
+let eslint: ESLint
+beforeAll(() => {
+ eslint = new ESLint({ cwd: ROOT })
+})
+
+/** Regel-IDs, die eslint fuer diesen Quelltext meldet. */
+async function rulesFor(code: string, filePath = 'src/lib/__lint-probe.ts'): Promise<string[]> {
+ const [res] = await eslint.lintText(code, { filePath: resolve(ROOT, filePath) })
+ return res.messages.map((m) => m.ruleId ?? 'UNUSED-DISABLE-DIRECTIVE')
+}
+
+describe('no-fallthrough: der Kommentar ist erlaubt, der Durchfall nicht', () => {
+ it('ein leeres case mit Kommentar dazwischen ist sauber', async () => {
+ const rules = await rulesFor(`
+export function f(x: string): number {
+ switch (x) {
+ case 'a':
+ // Teilt sich absichtlich den Rumpf mit 'b' — genau die Form, die
+ // side-effect-key.ts dreimal benutzt.
+ case 'b':
+ return 1
+ default:
+ return 0
+ }
+}
+`)
+ expect(rules).not.toContain('no-fallthrough')
+ })
+
+ it('SONDE: ein case MIT Anweisungen faellt weiterhin nicht straflos durch', async () => {
+ // Setzt man allowEmptyCase zurueck auf false, bleibt DIESER Test gruen —
+ // er ist die Haelfte, die beweist, dass die Lockerung eng ist. Schaltet
+ // jemand die Regel dagegen ganz ab, faellt er um.
+ const rules = await rulesFor(`
+export function f(x: string, sink: string[]): number {
+ switch (x) {
+ case 'a':
+ sink.push('a')
+ case 'b':
+ sink.push('b')
+ return 1
+ default:
+ return 0
+ }
+}
+`)
+ expect(rules).toContain('no-fallthrough')
+ })
+})
+
+describe('no-unused-vars: `_` ist die Konvention, alles andere bleibt ein Fehler', () => {
+ it('ein Unterstrich-Name gilt als absichtlich ungenutzt', async () => {
+ const rules = await rulesFor(`
+export function f(_args: string, cb: (x: number) => void): void {
+ try {
+ cb(1)
+ } catch (_err) {
+ cb(0)
+ }
+}
+`)
+ expect(rules).not.toContain('@typescript-eslint/no-unused-vars')
+ })
+
+ it('SONDE: ein gefangener Fehler ohne Unterstrich, der nicht gelesen wird, bleibt ein Fehler', async () => {
+ // Die Bauart des einzigen echten Fehlers im Haufen. Wuerde man statt der
+ // ^_-Muster `caughtErrors: 'none'` setzen — die andere naheliegende Art,
+ // 43 auf 3 zu druecken —, waere dieser Test rot und der Fehler fuer immer
+ // unsichtbar.
+ const rules = await rulesFor(`
+export async function f(primary: () => Promise<string>, fallback: () => Promise<string>): Promise<string> {
+ try {
+ return await primary()
+ } catch (e) {
+ try {
+ return await fallback()
+ } catch (fallbackErr) {
+ return String(e)
+ }
+ }
+}
+`)
+ expect(rules).toContain('@typescript-eslint/no-unused-vars')
+ })
+
+ it('das Weglass-Idiom mit Rest bleibt sauber — die Namen benennen, was wegfaellt', async () => {
+ const rules = await rulesFor(`
+type Item = { keep: string; dataUrl: string; unavailable: boolean }
+export const strip = (items: Item[]) => items.map(({ dataUrl, unavailable, ...rest }) => rest)
+`)
+ expect(rules).not.toContain('@typescript-eslint/no-unused-vars')
+ })
+})
+
+describe('tote Unterdrueckungen sind Fehler, nicht Warnungen', () => {
+ it('SONDE: eine Unterdrueckung fuer eine Regel, die nichts meldet, faellt auf', async () => {
+ const [res] = await eslint.lintText(
+ 'export const n: number = 1\n// eslint-disable-next-line no-fallthrough\nexport const m = n + 1\n',
+ { filePath: resolve(ROOT, 'src/lib/__lint-probe.ts') },
+ )
+ const dead = res.messages.filter((m) => m.ruleId === null)
+ expect(dead.length, JSON.stringify(res.messages)).toBeGreaterThan(0)
+ // Der Punkt der Aenderung: Schweregrad 2, nicht 1. `eslint .` laeuft ohne
+ // --max-warnings 0, eine Warnung waere folgenlos.
+ expect(dead[0].severity).toBe(2)
+ })
+})
+
+describe('tsc deckt die Seite ab, die eslint hier abgibt', () => {
+ const readCfg = (name: string) => readFileSync(resolve(ROOT, name), 'utf8')
+
+ it('noFallthroughCasesInSwitch steht in JEDEM der drei Projekte', () => {
+ // allowEmptyCase ist nur deshalb unbedenklich, weil der gefaehrliche Fall
+ // doppelt gedeckt ist. Faellt der Schalter irgendwo raus, ist die
+ // Begruendung in eslint.config.js nicht mehr wahr.
+ for (const f of ['tsconfig.app.json', 'tsconfig.node.json', 'tsconfig.e2e.json']) {
+ expect(readCfg(f), f).toContain('"noFallthroughCasesInSwitch": true')
+ }
+ })
+
+ it('e2e/ und playwright.config.ts stehen in einem Projekt, das tsconfig.json referenziert', () => {
+ // Vor dieser Aenderung stand e2e/ in keinem tsconfig: 17 Spezifikationen
+ // plus playwright.config.ts, die `npm run typecheck` nie gelesen hat.
+ expect(readCfg('tsconfig.json')).toContain('./tsconfig.e2e.json')
+ const e2e = readCfg('tsconfig.e2e.json')
+ expect(e2e).toContain('"e2e"')
+ expect(e2e).toContain('playwright.config.ts')
+ })
+})
diff --git a/src/lib/__tests__/error-text.test.ts b/src/lib/__tests__/error-text.test.ts
index 8ba010b5..b126bbdf 100644
--- a/src/lib/__tests__/error-text.test.ts
+++ b/src/lib/__tests__/error-text.test.ts
@@ -8,6 +8,9 @@
* message, with no subject and no hint of who said it.
*/
import { describe, it, expect } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { fileURLToPath } from 'node:url'
+import { dirname, resolve } from 'node:path'
import { detailOf, withDetail, withInstallerOutput } from '../error-text'
describe('detailOf', () => {
@@ -52,11 +55,7 @@ describe('withDetail', () => {
describe('the surfaces that used to set foreign text as the whole message', () => {
const read = (p: string) =>
- // eslint-disable-next-line @typescript-eslint/no-var-requires
- require('node:fs').readFileSync(
- require('node:path').resolve(__dirname, '..', '..', p),
- 'utf8',
- ) as string
+ readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), '..', '..', p), 'utf8')
it('first run frames every installer log tail', () => {
// Onboarding is the highest visibility surface in the app and it had four
diff --git a/src/lib/fatal-error.ts b/src/lib/fatal-error.ts
index cd3dec55..6901cb7a 100644
--- a/src/lib/fatal-error.ts
+++ b/src/lib/fatal-error.ts
@@ -67,7 +67,9 @@ export function escapeHtml(s: string): string {
/** Plain-DOM fatal-error screen for a boot throw the ErrorBoundary can't catch. */
export function mountFatalError(rootEl: HTMLElement, err: unknown): void {
forceShowWindow()
- // eslint-disable-next-line no-console
+ // Bewusst console.error: das ist der Boot-Pfad, in dem der Logger selbst
+ // schon gescheitert sein kann. `no-console` ist nicht eingeschaltet, die
+ // Unterdrueckung hier war folgenlos.
try { console.error('[LU] fatal boot error', err) } catch { /* ignore */ }
const message = err instanceof Error ? err.stack || err.message : String(err)
const btn =
diff --git a/src/lib/hf-to-provider.ts b/src/lib/hf-to-provider.ts
index f8724891..bf75af4c 100644
--- a/src/lib/hf-to-provider.ts
+++ b/src/lib/hf-to-provider.ts
@@ -17,7 +17,7 @@
* model never appears in the model list — the bug from Discord/GitHub.
*/
-const HF_HOST_RE = /^https?:\/\/(?:huggingface\.co|hf\.co)\/([^\/]+)\/([^\/]+)\/(?:resolve|raw|blob)\/[^\/]+\/(.+)$/i
+const HF_HOST_RE = /^https?:\/\/(?:huggingface\.co|hf\.co)\/([^/]+)\/([^/]+)\/(?:resolve|raw|blob)\/[^/]+\/(.+)$/i
export interface HfRef {
user: string
diff --git a/src/lib/ollama-errors.ts b/src/lib/ollama-errors.ts
index e4d441ee..38bfd446 100644
--- a/src/lib/ollama-errors.ts
+++ b/src/lib/ollama-errors.ts
@@ -30,13 +30,13 @@ export interface ParsedOllamaError {
}
const STALE_MANIFEST_RE =
- /[\\'"]*([\w.:/\-]+?)[\\'"]*\s+does not support (chat|completion|generate)/i
+ /[\\'"]*([\w.:/-]+?)[\\'"]*\s+does not support (chat|completion|generate)/i
// Ollama 0.20.7's /api/show returns 404 "model '<name>' not found" for
// manifests it can no longer parse — empirically this only happens for
// stale manifests pulled before the registry-side capabilities refresh.
// Fresh pulls of the same model name succeed. Treated as stale-manifest so
// the scan + banner can offer a one-click refresh.
-const SHOW_NOT_FOUND_RE = /model\s+['"]?([\w.:/\-]+?)['"]?\s+not\s+found/i
+const SHOW_NOT_FOUND_RE = /model\s+['"]?([\w.:/-]+?)['"]?\s+not\s+found/i
// Bug C (v2.4.5 — Anson192 GH Discussion #39, RTX 4090): Ollama reports
// `unable to load model: <path>/blobs/sha256-<hash>` (HTTP 500) when the
// manifest references a blob that isn't on disk. Happens when blobs are
diff --git a/src/lib/ollama-stream-tools.ts b/src/lib/ollama-stream-tools.ts
index 84f9d7ba..4fa29c36 100644
--- a/src/lib/ollama-stream-tools.ts
+++ b/src/lib/ollama-stream-tools.ts
@@ -98,16 +98,15 @@ export async function streamOllamaChatWithTools(
else if (options.thinking === false) body.think = false
const url = ollamaUrl('/chat')
- let response: Response
- try {
- response = await localFetchStream(url, {
- method: 'POST',
- body: JSON.stringify(body),
- signal: options.signal,
- })
- } catch (fetchErr) {
- throw fetchErr
- }
+ // Was wrapped in `try { … } catch (fetchErr) { throw fetchErr }`. Checked
+ // against 9eb13291, the commit that wrote it: the catch never enriched
+ // anything — it was born as a plain rethrow. Removing it changes no
+ // behaviour; keeping it only suggested that something happened here.
+ let response: Response = await localFetchStream(url, {
+ method: 'POST',
+ body: JSON.stringify(body),
+ signal: options.signal,
+ })
if (!response.ok && response.status === 400 && 'think' in body) {
delete body.think
diff --git a/src/lib/render/safety.ts b/src/lib/render/safety.ts
index 4293a0c4..dbe060db 100644
--- a/src/lib/render/safety.ts
+++ b/src/lib/render/safety.ts
@@ -48,6 +48,12 @@ function baseNormalize(text: string): string {
.normalize('NFKD')
.replace(/[\u0300-\u036f]/g, '')
.toLowerCase()
+ // NUL is the LOWER BOUND of the ASCII range here, not a control character
+ // matched for its own sake: this line folds every NON-ASCII code point
+ // through HOMOGLYPHS. Narrowing the range to start at 0x20 to appease the
+ // rule would stop folding any homoglyph that maps onto a control char —
+ // exactly the evasion this normalizer exists to close.
+ // eslint-disable-next-line no-control-regex
.replace(/[^\u0000-\u007F]/g, (ch) => HOMOGLYPHS[ch] ?? ch)
}
diff --git a/src/stores/__tests__/releaseNotesStore.test.ts b/src/stores/__tests__/releaseNotesStore.test.ts
index 903239ae..fc6ef51d 100644
--- a/src/stores/__tests__/releaseNotesStore.test.ts
+++ b/src/stores/__tests__/releaseNotesStore.test.ts
@@ -119,9 +119,10 @@ describe('the notes table', () => {
it('the modal renders the expander and the sections', () => {
// Source guard, same pattern as the settings guards: the sheet must offer
// Show all changes and map note.details, or the table above is dead data.
- const { readFileSync } = require('node:fs')
- const { resolve } = require('node:path')
- const src = readFileSync(resolve(__dirname, '../../components/release/ReleaseNotesModal.tsx'), 'utf8')
+ const src = readFileSync(
+ resolve(dirname(fileURLToPath(import.meta.url)), '../../components/release/ReleaseNotesModal.tsx'),
+ 'utf8',
+ )
expect(src).toContain('Show all changes')
expect(src).toContain('note.details.map')
expect(src).toContain('section.items.map')
diff --git a/src/types/agent-mode.ts b/src/types/agent-mode.ts
index 80a9b43a..9a2ccdbb 100644
--- a/src/types/agent-mode.ts
+++ b/src/types/agent-mode.ts
@@ -1,7 +1,7 @@
// Agent Mode — Type Definitions
// Part of the Agent Mode feature (coding-orch branch)
-import type { JSONSchemaProp } from '../api/mcp/types'
+import type { JSONSchemaProp, ToolArgs } from '../api/mcp/types'
// Permission tiers (auto-approve reads, confirm writes)
export type ToolPermission = 'auto' | 'confirm'
@@ -52,7 +52,11 @@ export interface OllamaTool {
export interface OllamaToolCall {
function: {
name: string
- arguments: Record<string, any>
+ /* Was `Record<string, any>`. It is the project's own ToolArgs — every
+ consumer already reads these through the argString/argNumber guards in
+ builtin-tools.ts, so the `any` was not carrying anything: swapping it
+ for the real type left tsc at 0 errors across the whole program. */
+ arguments: ToolArgs
}
}
@@ -84,7 +88,7 @@ export type ToolCallStatus = 'pending_approval' | 'running' | 'completed' | 'fai
export interface AgentToolCall {
id: string
toolName: string
- args: Record<string, any>
+ args: ToolArgs
status: ToolCallStatus
result?: string
error?: string
diff --git a/src/types/agents.ts b/src/types/agents.ts
index 0732f143..30644962 100644
--- a/src/types/agents.ts
+++ b/src/types/agents.ts
@@ -1,3 +1,5 @@
+import type { ToolArgs } from '../api/mcp/types';
+
export type AgentStatus =
| "idle"
| "planning"
@@ -37,7 +39,10 @@ export interface Tool {
export interface ToolCall {
id: string;
tool: ToolName;
- args: Record<string, any>;
+ /* Was `Record<string, any>` — same story as agent-mode.ts: this is ToolArgs,
+ and the guards were already doing the narrowing the `any` pretended to
+ make unnecessary. */
+ args: ToolArgs;
result?: string;
error?: string;
status:
diff --git a/tsconfig.e2e.json b/tsconfig.e2e.json
new file mode 100644
index 00000000..d959135d
--- /dev/null
+++ b/tsconfig.e2e.json
@@ -0,0 +1,54 @@
+{
+ /* ── e2e/ war in keinem tsconfig ──────────────────────────────────────────
+ Gemessen am 01.09.2026 mit `tsc -p tsconfig.app.json --listFilesOnly`:
+ tsconfig.app.json nimmt `["src", "mobile-client"]`, tsconfig.node.json
+ nimmt `["vite.config.ts"]`. 17 Playwright-Dateien und playwright.config.ts
+ standen damit in KEINEM Projekt, und `npm run typecheck` (`tsc -b --force`)
+ hat sie nie gelesen.
+
+ Es ist derselbe Befund wie bei scripts/ in eslint.config.js: nicht ein
+ rotes Gate, sondern ein Gate, das eine ganze Zone stillschweigend nicht
+ abdeckt. Der Unterschied ist, wer sie nicht abdeckt — eslint prueft e2e/
+ sehr wohl (`--print-config e2e/cloud-gate.spec.ts` meldet 106 Regeln; der
+ Parser ist nicht typ-aware, `parserOptions.project` ist leer, deshalb
+ haengt dort nichts an der tsconfig-Zugehoerigkeit). Es war tsc.
+
+ Was das Schliessen kostet: NICHTS. 0 neue Fehler bei 18 zusaetzlich
+ gepruften Dateien. Die Zone war nicht kaputt, sie war nur unbeobachtet —
+ und das ist genau der Zustand, in dem sie es unbemerkt haette werden
+ koennen.
+
+ `types` traegt `vite/client` mit, weil die Spezifikationen ueber
+ e2e/support/ bis in src/api/cloud/config.ts hineinziehen, und das liest
+ `import.meta.env`. Ohne den Eintrag: 3 Fehler, alle TS2339 auf
+ ImportMeta.env. */
+ "compilerOptions": {
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.e2e.tsbuildinfo",
+ "target": "ES2023",
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
+ /* `node` fuer process.env in playwright.config.ts, `vite/client` fuer die
+ src-Dateien, die die Spezifikationen mitziehen. */
+ "types": ["node", "vite/client"],
+ "skipLibCheck": true,
+
+ /* Bundler mode — identisch zu tsconfig.app.json, damit ein Import, der in
+ src/ typprueft, es auch tut, wenn e2e/ ihn zieht. */
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": true,
+ "moduleDetection": "force",
+ "noEmit": true,
+
+ /* Linting — dieselbe Strenge wie app und node. Eine e2e-Zone mit
+ schwaecheren Schaltern waere der zweite Pflegeweg, den dieses Projekt
+ ueberall als Grundfehler hat. */
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "erasableSyntaxOnly": true,
+ "noFallthroughCasesInSwitch": true,
+ "noUncheckedSideEffectImports": true
+ },
+ "include": ["e2e", "playwright.config.ts"]
+}
diff --git a/tsconfig.json b/tsconfig.json
index 1ffef600..a999c8a6 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,6 +2,7 @@
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
- { "path": "./tsconfig.node.json" }
+ { "path": "./tsconfig.node.json" },
+ { "path": "./tsconfig.e2e.json" }
]
}