Error log: pages and deletion; no waitlist in the interface
CI / test (push) Successful in 2m0s
CI / build (push) Skipped
CI / deploy (push) Skipped

- The error log pages (50 per page) instead of loading more and more; an
  entry can be deleted, or every entry the filter matches at once
  (DELETE /v1/admin/errors/{id}, DELETE /v1/admin/errors?source=&outcome=).
- The waitlist form (home page, login pages) and the admin waitlist table are
  gone; the stored addresses and the backend routes are left as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-23 09:33:00 +00:00
co-authored by Claude Opus 5.5
parent 8d9c50cb02
commit 169fb9c85d
12 changed files with 165 additions and 241 deletions
+42 -2
View File
@@ -1,8 +1,10 @@
//! Admin: the error log of the analyses, answers and prompt test runs (every
//! failed attempt, written by the worker), newest first.
//! failed attempt, written by the worker), newest first. Entries can be
//! deleted one by one or all that match a filter.
use axum::Json;
use axum::extract::{Query, State};
use axum::extract::{Path, Query, State};
use axum::http::StatusCode;
use axum_extra::extract::WithRejection;
use serde::Deserialize;
use serde_json::{Value, json};
@@ -71,3 +73,41 @@ pub async fn list(
.collect();
Ok(Json(json!({ "errors": errors, "total": total, "last_day": last_day, "limit": limit, "offset": offset })))
}
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DeleteQuery {
source: Option<String>,
outcome: Option<String>,
}
/// Deletes every entry matching the filter (none given: all of them).
pub async fn delete_matching(
State(state): St,
AdminUser(admin): AdminUser,
WithRejection(Query(query), _): WithRejection<Query<DeleteQuery>, ApiError>,
) -> ApiResult<Json<Value>> {
let deleted = sqlx::query(
"DELETE FROM generation_errors WHERE ($1::text IS NULL OR source = $1) AND ($2::text IS NULL OR outcome = $2)",
)
.bind(&query.source)
.bind(&query.outcome)
.execute(&state.db)
.await?
.rows_affected();
tracing::info!(admin = %admin.id(), deleted, "error log entries deleted");
Ok(Json(json!({ "deleted": deleted })))
}
/// Deletes one entry.
pub async fn delete_one(
State(state): St,
_admin: AdminUser,
WithRejection(Path(id), _): WithRejection<Path<i64>, ApiError>,
) -> ApiResult<StatusCode> {
let result = sqlx::query("DELETE FROM generation_errors WHERE id = $1").bind(id).execute(&state.db).await?;
if result.rows_affected() == 0 {
return Err(ApiError::NotFound("error"));
}
Ok(StatusCode::NO_CONTENT)
}
+2 -1
View File
@@ -147,7 +147,8 @@ pub fn router(state: Arc<AppState>) -> Router {
.route("/v1/admin/prompts/{kind}/{language}", axum::routing::put(prompts::save))
.route("/v1/admin/prompts/{kind}/{language}/preview", post(prompts::start_preview))
.route("/v1/admin/previews/{id}", get(prompts::get_preview))
.route("/v1/admin/errors", get(errors::list))
.route("/v1/admin/errors", get(errors::list).delete(errors::delete_matching))
.route("/v1/admin/errors/{id}", axum::routing::delete(errors::delete_one))
.route("/v1/admin/jobs", get(jobs::list))
.route("/v1/admin/jobs/restart", post(jobs::restart))
.route("/v1/admin/models", get(models::list))
+13
View File
@@ -2214,6 +2214,19 @@ async fn admins_read_the_error_log(pool: PgPool) {
let r = app.get("/v1/admin/errors?outcome=retry", Some(&admin)).await;
assert_eq!(r.body["errors"].as_array().unwrap().len(), 1);
assert_eq!(app.get("/v1/admin/errors?source=question", Some(&admin)).await.body["total"], 0);
// deleted one by one, or all that match the filter
let retry_id = r.body["errors"][0]["id"].as_i64().unwrap();
let r = app.call("DELETE", &format!("/v1/admin/errors/{retry_id}"), Some(&anna), None).await;
assert_eq!(r.status, StatusCode::FORBIDDEN);
let r = app.call("DELETE", &format!("/v1/admin/errors/{retry_id}"), Some(&admin), None).await;
assert_eq!(r.status, StatusCode::NO_CONTENT);
let r = app.call("DELETE", &format!("/v1/admin/errors/{retry_id}"), Some(&admin), None).await;
assert_eq!(r.status, StatusCode::NOT_FOUND);
let r = app.call("DELETE", "/v1/admin/errors?outcome=retry", Some(&admin), None).await;
assert_eq!(r.body["deleted"], 0);
let r = app.call("DELETE", "/v1/admin/errors?source=analysis", Some(&admin), None).await;
assert_eq!((r.status, &r.body["deleted"]), (StatusCode::OK, &json!(1)), "{}", r.body);
assert_eq!(app.get("/v1/admin/errors", Some(&admin)).await.body["total"], 0);
// users see the attempts of their analysis (the page says it is tried again)
let r = app.get(&format!("/v1/analyses/{analysis}"), Some(&anna)).await;
assert_eq!(r.body["attempts"], 0);