Summary#
- Implements
GET /xrpc/_health— the first real XRPC route and the pattern for all future endpoint additions - Returns
{"version":"0.1.0","db":"ok"}(200) when the SQLite pool is healthy;{"version":"0.1.0","db":"error"}(503) when it isn't - Establishes
routes/module with one file per endpoint (routes/health.rs)
Changes#
routes/health.rs— handler (impl IntoResponse), 4 integration tests covering 200/503/content-type/versionroutes/mod.rs— module entry pointapp.rs— register/xrpc/_healthbefore catch-all; promotetest_state()topub(crate)for reuse across endpoint test modules; dropdead_codesuppression onAppState.dbmain.rs— declaremod routesCargo.toml— addserdedep for#[derive(Serialize)]on the response struct
Test plan#
-
cargo test -p relay— all 21 tests pass (4 new:health_returns_200_with_db_ok,health_db_error_returns_503_with_db_error,health_response_has_json_content_type,health_version_is_cargo_pkg_version) -
cargo clippy --workspace -- -D warnings— clean - Manual:
cargo run -- --config relay.tomlthencurl http://localhost:8080/xrpc/_healthreturns{"version":"0.1.0","db":"ok"}
Closes MM-73