Skip to content

feat(contract): health endpoints, error sanitisation, concurrency limits, e2e tests [CT-46/57/58/60] - #1071

Open
Ummi-001 wants to merge 1 commit into
CodeGirlsInc:mainfrom
Ummi-001:feat/ct-46-57-58-60-health-errors-concurrency-tests
Open

feat(contract): health endpoints, error sanitisation, concurrency limits, e2e tests [CT-46/57/58/60]#1071
Ummi-001 wants to merge 1 commit into
CodeGirlsInc:mainfrom
Ummi-001:feat/ct-46-57-58-60-health-errors-concurrency-tests

Conversation

@Ummi-001

Copy link
Copy Markdown
Contributor

Summary

Resolves four open issues for the contract/ Rust service (stellar-doc-verifier).

Closes #1059
Closes #1057
Closes #1056
Closes #1046


Changes

#1059 [CT-60] Health & readiness endpoints

  • GET /health/live — always 200 when the process is running, no dependency checks
  • GET /health/ready — checks Redis + Horizon, returns 503 naming the failed dependency
  • Horizon reachability result cached for 10 s to avoid health-poll load
  • Reports service version (CARGO_PKG_VERSION) and Stellar network in readiness body
  • Both endpoints are registered outside the rate-limited router group

#1057 [CT-58] Sanitized error responses

  • New src/error.rs: stable ERR_* public error codes, ApiError type, new_request_id()
  • Every error response carries a request_id field (UUIDv4) for server-side correlation
  • No anyhow chain, internal path, upstream Horizon body, or type name reaches the client
  • All handlers updated to use ApiError::bad_request, ApiError::upstream, ApiError::internal

#1056 [CT-57] Concurrency & resilience limits

  • reqwest::Client built with 10 s timeout, pool max 10 idle/host, 90 s idle timeout
  • Batch join_all bounded by a tokio::sync::Semaphore (BATCH_CONCURRENCY_LIMIT = 8)
  • get_with_backoff() on StellarClient: retries HTTP 429 up to 3 times with exponential back-off, honours Retry-After header

#1046 [CT-46] End-to-end integration tests

  • src/tests/integration.rs boots the full Axum router with httpmock + InMemoryCache
  • Covers: health/live, health/ready (degraded), verify (mocked Horizon), cache-hit proof (mock call-count assertion), batch verify, empty/oversized batch validation, error sanitisation, revoke not-found
  • 10 integration tests + tests in error.rs, health.rs

Testing

cargo test --all
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings

…ests

Closes CodeGirlsInc#1059 - Add GET /health/live and GET /health/ready with Horizon
cache, Redis check, service version/network, excluded from rate limiting.

Closes CodeGirlsInc#1057 - Sanitize error responses: stable error codes (ERR_*),
request_id in every error body, no anyhow chains or internal paths in
HTTP responses.

Closes CodeGirlsInc#1056 - Bound concurrency: semaphore on batch join_all
(BATCH_CONCURRENCY_LIMIT=8), reqwest timeouts + pool limits on
StellarClient, 429 backoff with Retry-After support.

Closes CodeGirlsInc#1046 - Add end-to-end integration tests: full router boot with
httpmock Horizon + InMemoryCache, submit/verify flow, cache-hit proof,
degraded-dependency cases, error sanitisation assertions.
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@Ummi-001 is attempting to deploy a commit to the Mftee's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@Ummi-001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@mftee mftee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent contract improvements! Health endpoints enable monitoring, error sanitization improves security, concurrency limits prevent abuse, and e2e tests ensure reliability.

@mftee mftee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @Ummi-001, 👋

This PR has merge conflicts that need to be resolved before it can be merged. The following files have conflicts:

contract/src/error.rs
contract/src/lib.rs

Please resolve these conflicts in your branch and push the updates. Once resolved, the PR can be merged successfully.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants