chore: cross-ref enum/CHECK constraints (#9); drop dead clone + harden smoke test (#4)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 17:21:33 +02:00
parent 2bce469ed2
commit 1a91b8a242
4 changed files with 22 additions and 6 deletions
+4
View File
@@ -4,6 +4,10 @@ use time::OffsetDateTime;
use uuid::Uuid;
/// What kind of change an audit entry records.
///
/// NOTE: kept in sync by hand with the
/// `CHECK (action IN ('created', 'updated', 'deleted'))` constraint in
/// `crates/db/migrations/0001_audit_log.sql` — add a variant in both places.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum AuditAction {
+4
View File
@@ -3,6 +3,10 @@ use serde::{Deserialize, Serialize};
use crate::{AuthorityId, LocalizedLabel};
/// The kind of authority record.
///
/// NOTE: kept in sync by hand with the
/// `CHECK (kind IN ('person', 'organisation', 'place'))` constraint in
/// `crates/db/migrations/0002_vocabularies_authorities.sql` — add a variant in both places.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum AuthorityKind {
+1 -1
View File
@@ -50,7 +50,7 @@ pub async fn run(config: Config) -> anyhow::Result<()> {
let state = AppState {
db,
app_name: config.app_name.clone(),
app_name: config.app_name,
cookie_secure: config.cookie_secure,
search,
};
+13 -5
View File
@@ -22,13 +22,21 @@ async fn serves_health_live_over_tcp() {
let listener = TcpListener::bind("127.0.0.1:0").await.unwrap();
let addr: SocketAddr = listener.local_addr().unwrap();
let handle = tokio::spawn(async move {
serve(listener, state).await.unwrap();
});
let handle = tokio::spawn(async move { serve(listener, state).await });
let url = format!("http://{addr}/health/live");
let body: serde_json::Value = reqwest::get(&url)
.await
let response = reqwest::get(&url).await;
// If the request failed and the server task already ended, it errored — surface that
// (a clear server error) instead of the opaque reqwest failure.
if response.is_err() && handle.is_finished() {
match handle.await {
Ok(Err(err)) => panic!("server failed: {err:?}"),
other => panic!("server task ended unexpectedly: {other:?}"),
}
}
let body: serde_json::Value = response
.expect("request succeeds")
.json()
.await