feat: readiness probe, shared cursor pagination, rate limit docs, and… - #391
Merged
Emmyt24 merged 2 commits intoSep 28, 2026
Merged
Conversation
… sponsor negative tests This commit resolves issues Octo-Protocol-org#336, Octo-Protocol-org#334, Octo-Protocol-org#341, and Octo-Protocol-org#337: 1. Readiness endpoint distinct from liveness (Closes Octo-Protocol-org#336) - Added GET /health/ready endpoint in crates/api/src/lib.rs distinct from the cheap GET /health liveness probe. - Implemented Store::ping in crates/store/src/lib.rs executing a lightweight SELECT 1 against the Postgres connection pool. - Implemented Horizon::check_reachability in crates/api/src/horizon.rs probing the root endpoint with a 3-second timeout. - Returns HTTP 200 with structured JSON (status: ready, database: ok, horizon: ok) when all dependencies are healthy. - Returns HTTP 503 with structured JSON naming failed dependencies when degraded. - Added documentation in docs/architecture.md covering liveness vs readiness semantics for orchestrators. - Added integration tests covering reachable 200 and degraded 503 scenarios for DB and Horizon. 2. Shared cursor pagination helper (Closes Octo-Protocol-org#334) - Extracted keyset cursor pagination query construction into cursor_pagination_query(table, filter_column) in crates/store/src/lib.rs. - Refactored list_wallets_for_user_page, list_addresses_page, list_transactions_page, and list_payment_links to use the shared helper, eliminating SQL query drift while preserving exact pagination semantics. - Added isolated unit test in crates/store/tests/store_tests.rs asserting query shape and keyset comparison invariants. 3. Documented rate limit reference table (Closes Octo-Protocol-org#341) - Extracted rate limit thresholds and windows into public named constants in crates/api/src/rate_limit.rs. - Updated crates/api/src/auth.rs and crates/api/src/routes/payment_links.rs to reference the centralized constants. - Added comprehensive reference table to docs/api.md detailing every limited endpoint, HTTP method, key scope (per-IP, per-user), limit, window, and code constant name. - Included process note mandating updates to the table for future rate limit additions. 4. Negative-path coverage for sponsor endpoint (Closes Octo-Protocol-org#337) - Added focused negative-path integration tests in crates/api/tests/sponsor_e2e_tests.rs: - sponsor_rejects_when_sponsorship_is_disabled_for_the_wallet (HTTP 403) - sponsor_rejects_a_max_fee_above_the_per_tx_cap (HTTP 400) - sponsor_rejects_a_self_sponsoring_inner_transaction (HTTP 400) - sponsor_rejects_once_the_daily_budget_is_exhausted (HTTP 429) - sponsor_rejects_for_a_client_custody_wallet_with_no_gas_tank (HTTP 403) - Added create_wallet_without_gas_tank helper to reliably exercise the client-custody unprovisioned gas tank rejection path.
|
@utilityjnr035-rgb 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! 🚀 |
# Conflicts: # crates/api/src/lib.rs # crates/store/tests/store_tests.rs # docs/api.md # docs/architecture.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… sponsor negative tests
This commit resolves issues #336, #334, #341, and #337:
Summary
Related step / issue
Checklist
cargo fmt --all -- --checkpassescargo clippy --workspace --all-targets -- -D warningspassescargo test --workspacepassesHow to test