From 91a15baebc37e744a09aa296aa18fe48c2f9f72a Mon Sep 17 00:00:00 2001 From: wlkns-dev Date: Sat, 7 Nov 2026 11:55:56 +0100 Subject: [PATCH] feat: Podman-Status im Setup und Schritt-Ansicht je Lauf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Setup zeigt, ob der Container-Befehl läuft (Version). Ergebnistabelle hat eine Schritte-Ansicht: Nachrichten, Tool-Aufrufe und Tool-Antworten eines Laufs aus der Datenbank. Store-Test grün, 53 Unit-Tests insgesamt. Co-Authored-By: Claude Haiku 5.5 --- ROADMAP.md | 2 +- src-tauri/src/lib.rs | 47 ++++++++++++++++++++++++- src-tauri/src/store.rs | 56 ++++++++++++++++++++++++++++++ src/routes/+page.svelte | 76 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 179 insertions(+), 2 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 623f09f..f5179b1 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -51,7 +51,7 @@ Zeichen: ✓ fertig · ◐ teilweise · ✗ offen · ? nicht geprüft. - [#1022] **Runner.** Umgesetzt in `src-tauri/src/runner.rs`, über `start_batch` und `cancel_batch` an die Oberfläche angebunden. Offen: Abbruch in der App real prüfen, Modelle mit eigenem Endpunkt in der Config (Phase 1 hat einen gemeinsamen `ollama_url`). Tests `batch2fortsetzen.1–.2`. → #1005 - [#1023] **SQLite-Speicher.** Umgesetzt in `src-tauri/src/store.rs`, Schema nach SPEC 8. Datei-Datenbank im Datenordner angebunden. Offen: Klicktest `lauf2ergebnis.2` mit Schritt-Ansicht (noch keine Oberfläche dafür). Tests `lauf2ergebnis.2`. → #1006 - [#1024] **Aufgaben a-01 bis a-03, b-04 bis b-06 schreiben.** Geschrieben unter `tasks/`. b-06 mit Mutationstest; ein Fehler im Check (veralteter Bytecode bei Mutanten) ist behoben. Ergebnis: mit `qwen3.8-flash-next-q2_0` über strata 6 von 6 bestanden. Bericht in `testberichte/`. Offen: Zeitlimit von b-04 bei langsamen Modellen prüfen. → #1007 -- [#1025] **GUI Setup und Batch.** Gebaut: Pfade, Aufgabenauswahl, Modelle, Wiederholungen, Start, Abbrechen, Live-Log, Ergebnistabelle. Offen: Podman-Status im Setup, Schritt-Log in der Oberfläche, Klicktest `batch2fortsetzen.1` manuell. → #1008 +- [#1025] **GUI Setup und Batch.** Gebaut: Pfade, Container-Status (Podman-Version im Setup), Aufgabenauswahl, Modelle, Wiederholungen, Start, Abbrechen, Live-Log, Ergebnistabelle, Rangliste und Matrix, Schritt-Ansicht je Lauf. Offen: Klicktests `batch2fortsetzen.1` und `lauf2ergebnis.2` manuell, Oberfläche im Fenster ansehen. → #1008 - [#1026] **Rangliste und Matrix.** Gebaut: Gesamtscore (gewichtet nach `weight`), Median-Dauer als Tie-Breaker, Matrix Modell × Aufgabe mit Erfolgen und Farbe nach Score. Offen: Wilson-Intervall und „nicht unterscheidbar“ (F-12, Phase 2), Lauf-Detail mit Schrittliste, Klicktest `ergebnis2detail.1` manuell. Tests `ergebnis2detail.1`. → #1009 **P2 – danach (Release 0.2.0, Referenz und Tiefe)** diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 92f094d..5526621 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -121,6 +121,49 @@ fn batch_results(paths: State<'_, AppPaths>, batch_id: i64) -> Result, + batch_id: i64, + model: String, + task_id: String, + repeat_idx: u32, +) -> Result, String> { + let store = Store::open(&paths.0.data_dir.join(DB_FILE))?; + store.steps_for_run(batch_id, &model, &task_id, repeat_idx) +} + +/// Zustand der Container-Laufzeit (Podman) für das Setup. +#[derive(serde::Serialize)] +pub struct RuntimeStatus { + pub program: String, + pub available: bool, + pub detail: String, +} + +#[tauri::command] +fn runtime_status(cfg: State<'_, Config>) -> RuntimeStatus { + let program = cfg.container_runtime.clone(); + match std::process::Command::new(&program).args(["version", "--format", "{{.Client.Version}}"]).output() { + Ok(out) if out.status.success() => RuntimeStatus { + program, + available: true, + detail: format!("Version {}", String::from_utf8_lossy(&out.stdout).trim()), + }, + Ok(out) => RuntimeStatus { + program, + available: false, + detail: String::from_utf8_lossy(&out.stderr).trim().to_string(), + }, + Err(e) => RuntimeStatus { + program, + available: false, + detail: format!("nicht startbar: {e}"), + }, + } +} + /// Rangliste und Matrix eines Batches. Gewichte kommen aus den Aufgaben. #[tauri::command] fn batch_ranking(paths: State<'_, AppPaths>, batch_id: i64) -> Result { @@ -164,7 +207,9 @@ pub fn run() { start_batch, cancel_batch, batch_results, - batch_ranking + batch_ranking, + run_steps, + runtime_status ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/src-tauri/src/store.rs b/src-tauri/src/store.rs index 9b78fdf..fd06336 100644 --- a/src-tauri/src/store.rs +++ b/src-tauri/src/store.rs @@ -50,6 +50,17 @@ CREATE TABLE IF NOT EXISTS step ( "; /// Ein abgeschlossener Lauf, so wie er gespeichert wird. +/// Ein Schritt eines Laufs, für die Anzeige. +#[derive(Debug, Clone, PartialEq, Serialize)] +pub struct StepRow { + pub idx: i64, + pub role: String, + pub content: String, + pub tool_name: Option, + pub tool_args_json: Option, + pub tool_result: Option, +} + #[derive(Debug, Clone, PartialEq, Serialize)] pub struct RunRecord { pub batch_id: i64, @@ -217,6 +228,38 @@ impl Store { rows.collect::, _>>().map_err(|e| e.to_string()) } + /// Schritte eines Laufs, identifiziert über Batch, Modell, Aufgabe und Wiederholung. + pub fn steps_for_run( + &self, + batch_id: i64, + model: &str, + task_id: &str, + repeat_idx: u32, + ) -> Result, String> { + let mut stmt = self + .conn + .prepare( + "SELECT s.idx, s.role, s.content, s.tool_name, s.tool_args_json, s.tool_result + FROM step s JOIN run r ON s.run_id = r.id + WHERE r.batch_id = ?1 AND r.model = ?2 AND r.task_id = ?3 AND r.repeat_idx = ?4 + ORDER BY s.idx", + ) + .map_err(|e| e.to_string())?; + let rows = stmt + .query_map(params![batch_id, model, task_id, repeat_idx], |r| { + Ok(StepRow { + idx: r.get(0)?, + role: r.get(1)?, + content: r.get(2)?, + tool_name: r.get(3)?, + tool_args_json: r.get(4)?, + tool_result: r.get(5)?, + }) + }) + .map_err(|e| e.to_string())?; + rows.collect::, _>>().map_err(|e| e.to_string()) + } + pub fn run_count(&self, batch_id: i64) -> Result { self.conn .query_row("SELECT COUNT(*) FROM run WHERE batch_id = ?1", params![batch_id], |r| r.get(0)) @@ -301,6 +344,19 @@ mod tests { assert!(s.runs_for_batch(99).unwrap().is_empty()); } + #[test] + fn schritte_eines_laufs_werden_gefunden() { + let mut s = Store::open_in_memory().unwrap(); + let b = s.create_batch("", 1, "{}").unwrap(); + let transcript = vec![Message::new("user", "Aufgabe"), Message::new("assistant", "ok")]; + s.insert_run(&rec(b, "m1", "a-01", 1), &transcript).unwrap(); + let steps = s.steps_for_run(b, "m1", "a-01", 1).unwrap(); + assert_eq!(steps.len(), 2); + assert_eq!(steps[0].role, "user"); + assert_eq!(steps[1].content, "ok"); + assert!(s.steps_for_run(b, "m1", "a-01", 2).unwrap().is_empty()); + } + #[test] fn unbekannter_batch_existiert_nicht() { let s = Store::open_in_memory().unwrap(); diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 23952d0..bf39d02 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -56,6 +56,17 @@ type MatrixCell = { model: string; task_id: string; runs: number; successes: number; mean_score: number }; type Ranking = { batch_id: number; models: ModelRank[]; cells: MatrixCell[]; tasks: string[] }; let ranking = $state(null); + type RuntimeStatus = { program: string; available: boolean; detail: string }; + type StepRow = { + idx: number; + role: string; + content: string; + tool_name: string | null; + tool_args_json: string | null; + tool_result: string | null; + }; + let runtime = $state(null); + let detail = $state<{ model: string; task_id: string; repeat_idx: number; steps: StepRow[] } | null>(null); let batchError = $state(""); let unlisten: UnlistenFn | null = null; @@ -66,6 +77,11 @@ } catch (e) { error = String(e); } + try { + runtime = await invoke("runtime_status"); + } catch (e) { + runtime = { program: "?", available: false, detail: String(e) }; + } try { report = await invoke("load_tasks"); } catch (e) { @@ -133,6 +149,17 @@ } } + async function showSteps(r: RunRow) { + if (batchId === null) return; + const steps = await invoke("run_steps", { + batchId, + model: r.model, + taskId: r.task_id, + repeatIdx: r.repeat_idx, + }); + detail = { model: r.model, task_id: r.task_id, repeat_idx: r.repeat_idx, steps }; + } + async function cancel() { await invoke("cancel_batch"); } @@ -153,6 +180,18 @@
{paths.data_dir}
Aufgabenordner
{paths.tasks_dir}
+
Container
+
+ {#if runtime} + {#if runtime.available} + {runtime.program} verfügbar, {runtime.detail} + {:else} + {runtime.program} nicht nutzbar: {runtime.detail} + {/if} + {:else} + Prüfe … + {/if} +
{:else}

Lade Pfade …

@@ -297,6 +336,7 @@ Score Schritte Dauer + @@ -309,10 +349,31 @@ {r.score.toFixed(2)} {r.steps} {(r.duration_ms / 1000).toFixed(1)} s + {/each} + + {#if detail} +

Schritte: {detail.model} · {detail.task_id} · Wdh. {detail.repeat_idx}

+
    + {#each detail.steps as st (st.idx)} +
  1. + {st.role} + {#if st.tool_name} + · Tool {st.tool_name} {st.tool_args_json ?? ""} + {/if} + {#if st.content} +
    {st.content}
    + {/if} + {#if st.tool_result} +
    {st.tool_result}
    + {/if} +
  2. + {/each} +
+ {/if} {/if} @@ -400,6 +461,21 @@ color: #c62828; } + .ok { + color: #2e7d32; + } + + .schritte pre { + white-space: pre-wrap; + overflow-wrap: anywhere; + max-height: 12rem; + overflow-y: auto; + background: #8881; + padding: 0.4rem; + margin: 0.3rem 0; + font-size: 0.85rem; + } + .matrix .zelle { text-align: center; font-variant-numeric: tabular-nums;