feat(contract): health endpoints, error sanitisation, concurrency limits, e2e tests [CT-46/57/58/60] - #1071
Conversation
…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.
|
@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. |
|
@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! 🚀 |
mftee
left a comment
There was a problem hiding this comment.
Excellent contract improvements! Health endpoints enable monitoring, error sanitization improves security, concurrency limits prevent abuse, and e2e tests ensure reliability.
mftee
left a comment
There was a problem hiding this comment.
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!
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 checksGET /health/ready— checks Redis + Horizon, returns 503 naming the failed dependencyCARGO_PKG_VERSION) and Stellar network in readiness body#1057 [CT-58] Sanitized error responses
src/error.rs: stableERR_*public error codes,ApiErrortype,new_request_id()request_idfield (UUIDv4) for server-side correlationanyhowchain, internal path, upstream Horizon body, or type name reaches the clientApiError::bad_request,ApiError::upstream,ApiError::internal#1056 [CT-57] Concurrency & resilience limits
reqwest::Clientbuilt with 10 s timeout, pool max 10 idle/host, 90 s idle timeoutjoin_allbounded by atokio::sync::Semaphore(BATCH_CONCURRENCY_LIMIT = 8)get_with_backoff()onStellarClient: retries HTTP 429 up to 3 times with exponential back-off, honoursRetry-Afterheader#1046 [CT-46] End-to-end integration tests
src/tests/integration.rsboots the full Axum router withhttpmock+InMemoryCacheerror.rs,health.rsTesting