feat(rpc): add /health endpoint on the metrics server#462
Conversation
Split the monolithic lib.rs API router into focused modules: core.rs holds the finalized-state/finalized-block/justified-checkpoint handlers and shared response helpers; blocks.rs, fork_choice.rs, and admin.rs each expose pub(crate) routes() -> Router<Store>. build_api_router merges them with .with_state(store). No behavior change.
…eckpoint handler name - Rename `mod core` → `mod base` to avoid shadowing Rust's built-in `core` crate - Fix stale comment on `get_latest_finalized_block`: genesis returns 200 with a synthesized blank proof, not 404 - Rename handler `get_latest_justified_state` → `get_latest_justified_checkpoint` to reflect that it returns a Checkpoint, not a State
🤖 Kimi Code ReviewThe PR looks good. This is a straightforward change that wires up an existing Minor observations:
Security/Operational notes:
Style:
Consensus relevance: None (RPC layer change, no consensus logic). Verdict: Approved with optional suggestion to loosen JSON assertion if future formatting changes are anticipated. Automated review by Kimi (Moonshot AI) · kimi-k2.5 · custom prompt |
🤖 Codex Code ReviewNo findings.
Residual risk: I could not run the targeted RPC tests in this environment because Automated review by OpenAI Codex · gpt-5.4 · custom prompt |
🤖 Claude Code ReviewNow I have a clear picture. Let me compile the verified findings. Key observations from the codebase:
PR Review: feat(rpc): add /health endpoint on the metrics serverThis is a small, focused PR: it wires the existing
The regression test for
The exact pattern
The health response body is Automated review by Claude (Anthropic) · sonnet · custom prompt |
Adds a plain GET /health liveness probe on the metrics port (5054), reusing the existing get_health handler. Covers the route with two unit tests: one asserting status/content-type/body, one regression check that /metrics still returns 200.
f0a68ae to
e958de0
Compare
Adds a plain
GET /healthliveness probe on the metrics port (5054), alongside/metrics.The handler reuses the existing
get_healthfunction, so the response body and content-type are identical to the API server's/lean/v0/health. This lets k8s/ops probe the metrics port independently of the API server.GET /health→ 200{"status":"healthy","service":"lean-rpc-api"}withapplication/jsonGET /metricsunchangedTwo unit tests cover the new route and regression-check
/metrics.Stacked on #454.