Skip to content

Add detailed health endpoint with raindex sync status#95

Open
alastairong1 wants to merge 1 commit intomainfrom
alastair/health-detailed-endpoint
Open

Add detailed health endpoint with raindex sync status#95
alastairong1 wants to merge 1 commit intomainfrom
alastair/health-detailed-endpoint

Conversation

@alastairong1
Copy link
Copy Markdown
Contributor

@alastairong1 alastairong1 commented Apr 28, 2026

Motivation

GET /health only proves that the API process is up. It does not show whether raindex local DB sync is configured, actively syncing, ready for reads, or failing.

The detailed endpoint gives monitoring and operators an on-demand snapshot without this API needing to know raindex local DB internals.

Solution

  • Add GET /health/detailed while keeping the existing GET /health liveness response unchanged.
  • Bump lib/rain.orderbook to 0f2f3d19212e6682c70e52a335d66988a10083a6 and use the new get_local_db_sync_snapshot() API for raindex local DB sync status.
  • Report app DB health plus raindex sync state, including configured/healthy flags, scheduler state, network readiness, orderbook readiness, sync phase, last synced block, update timestamp, and errors.
  • Refactor the detailed health implementation to call raindex.client().get_local_db_sync_snapshot().await instead of opening/querying SQLite directly.
  • Remove the direct rusqlite dependency from this crate.
  • Add OpenAPI response types for raindex sync networks and orderbooks.
  • Map raindex component status as active, syncing, failure, or not_configured; top-level API health remains ok, degraded, or error.
  • Update local test fixtures for orderbook YAML spec version 5 and adjust small SDK API changes from the submodule bump.

Chained PRs

Dependent PRs

Checks

  • nix develop -c cargo fmt
  • nix develop -c cargo test
  • nix develop -c rainix-rs-static

Part of the deployed-state split tracked in #94.

Summary by CodeRabbit

  • New Features
    • Added a detailed health endpoint providing structured status information about the application's database connectivity and synchronization components, including component-level metrics and error details.

@alastairong1 alastairong1 requested a review from findolor April 28, 2026 19:26
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

A new detailed health endpoint GET /health/detailed was added that returns structured app DB and raindex sync status. New typed health models were introduced. OpenAPI registration was updated to include the new route. The rain.orderbook submodule and related test fixtures/bindings were bumped for compatibility; swap code updated to match the bumped API.

Changes

Detailed Health Endpoint Implementation

Layer / File(s) Summary
Data Shape
src/types/health.rs
Adds HealthStatus, DetailedHealthResponse, DbStatus, DbHealthStatus, RaindexSyncStatus, RaindexSyncStatusKind, NetworkSyncInfo, and OrderbookSyncInfo with serde rules.
Core Implementation
src/routes/health.rs
Adds get_health_detailed handler, check_app_db, check_raindex_db, mapping helpers (map_raindex_snapshot, map_network_snapshot, map_orderbook_snapshot), error/log helpers, and detailed_status classification.
API Registration
src/main.rs
OpenAPI ApiDoc paths list extended to include routes::health::get_health_detailed.
Tests
src/routes/health.rs
Unit tests for detailed_status, snapshot→status mapping, error sanitization, and serialization (ensures scheduler state not exposed).

Library Compatibility & Fixtures

Layer / File(s) Summary
Submodule Bump
lib/rain.orderbook
Submodule pointer updated to commit 0f2f3d1...a6.
Call Sites / Imports
src/routes/swap/mod.rs
build_take_order_candidates_for_pair call updated to include Address::ZERO and &NoopInjector; NoopInjector import added.
Test Fixtures & Helpers
src/test_helpers.rs, src/routes/order/mod.rs, src/routes/tokens.rs
Embedded YAML fixture version changed 4→5; bindings import adjusted to IRaindexV6::{EvaluableV4, OrderV4, IOV2}; TakeOrderCandidate mock now includes signed_context: vec![].

Sequence Diagram

sequenceDiagram
    actor Client
    participant Handler as GET /health/detailed
    participant DbPool as App DbPool
    participant RaindexProvider as SharedRaindex Provider
    participant StatusLogic as Status Computation

    Client->>Handler: GET /health/detailed
    Handler->>DbPool: SELECT 1 (connectivity check)
    DbPool-->>Handler: ok / error
    Handler->>RaindexProvider: read LocalDbSyncSnapshot
    RaindexProvider-->>Handler: snapshot / error
    Handler->>StatusLogic: map_raindex_snapshot(), assemble DbStatus
    StatusLogic-->>Handler: overall status (ok / degraded / error)
    Handler-->>Client: DetailedHealthResponse { status, app_db, raindex }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • hardyjosh
  • JuaniRios

Poem

🐰 I hopped through code both near and far,

Poked the DB and raindex star,
Networks, books — a tidy score,
Status wrapped and shown at /health/detailed's door,
Hop, sniff, report — health checks evermore!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a new detailed health endpoint with raindex sync status information.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch alastair/health-detailed-endpoint

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/health.rs`:
- Around line 56-70: Before returning the DetailedHealthResponse, add a tracing
info log that records the computed status and the component booleans/metrics
(e.g., app_db.connected, raindex_db.connected, and raindex_db.orderbooks.len())
so the decision context is observable; place this log immediately after the
status is determined (referencing the local variable status and the locals
app_db and raindex_db) and before the Ok(Json(DetailedHealthResponse { ... }))
return, using tracing::info! with a clear message and structured fields.
- Around line 211-213: The code is directly casting a potentially negative DB
value `block` to u64 in the `Ok((block, updated_at))` match arm which can
produce an invalid block number; update that match arm (where
`info.last_synced_block` is set) to guard against negative values by checking
`if block < 0` and in that case set `info.last_synced_block` to a safe value
(e.g., 0) or handle it as None, otherwise cast `block as u64`; also consider
emitting a warning/log when a negative value is observed so the issue can be
traced, leaving `info.updated_at` assignment unchanged.
- Around line 76-87: The health endpoint is leaking internal errors and
filesystem paths: update check_app_db (and any other health helpers that
construct DbStatus and include error strings or db_path) to never return raw
e.to_string() or filesystem paths to clients; instead set DbStatus.error to a
generic message like "database unavailable" or None and remove/omit db_path from
the returned health payload, while still logging the full error and path
internally with tracing::warn!(error=%e, db_path=%path) so operators see details
but clients only get non-sensitive, generic status values.
- Around line 223-231: Per-orderbook SQL errors are currently swallowed in the
Err(e) arm where you only call tracing::warn! and then continue returning
Ok(results), causing connected: true to be reported despite failures; update the
error handling in the match that inspects sync_status (the branch that currently
logs tracing::warn! with error = %e, chain_id and orderbook = %ob_address) to
propagate or surface the error instead of silently continuing — either return an
Err from that function or set the per-orderbook health flag to false and include
that in results so overall connected becomes false; ensure the same change is
applied to the other identical error branches around the sync_status handling
(the other tracing::warn! places) so SQL errors no longer result in a falsely
healthy raindex DB.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a00073f4-d67a-4fc2-b4b2-ce299d61cf5f

📥 Commits

Reviewing files that changed from the base of the PR and between 5951bd2 and 8b055a6.

📒 Files selected for processing (3)
  • src/main.rs
  • src/routes/health.rs
  • src/types/health.rs

Comment thread src/routes/health.rs Outdated
Comment thread src/routes/health.rs
Comment thread src/routes/health.rs Outdated
Comment thread src/routes/health.rs Outdated
Copy link
Copy Markdown
Collaborator

@findolor findolor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing on this

findolor pushed a commit that referenced this pull request Apr 30, 2026
- docs/ops.md: journalctl + curl recipes for the deployed service,
  cache_warmer status interpretation, smoke-test usage
- scripts/smoke.sh: end-to-end correctness + latency probe against
  the API, asserts on response shape (not just status), reports
  per-check latency
- scripts/uptimerobot-setup.sh: one-shot creation of the 3 baseline
  UptimeRobot monitors (liveness, /health/detailed status=ok,
  cache_warmer running=true)

Notes:
- The smoke + UptimeRobot scripts reference /health/detailed.cache_warmer
  which only lights up once the detailed-health (#95) and cache-warmer
  PRs land. They will return FAIL/keyword-miss against current main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

findolor commented Apr 30, 2026


How to use the Graphite Merge Queue

Add the label add-to-gt-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@findolor findolor force-pushed the alastair/health-detailed-endpoint branch from 8b055a6 to 2d85560 Compare May 1, 2026 06:59
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/routes/health.rs (1)

50-64: ⚡ Quick win

Run the two health probes in parallel.

check_app_db() and check_raindex_db() are independent, but this handler awaits them sequentially. That makes every /health/detailed scrape pay the sum of both latencies instead of just the slower check.

♻️ Proposed fix
-        // 1. Check app database connectivity
-        let app_db = check_app_db(pool).await;
-
-        // 2. Check raindex database and sync status
-        let raindex_db = check_raindex_db(shared_raindex).await;
+        // Check both subsystems concurrently.
+        let (app_db, raindex_db) = tokio::join!(
+            check_app_db(pool),
+            check_raindex_db(shared_raindex)
+        );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routes/health.rs` around lines 50 - 64, Run the two independent probes
concurrently instead of awaiting sequentially: invoke check_app_db(pool) and
check_raindex_db(shared_raindex) without awaiting, then await them together
(e.g., using tokio::join! or futures::join) so you get app_db and raindex_db
results in parallel; afterwards use the existing status logic that inspects
app_db.connected, raindex_db.connected, and raindex_db.orderbooks to compute
"ok"/"degraded"/"error".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/routes/health.rs`:
- Around line 50-64: Run the two independent probes concurrently instead of
awaiting sequentially: invoke check_app_db(pool) and
check_raindex_db(shared_raindex) without awaiting, then await them together
(e.g., using tokio::join! or futures::join) so you get app_db and raindex_db
results in parallel; afterwards use the existing status logic that inspects
app_db.connected, raindex_db.connected, and raindex_db.orderbooks to compute
"ok"/"degraded"/"error".

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 52aaf6ef-fb21-4fa4-8d65-8d183b4e6bd9

📥 Commits

Reviewing files that changed from the base of the PR and between 8b055a6 and 2d85560.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • src/main.rs
  • src/routes/health.rs
  • src/types/health.rs
✅ Files skipped from review due to trivial changes (2)
  • src/main.rs
  • Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/types/health.rs

@findolor findolor force-pushed the alastair/health-detailed-endpoint branch 3 times, most recently from 07df385 to 5f14c7d Compare May 4, 2026 00:56
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/routes/health.rs (1)

85-91: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Sanitize client-facing error strings in health payloads

Both app DB and raindex branches return raw internal errors to clients (e.to_string() / interpolated {e}). Keep full details in logs, but return generic messages in the JSON payload.

Suggested hardening patch
         Err(e) => {
             tracing::warn!(error = %e, "app database health check failed");
             DbStatus {
                 status: STATUS_ERROR.to_string(),
                 connected: false,
-                error: Some(e.to_string()),
+                error: Some("database unavailable".to_string()),
             }
         }
@@
         Err(e) => {
             tracing::warn!(error = %e, "failed to get raindex local db sync snapshot");
             RaindexSyncStatus {
                 status: STATUS_ERROR.to_string(),
                 configured: false,
                 healthy: false,
                 scheduler_state: scheduler_state_label(SchedulerState::Leader).to_string(),
-                error: Some(format!("failed to get raindex local db sync snapshot: {e}")),
+                error: Some("raindex local db sync snapshot unavailable".to_string()),
                 networks: vec![],
                 orderbooks: vec![],
             }
         }

Also applies to: 100-108

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routes/health.rs` around lines 85 - 91, The health endpoint currently
returns raw internal errors to clients (e.g., DbStatus { error:
Some(e.to_string()) }) — keep full error details in logs (tracing::warn!(error =
%e, ...)) but replace the client-facing error payload with a generic message;
update both branches that construct DbStatus on Err (the app DB branch that
builds DbStatus with STATUS_ERROR and the raindex branch around the similar
construction) to set error to Some("internal server error") or None (your
standard generic health error string) instead of e.to_string(), leaving
tracing::warn! unchanged so logs still contain %e.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/types/health.rs`:
- Around line 100-146: Add a new field to the OrderbookSyncInfo struct named
something like latest_trade_age_seconds: Option<u64> (or latest_trade_age_ms
depending on project convention) with appropriate serde skip_serializing_if and
a schema/example annotation, then populate this field where OrderbookSyncInfo
instances are constructed (update the mapping function that builds
OrderbookSyncInfo from internal orderbook state / DB to calculate and assign the
latest trade age), and finally extend the /health/detailed tests to assert the
new field is present and correct for each orderbook; refer to OrderbookSyncInfo
and the mapping function that returns OrderbookSyncInfo instances and the
existing health/detailed test files to locate placements.

---

Duplicate comments:
In `@src/routes/health.rs`:
- Around line 85-91: The health endpoint currently returns raw internal errors
to clients (e.g., DbStatus { error: Some(e.to_string()) }) — keep full error
details in logs (tracing::warn!(error = %e, ...)) but replace the client-facing
error payload with a generic message; update both branches that construct
DbStatus on Err (the app DB branch that builds DbStatus with STATUS_ERROR and
the raindex branch around the similar construction) to set error to
Some("internal server error") or None (your standard generic health error
string) instead of e.to_string(), leaving tracing::warn! unchanged so logs still
contain %e.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4d2d7dd1-2837-463c-9151-586fadc38a8a

📥 Commits

Reviewing files that changed from the base of the PR and between 2d85560 and 5f14c7d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • lib/rain.orderbook
  • src/main.rs
  • src/routes/health.rs
  • src/routes/order/mod.rs
  • src/routes/swap/mod.rs
  • src/routes/tokens.rs
  • src/test_helpers.rs
  • src/types/health.rs
✅ Files skipped from review due to trivial changes (3)
  • lib/rain.orderbook
  • src/routes/order/mod.rs
  • src/main.rs

Comment thread src/types/health.rs
@findolor findolor force-pushed the alastair/health-detailed-endpoint branch from 5f14c7d to 4d69f7b Compare May 4, 2026 06:39
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
src/types/health.rs (1)

100-146: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

OrderbookSyncInfo is still missing the latest_trade_age_seconds field.

The PR objectives explicitly list "latest trade age" per orderbook as a core diagnostic for detecting sync stalls (e.g. the Apr 17 stoppage). The field is absent from the struct and not populated in map_orderbook_snapshot. The test at line 288 also has no assertion for it.

📋 Suggested struct addition
     /// Timestamp when raindex last updated the persisted sync status.
     #[serde(skip_serializing_if = "Option::is_none")]
     pub updated_at: Option<String>,
+
+    /// Age of the most recent trade for this orderbook, in seconds.
+    /// None if no trades have been recorded yet.
+    #[schema(example = 42)]
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub latest_trade_age_seconds: Option<u64>,

     /// Error message if this orderbook failed.
     #[serde(skip_serializing_if = "Option::is_none")]
     pub error: Option<String>,

Populate this in map_orderbook_snapshot and extend the snapshot test to assert the value.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/types/health.rs` around lines 100 - 146, The OrderbookSyncInfo struct is
missing the latest_trade_age_seconds field required by the PR; add pub
latest_trade_age_seconds: Option<u64> (with #[serde(skip_serializing_if =
"Option::is_none")] and a schema/example annotation) to OrderbookSyncInfo, then
compute and populate that field in map_orderbook_snapshot (use the latest trade
timestamp to compute age in seconds or None if no trades), and finally update
the snapshot test (the test referencing map_orderbook_snapshot) to assert the
expected latest_trade_age_seconds value is present.
src/routes/health.rs (1)

86-93: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Raw DB error string still exposed to clients in check_app_db.

Line 91 passes e.to_string() directly into the response body. Same pattern appears at line 108 in check_raindex_db. Sanitised error strings should go to the client; the full error should go to the tracing log.

🔒 Suggested fix for check_app_db
         Err(e) => {
-            tracing::warn!(error = %e, "app database health check failed");
+            tracing::warn!(error = %e, "app database health check failed");  // full error retained in logs
             DbStatus {
                 status: STATUS_ERROR.to_string(),
                 connected: false,
-                error: Some(e.to_string()),
+                error: Some("database unavailable".into()),
             }
         }
🔒 Suggested fix for check_raindex_db error arm (line 108)
-                error: Some(format!("failed to get raindex local db sync snapshot: {e}")),
+                error: Some("failed to get raindex sync snapshot".into()),

Log {e} in the existing tracing::warn! at line 102 (already done) and keep the client-facing message generic.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routes/health.rs` around lines 86 - 93, In check_app_db and
check_raindex_db update the error arms so you do not forward the raw
e.to_string() to clients: keep the existing tracing::warn!(error = %e, ...) to
log the full error, but change the DbStatus.error field to a sanitized/generic
message (e.g. "database error" or the error kind) instead of e.to_string();
modify the error arms that construct DbStatus (in check_app_db and
check_raindex_db) to supply the generic string while leaving the trace log
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/health.rs`:
- Around line 101-113: The error branch for get_local_db_sync_snapshot currently
hardcodes scheduler_state_label(SchedulerState::Leader) which misrepresents the
real state; change the error path to report an unknown scheduler state by either
(a) adding an Unknown variant to the SchedulerState enum and a corresponding arm
in scheduler_state_label, then use
scheduler_state_label(SchedulerState::Unknown) in the Err(e) branch, or (b) if
an Unknown variant already exists, replace SchedulerState::Leader with
SchedulerState::Unknown in the RaindexSyncStatus construction (symbols:
get_local_db_sync_snapshot, RaindexSyncStatus, scheduler_state_label,
SchedulerState). Ensure scheduler_state_label covers the new Unknown case so the
health response no longer falsely reports "leader".

---

Duplicate comments:
In `@src/routes/health.rs`:
- Around line 86-93: In check_app_db and check_raindex_db update the error arms
so you do not forward the raw e.to_string() to clients: keep the existing
tracing::warn!(error = %e, ...) to log the full error, but change the
DbStatus.error field to a sanitized/generic message (e.g. "database error" or
the error kind) instead of e.to_string(); modify the error arms that construct
DbStatus (in check_app_db and check_raindex_db) to supply the generic string
while leaving the trace log unchanged.

In `@src/types/health.rs`:
- Around line 100-146: The OrderbookSyncInfo struct is missing the
latest_trade_age_seconds field required by the PR; add pub
latest_trade_age_seconds: Option<u64> (with #[serde(skip_serializing_if =
"Option::is_none")] and a schema/example annotation) to OrderbookSyncInfo, then
compute and populate that field in map_orderbook_snapshot (use the latest trade
timestamp to compute age in seconds or None if no trades), and finally update
the snapshot test (the test referencing map_orderbook_snapshot) to assert the
expected latest_trade_age_seconds value is present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9a4b2d6f-a90a-46cc-bb7e-99fc2035f9f1

📥 Commits

Reviewing files that changed from the base of the PR and between 5f14c7d and 4d69f7b.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • lib/rain.orderbook
  • src/main.rs
  • src/routes/health.rs
  • src/routes/order/mod.rs
  • src/routes/swap/mod.rs
  • src/routes/tokens.rs
  • src/test_helpers.rs
  • src/types/health.rs
✅ Files skipped from review due to trivial changes (3)
  • src/routes/tokens.rs
  • src/main.rs
  • src/routes/order/mod.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • lib/rain.orderbook
  • src/routes/swap/mod.rs
  • src/test_helpers.rs

Comment thread src/routes/health.rs
@findolor findolor self-requested a review May 4, 2026 06:45
@findolor findolor self-assigned this May 4, 2026
@findolor findolor requested review from JuaniRios and hardyjosh and removed request for findolor May 4, 2026 06:46
@findolor findolor force-pushed the alastair/health-detailed-endpoint branch 2 times, most recently from b5b41f5 to 792a615 Compare May 4, 2026 06:57
findolor pushed a commit that referenced this pull request May 4, 2026
- docs/ops.md: journalctl + curl recipes for the deployed service,
  cache_warmer status interpretation, smoke-test usage
- scripts/smoke.sh: end-to-end correctness + latency probe against
  the API, asserts on response shape (not just status), reports
  per-check latency
- scripts/uptimerobot-setup.sh: one-shot creation of the 3 baseline
  UptimeRobot monitors (liveness, /health/detailed status=ok,
  cache_warmer running=true)

Notes:
- The smoke + UptimeRobot scripts reference /health/detailed.cache_warmer
  which only lights up once the detailed-health (#95) and cache-warmer
  PRs land. They will return FAIL/keyword-miss against current main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@findolor findolor force-pushed the alastair/health-detailed-endpoint branch from 792a615 to dc10129 Compare May 4, 2026 07:40
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/routes/health.rs`:
- Around line 87-103: In check_raindex_db, avoid holding the read lock on
SharedRaindexProvider across the await by extracting the client before the async
call: acquire the read guard, get the client via
shared_raindex.read().await.client(), clone or otherwise take ownership of the
RaindexClient (or copy necessary data) so the guard can be dropped (drop the
guard) before calling client.get_local_db_sync_snapshot().await, then call
map_raindex_snapshot on the snapshot; if RaindexClient isn’t Clone, restructure
to move the minimal owned data out of the guard prior to awaiting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fa504f47-6a55-4089-b548-48f9642c3b8e

📥 Commits

Reviewing files that changed from the base of the PR and between 4d69f7b and dc10129.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • lib/rain.orderbook
  • src/main.rs
  • src/routes/health.rs
  • src/routes/order/mod.rs
  • src/routes/swap/mod.rs
  • src/routes/tokens.rs
  • src/test_helpers.rs
  • src/types/health.rs
✅ Files skipped from review due to trivial changes (4)
  • lib/rain.orderbook
  • src/routes/order/mod.rs
  • src/main.rs
  • src/routes/tokens.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/routes/swap/mod.rs

Comment thread src/routes/health.rs
@findolor findolor dismissed their stale review May 4, 2026 08:53

took over this PR myself

findolor pushed a commit that referenced this pull request May 4, 2026
- docs/ops.md: journalctl + curl recipes for the deployed service,
  cache_warmer status interpretation, smoke-test usage
- scripts/smoke.sh: end-to-end correctness + latency probe against
  the API, asserts on response shape (not just status), reports
  per-check latency
- scripts/uptimerobot-setup.sh: one-shot creation of the 3 baseline
  UptimeRobot monitors (liveness, /health/detailed status=ok,
  cache_warmer running=true)

Notes:
- The smoke + UptimeRobot scripts reference /health/detailed.cache_warmer
  which only lights up once the detailed-health (#95) and cache-warmer
  PRs land. They will return FAIL/keyword-miss against current main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@findolor findolor force-pushed the alastair/health-detailed-endpoint branch from dc10129 to 6e0d829 Compare May 4, 2026 10:47
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