Skip to content

Fix health endpoint service name to match spec#222

Merged
MegaRedHand merged 1 commit intomainfrom
fix-health-endpoint-service-name
Mar 13, 2026
Merged

Fix health endpoint service name to match spec#222
MegaRedHand merged 1 commit intomainfrom
fix-health-endpoint-service-name

Conversation

@pablodeymo
Copy link
Collaborator

Motivation

A spec-to-code compliance audit (F-07) identified that the health endpoint's service field doesn't match the spec.

  • Spec (leanSpec/src/lean_spec/subspecs/api/endpoints/health.py): "service": "lean-rpc-api"
  • Code (crates/net/rpc/src/metrics.rs:10): "service": "lean-spec-api"

Everything else in the health endpoint already matches: route (/lean/v0/health), status code (200), content type (application/json), and the status field ("healthy").

Description

One-line change in crates/net/rpc/src/metrics.rs: updates the service field in the health endpoint JSON response from "lean-spec-api" to "lean-rpc-api".

Before:

{"status":"healthy","service":"lean-spec-api"}

After:

{"status":"healthy","service":"lean-rpc-api"}

How to Test

  • make fmt — passes
  • make lint — passes
  • make test — all tests pass
  • curl http://localhost:5052/lean/v0/health on a running node should return {"status":"healthy","service":"lean-rpc-api"}

@github-actions
Copy link

🤖 Kimi Code Review

The change is trivial—only the hard-coded service name in the health-check JSON is updated from "lean-spec-api" to "lean-rpc-api". This aligns the response with the actual crate (net/rpc) and has no correctness, security, or performance implications. LGTM.


Automated review by Kimi (Moonshot AI) · custom prompt

@github-actions
Copy link

🤖 Codex Code Review

  1. Low (compatibility/ops): The health payload’s service string changed from lean-spec-api to lean-rpc-api in crates/net/rpc/src/metrics.rs:10.
    If any monitoring checks, alerts, or dashboards match that exact value, they will break silently. If intentional, I’d suggest noting it in release notes/changelog and updating downstream probes.

No other findings in this diff.
Given scope (single response string change), I see no direct impact on consensus correctness, attestation/fork-choice logic, SSZ/XMSS handling, memory safety, or performance.


Automated review by OpenAI Codex · custom prompt

@github-actions
Copy link

🤖 Claude Code Review


PR Review: Fix health endpoint service name to match spec

Change: crates/net/rpc/src/metrics.rs:10 — one-line string fix.

Summary

Correct and minimal. The PR fixes a spec compliance issue (F-07 audit finding) by updating the service field in the health response from "lean-spec-api" to "lean-rpc-api". The change matches the spec and the PR description is thorough.

Observations

  • The fix is accurate and scoped correctly. "lean-spec-api" was clearly a copy-paste error — the file lives in the RPC crate, so "lean-rpc-api" is the right name.
  • The get_health handler is on the API server (:5052) not the metrics server (:5054), so the placement in metrics.rs is slightly misleading — but that's a pre-existing concern unrelated to this PR.
  • The raw JSON string approach works fine for a static response. No issues with the Content-Type header injection pattern.

Verdict

Approved. No correctness, safety, or style issues. The change is self-contained and verifiable.


Automated review by Claude (Anthropic) · custom prompt

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 13, 2026

Greptile Summary

This PR applies a targeted one-line fix to the health endpoint's JSON response in crates/net/rpc/src/metrics.rs, correcting the service field from "lean-spec-api" to "lean-rpc-api" to match the canonical value defined in the lean spec (leanSpec/src/lean_spec/subspecs/api/endpoints/health.py).

  • The code change is correct and exactly matches the spec's required value.
  • All other aspects of the health response (route /lean/v0/health, HTTP 200, Content-Type: application/json, and "status":"healthy") were already compliant; only this field needed fixing.
  • One stale reference remains in the repository: .claude/skills/devnet-runner/references/checkpoint-sync.md line 55 still shows the old expected output as {"status":"healthy","service":"lean-spec-api"}. This comment is used as a verification step when restarting devnet nodes and should be updated to {"status":"healthy","service":"lean-rpc-api"} to avoid misleading operators.
  • There are no automated tests covering the health endpoint's response body. Adding a #[tokio::test] for get_health (similar to the existing test_get_latest_justified_checkpoint test) would prevent this class of silent drift in the future.

Confidence Score: 5/5

  • This PR is safe to merge; the one-line fix is correct and well-scoped.
  • The change is a single string literal correction that aligns the code with the spec. There are no logic changes, no new dependencies, and no risk of regression in the changed file itself. The only follow-up items (stale doc comment and missing test coverage) are pre-existing issues, not regressions introduced by this PR.
  • No changed files require special attention, but .claude/skills/devnet-runner/references/checkpoint-sync.md (not in this diff) has a stale expected-output comment at line 55 that should be updated as a follow-up.

Important Files Changed

Filename Overview
crates/net/rpc/src/metrics.rs Single-character string fix: corrects the service field in the health JSON response from "lean-spec-api" to "lean-rpc-api" to match the spec. Change is minimal, correct, and well-scoped.

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as API Server (port 5052)
    participant H as get_health handler

    Client->>API: GET /lean/v0/health
    API->>H: route dispatch
    H-->>API: 200 OK, Content-Type application/json
    API-->>Client: {"status":"healthy","service":"lean-rpc-api"}
Loading

Last reviewed commit: 9456fa5

@MegaRedHand MegaRedHand merged commit f4df9a2 into main Mar 13, 2026
7 checks passed
@MegaRedHand MegaRedHand deleted the fix-health-endpoint-service-name branch March 13, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants