fix(store): Modell entfernen trotz Einträgen im Anfrage-Log (#1068)

anfrage_log.model_id verwies auf das Modell und löste einen
FOREIGN KEY-Fehler aus; die Einträge verlieren jetzt die Zuordnung.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg3osejhFSpUz472iQ1
This commit is contained in:
2026-11-16 13:11:19 +01:00
parent 589a96dea0
commit 46046d154e
5 changed files with 38 additions and 5 deletions

View File

@ -2160,6 +2160,26 @@ async fn modell_entfernen_nur_gesperrt_bestaetigt_und_als_admin() {
assert!(loc.unwrap().contains("m=entfernen_freigegeben"));
assert!(names(&gw).contains(&"bonsai".to_string()));
// Ein früherer Eintrag im Anfrage-Log verweist auf das Modell (wie bei den
// Testmodellen auf srv04); das darf das Entfernen nicht verhindern.
gw.state
.store()
.log_request(&nexus_store::RequestLogEntry {
correlation: "req_test".to_string(),
api_key_id: None,
model: Some("gesperrt".to_string()),
status: 200,
wait_ms: None,
latency_ms: None,
duration_ms: None,
tokens_in: None,
tokens_out: None,
engine: None,
instance_id: None,
aborted: false,
})
.unwrap();
// Gesperrtes Modell mit Bestätigung: entfernt und im Audit.
let body = format!("csrf={csrf}&name=gesperrt&bestaetigt=1");
let (_, loc, _) = ui_post(&gw, "/ui/modelle/entfernen", &cookie, &body).await;