Skip to content

Add health check endpoints#9

Merged
sangwa merged 2 commits into
mainfrom
feat/health-checks
Mar 26, 2026
Merged

Add health check endpoints#9
sangwa merged 2 commits into
mainfrom
feat/health-checks

Conversation

@sangwa
Copy link
Copy Markdown
Contributor

@sangwa sangwa commented Mar 26, 2026

Also compacts CLAUDE.md

Summary by CodeRabbit

Release Notes

  • New Features

    • Added health check endpoints: /healthz/live returns the current server status, and /healthz/ready indicates when the server is ready to handle requests.
  • Documentation

    • Simplified project documentation including architecture descriptions, configuration loading, operational constraints, and CI/CD workflows.

sangwa and others added 2 commits March 26, 2026 08:48
Replace the full env var table with a naming-pattern rule, remove the
embedded TOML config in favour of referencing config/config.toml, and
consolidate implementation-detail sections into a compact "Critical
design constraints" list. All actionable constraints (SEV-SNP
workarounds, Fiber hazards, error leakage policy, fingerprint checks,
cosign OID rules, etc.) are preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
/healthz/live returns 200 once the HTTP listener is up.
/healthz/ready returns 503 during startup and 200 after self-attestation
and the initial CRL fetch (if configured) complete. Readiness is a
one-way transition — cert reload and CRL refresh failures use
fail-safe/fail-open semantics and do not flip readiness back.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sangwa sangwa self-assigned this Mar 26, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 80b026f8-4f3a-4267-add6-3474792cc0dc

📥 Commits

Reviewing files that changed from the base of the PR and between 225ac21 and dc8dd79.

📒 Files selected for processing (5)
  • CLAUDE.md
  • internal/crl.go
  • internal/health.go
  • internal/health_test.go
  • internal/server.go

Walkthrough

The changes add health-check functionality to the server with a new readiness-tracking mechanism. A ready atomic boolean field is introduced to the Server struct. Two new HTTP endpoints (/healthz/live and /healthz/ready) are registered that return JSON status responses—the liveness endpoint always returns success, while the readiness endpoint returns service-unavailable status until the server is ready. The server marks itself ready after initial CRL cache refresh completes (or immediately if no CRL URLs are configured). Documentation is simplified across architecture descriptions, configuration guidance, and operational constraints, removing verbose implementation details while retaining key behaviors.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Server
    participant CRL Cache
    participant Readiness State

    rect rgba(70, 130, 180, 0.5)
        Note over Server,Readiness State: Server Startup
        Server->>CRL Cache: runCRLRefresh() (if crlCache exists)
        CRL Cache->>CRL Cache: refreshAll()
        CRL Cache->>Readiness State: s.ready.Store(true)
    end

    rect rgba(144, 238, 144, 0.5)
        Note over Client,Readiness State: Health Check Requests
        Client->>Server: GET /healthz/live
        Server->>Client: HTTP 200 {"status":"ok"}
    end

    rect rgba(255, 192, 203, 0.5)
        Note over Client,Readiness State: Readiness Check (Before Ready)
        Client->>Server: GET /healthz/ready
        Server->>Readiness State: Check s.ready flag
        Server->>Client: HTTP 503 {"status":"not ready"}
    end

    rect rgba(144, 238, 144, 0.5)
        Note over Client,Readiness State: Readiness Check (After Ready)
        Client->>Server: GET /healthz/ready
        Server->>Readiness State: Check s.ready flag
        Server->>Client: HTTP 200 {"status":"ok"}
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A rabbit's ode to readiness

Health checks hop through the server's core,
Live and ready, watch them soar!
When CRLs dance and caches align,
The ready flag glows—all systems fine! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add health check endpoints' directly and clearly summarizes the main feature introduced in this PR: new HTTP health check endpoints (/healthz/live and /healthz/ready) with their readiness logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/health-checks

Comment @coderabbitai help to get the list of available commands and usage tips.

@sangwa sangwa merged commit 6c7aea7 into main Mar 26, 2026
2 checks passed
@sangwa sangwa deleted the feat/health-checks branch March 26, 2026 16:22
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.

1 participant