delete c0re-side reminder plumbing (#2635 inc 1 commit 6)

This commit is contained in:
damocles 2026-07-22 23:01:16 +02:00 committed by mara
commit a80d0b0fed
16 changed files with 70 additions and 1136 deletions

View file

@ -32,7 +32,6 @@ mod meta_inputs;
mod misc_api;
pub(crate) mod permissions;
mod questions;
mod reminders;
mod schedules;
mod state_files;
mod state_snapshot;
@ -93,7 +92,6 @@ pub async fn serve(
"/api/extra-forge-account",
post(extra_forges::post_extra_forge_account),
)
.route("/api/reminders", get(reminders::api_reminders))
.route("/api/operator-inbox", get(misc_api::api_operator_inbox))
.route("/api/stats-hive", get(misc_api::api_stats_hive))
.route(
@ -212,14 +210,6 @@ pub async fn serve(
"/api/github-account",
post(matrix_accounts::post_github_account).get(matrix_accounts::get_github_account),
)
.route(
"/api/cancel-reminder/{id}",
post(reminders::post_cancel_reminder),
)
.route(
"/api/retry-reminder/{id}",
post(reminders::post_retry_reminder),
)
.route("/api/request-spawn", post(misc_api::post_request_spawn))
.route("/api/op-send", post(misc_api::post_op_send))
.route("/api/meta-update", post(meta_inputs::post_meta_update))

View file

@ -1,61 +0,0 @@
//! Reminder endpoints for the dashboard.
//!
//! Lists pending reminders for the reminders tab, and lets the operator
//! cancel a pending reminder or reset its failure state so the scheduler
//! retries it on the next tick.
use axum::{
extract::{Path as AxumPath, State},
http::StatusCode,
response::{IntoResponse, Response},
};
use problem_details::ProblemDetails;
use super::{AppState, error_problem, error_response};
pub(super) async fn api_reminders(State(state): State<AppState>) -> Response {
match state.coord.broker.list_pending_reminders() {
Ok(rows) => axum::Json(rows).into_response(),
Err(e) => error_response(&format!("reminders: {e:#}")),
}
}
pub(super) async fn post_cancel_reminder(
State(state): State<AppState>,
AxumPath(id): AxumPath<i64>,
) -> Result<Response, ProblemDetails> {
match state.coord.broker.cancel_reminder(id) {
Ok(0) => Err(ProblemDetails::from_status_code(StatusCode::NOT_FOUND)
.with_detail(format!("reminder {id} not pending (already delivered?)"))),
Ok(_) => {
tracing::info!(%id, "operator cancelled reminder");
state.coord.emit_reminders_snapshot();
Ok((StatusCode::OK, "ok").into_response())
}
Err(e) => Err(error_problem(&format!(
"cancel reminder {id} failed: {e:#}"
))),
}
}
/// Reset a pending reminder's failure state so the scheduler
/// retries it on the next tick. Useful when the failure was
/// transient (sqlite lock contention, disk full → freed up) and
/// the operator wants delivery to resume immediately instead of
/// the row sitting in attempt-count-capped purgatory.
pub(super) async fn post_retry_reminder(
State(state): State<AppState>,
AxumPath(id): AxumPath<i64>,
) -> Result<Response, ProblemDetails> {
match state.coord.broker.reset_reminder_failure(id) {
Ok(0) => Err(ProblemDetails::from_status_code(StatusCode::NOT_FOUND)
.with_detail(format!("reminder {id} not pending (already delivered?)"))),
Ok(_) => {
tracing::info!(%id, "operator reset reminder failure for retry");
state.coord.emit_reminders_snapshot();
Ok((StatusCode::OK, "ok").into_response())
}
Err(e) => Err(error_problem(&format!("retry reminder {id} failed: {e:#}"))),
}
}