test: Test-Suite für Single-Server-Konfig, Loop-Logik und Skripte
Node-eigener Test-Runner (keine Dependencies). 35 Tests: - pure-logic: parseVerdict/parseBlockers/normalizeForComparison (real aus der Extension extrahiert), inkl. PASS-WITH-CONCERNS-Abgrenzung - config: models.json/settings.json-Invarianten (kein Port 8002, nur llama-cpp-single/qwen3.5-single), Querkonsistenz - extension-guards: Regression-Schutz fuer jeden Fix (select positional, kein switchModel, before_agent_start-Hook, passed-Logik, Loop-Fallback) - scripts: bash -n + Single-Server-Invarianten Start: ./run-tests.sh Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
56904329d0
commit
ba733fe684
6 changed files with 266 additions and 0 deletions
46
tests/extension-guards.test.mjs
Normal file
46
tests/extension-guards.test.mjs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// Statische Regression-Guards: sichern die konkreten Fixes/Umbauten gegen versehentliches
|
||||
// Zurückdrehen ab. Prüft den Extension-Quelltext, ohne ihn auszuführen.
|
||||
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { extSource } from "./helpers.mjs";
|
||||
|
||||
test("Crash-Fix: ctx.ui.select wird positional aufgerufen, nicht mit einem Objekt", () => {
|
||||
// Der Crash 'reading length' entstand durch ctx.ui.select({...}) statt select(title, options[]).
|
||||
assert.doesNotMatch(extSource, /ui\.select\(\s*\{/, "ui.select darf NICHT mit Objekt aufgerufen werden");
|
||||
assert.match(extSource, /ui\.select\(\s*titleLine\s*,\s*\[/, "ui.select muss (title, options[]) erhalten");
|
||||
});
|
||||
|
||||
test("Single-GPU: keine switchModel-Aufrufe mehr (durch selectRole ersetzt)", () => {
|
||||
assert.doesNotMatch(extSource, /switchModel\s*\(\s*pi/);
|
||||
assert.match(extSource, /function selectRole\b/);
|
||||
assert.match(extSource, /function ensureSingleModel\b/);
|
||||
});
|
||||
|
||||
test("System-Prompt-Rollen: before_agent_start-Hook injiziert Coder-/Judge-Persona", () => {
|
||||
assert.match(extSource, /pi\.on\(\s*["']before_agent_start["']/);
|
||||
assert.match(extSource, /function coderPersona\b/);
|
||||
assert.match(extSource, /function judgePersona\b/);
|
||||
// Persona wird angehängt, nicht ersetzt (Pi-Basis-System-Prompt bleibt erhalten).
|
||||
assert.match(extSource, /event\.systemPrompt\s*\+/);
|
||||
});
|
||||
|
||||
test("Quick-Judge abgeschafft: keine quickJudge-Prompt-Funktionen mehr", () => {
|
||||
assert.doesNotMatch(extSource, /function quickJudgePrompt\b/);
|
||||
assert.doesNotMatch(extSource, /function quickJudgeWithTestsPrompt\b/);
|
||||
});
|
||||
|
||||
test("Fix-Auslösung: PASS WITH CONCERNS gilt nur mit --approve-concerns als bestanden", () => {
|
||||
assert.match(extSource, /passed\s*=\s*verdict === "PASS"/);
|
||||
assert.match(extSource, /verdict === "PASS WITH CONCERNS"\s*&&\s*approveConcerns/);
|
||||
// und der Bestanden-Zweig nutzt 'passed', nicht mehr das alte 'verdict === PASS WITH CONCERNS'.
|
||||
assert.match(extSource, /if\s*\(\s*passed\s*\)/);
|
||||
});
|
||||
|
||||
test("Loop-Erkennung greift auch ohne Blocker-Abschnitt (Fallback auf Gesamttext)", () => {
|
||||
assert.match(extSource, /parseBlockers\(judgeText\)\s*\|\|\s*judgeText/);
|
||||
});
|
||||
|
||||
test("currentRole wird nach jedem optimize-Lauf auf 'coder' zurückgesetzt", () => {
|
||||
assert.match(extSource, /currentRole\s*=\s*"coder"/);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue