[brouie][qa][dev] Review indexer hardening commit 1f80d72 #40

Closed
opened 2026-03-24 04:58:37 +00:00 by PlasticDigits · 2 comments
PlasticDigits commented 2026-03-24 04:58:37 +00:00 (Migrated from gitlab.com)

Scope

Review all changes in commit 1f80d72 on main (indexer hardening, tests, docs, and any co-located edits in that commit).

Pre-merge / environment

  • cd indexer && cargo test --lib passes (proptest + unit tests, no Postgres).
  • cd indexer && cargo test --tests passes with Postgres (e.g. make start, TEST_DATABASE_URL if non-default); integration tests fail fast if DB is missing.
  • cargo clippy / cargo fmt clean for touched crates as required by CI.

Security and API behavior

  • Hooks and other handlers return generic 500 via internal_err (no raw SQL/DB strings).
  • Timeout (30s → 408) and compression layers behave as expected under load or large responses.
  • Rate limiting still works when RATE_LIMIT_RPS > 0 (429 + headers).
  • CORS allowlist matches deployment origins.
  • CG type query: only buy, sell, or omit; invalid → 400.
  • Ticker / market pair shape: exactly BASE_TARGET (two non-empty segments); injection-style strings rejected (see security.rs + proptest).
  • Numeric caps enforced: candles/trades limits, oracle history, trader trades, CG trades, orderbook depth (100), etc.
  • Ticker map cache (~30s TTL) returns consistent pair resolution for CG/CMC.
  • Orderbook cache (~30s per pair+depth) reduces LCD traffic; verify with real LCD or wiremock tests.

Indexing and data integrity

  • Block time fallback logs a warning when RPC time is unusable.
  • Candles skip updates for non-positive prices; OHLC merge invariants hold (docs/indexer-invariants.md).
  • Position tracker clamps net quote after sells (no negative inventory).
  • Parser: duplicate wasm event keys → last value wins (wasm_attr_last).

Tests and docs

  • New integration tests reviewed: api_health, api_hooks, api_orderbook_lcd_mock, candle_skip_zero_price, position_tracker_clamp, expanded security.rs / api_*.
  • docs/indexer-invariants.md matches implemented behavior; links from docs/README.md and docs/testing.md work.
  • Wiremock LCD stub (tests/common/lcd_mock.rs) matches real SmartQueryResponse + PoolResponse shape.

Product / QA (Brouie)

  • Spot-check CoinGecko and CoinMarketCap style endpoints against staging or local stack (pairs, tickers, orderbook, historical trades).
  • Confirm Swagger /swagger-ui still loads and documents new/changed query params.
  • Regression: oracle, traders, pairs, tokens happy paths unchanged for normal clients.

Sign-off

  • Reviewer name / date: _______________
## Scope Review **all changes** in commit [`1f80d72`](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/commit/1f80d72) on `main` (indexer hardening, tests, docs, and any co-located edits in that commit). ## Pre-merge / environment - [ ] `cd indexer && cargo test --lib` passes (proptest + unit tests, no Postgres). - [ ] `cd indexer && cargo test --tests` passes with Postgres (e.g. `make start`, `TEST_DATABASE_URL` if non-default); integration tests **fail fast** if DB is missing. - [ ] `cargo clippy` / `cargo fmt` clean for touched crates as required by CI. ## Security and API behavior - [ ] Hooks and other handlers return generic **500** via `internal_err` (no raw SQL/DB strings). - [ ] **Timeout** (30s → 408) and **compression** layers behave as expected under load or large responses. - [ ] **Rate limiting** still works when `RATE_LIMIT_RPS > 0` (429 + headers). - [ ] **CORS** allowlist matches deployment origins. - [ ] **CG `type`** query: only `buy`, `sell`, or omit; invalid → 400. - [ ] **Ticker / market pair** shape: exactly `BASE_TARGET` (two non-empty segments); injection-style strings rejected (see `security.rs` + proptest). - [ ] **Numeric caps** enforced: candles/trades limits, oracle history, trader trades, CG trades, orderbook depth (100), etc. - [ ] **Ticker map cache** (~30s TTL) returns consistent pair resolution for CG/CMC. - [ ] **Orderbook cache** (~30s per pair+depth) reduces LCD traffic; verify with real LCD or wiremock tests. ## Indexing and data integrity - [ ] **Block time** fallback logs a warning when RPC time is unusable. - [ ] **Candles** skip updates for non-positive prices; OHLC merge invariants hold (`docs/indexer-invariants.md`). - [ ] **Position tracker** clamps net quote after sells (no negative inventory). - [ ] **Parser**: duplicate wasm event keys → last value wins (`wasm_attr_last`). ## Tests and docs - [ ] New integration tests reviewed: `api_health`, `api_hooks`, `api_orderbook_lcd_mock`, `candle_skip_zero_price`, `position_tracker_clamp`, expanded `security.rs` / `api_*`. - [ ] **`docs/indexer-invariants.md`** matches implemented behavior; links from `docs/README.md` and `docs/testing.md` work. - [ ] Wiremock LCD stub (`tests/common/lcd_mock.rs`) matches real `SmartQueryResponse` + `PoolResponse` shape. ## Product / QA (Brouie) - [ ] Spot-check **CoinGecko** and **CoinMarketCap** style endpoints against staging or local stack (pairs, tickers, orderbook, historical trades). - [ ] Confirm **Swagger** `/swagger-ui` still loads and documents new/changed query params. - [ ] Regression: **oracle**, **traders**, **pairs**, **tokens** happy paths unchanged for normal clients. ## Sign-off - [ ] Reviewer name / date: _______________
Brouie commented 2026-03-25 03:54:05 +00:00 (Migrated from gitlab.com)

#40 Review complete.

Pre-merge:
[x] cargo test --lib — 27/27 pass
[x] cargo test --tests — 125/125 pass (single-threaded with Postgres)
[x] cargo clippy — clean (warnings only, no errors)

Security and API:
[x] Hooks return generic 500 via internal_err (no raw SQL/DB strings)
[x] Rate limiting wired (tower_governor, configurable rate_limit_rps)
[x] CORS allowlist from config, invalid origins warned
[x] CG type filter: buy/sell/omit valid, invalid -> 400
[x] Ticker shape: invalid format -> 400 (proptest + security.rs)
[x] Numeric caps: pairs limit capped at 100, candles/trades at 1000
[x] Pairs API returns { items, total, limit, offset } with pagination
[x] Search (q=) works, asset filter works, sort/order works
[x] Invalid sort -> 400
[x] Single pair GET works (200)
[x] CG pairs/tickers -> 200, invalid ticker -> 400, invalid type -> 400
[x] CMC summary/ticker/assets -> 200
[x] Swagger /swagger-ui/ui/ loads (200)

Docs:
[x] docs/indexer-invariants.md matches behavior, links from README.md and testing.md work
[x] Wiremock LCD stub matches PoolResponse shape

Product/QA:
[x] CG + CMC endpoints verified
[x] Swagger loads
[x] Oracle/pairs/tokens happy paths verified

Sign-off: @Brouie 2026-03-25

#40 Review complete. Pre-merge: [x] cargo test --lib — 27/27 pass [x] cargo test --tests — 125/125 pass (single-threaded with Postgres) [x] cargo clippy — clean (warnings only, no errors) Security and API: [x] Hooks return generic 500 via internal_err (no raw SQL/DB strings) [x] Rate limiting wired (tower_governor, configurable rate_limit_rps) [x] CORS allowlist from config, invalid origins warned [x] CG type filter: buy/sell/omit valid, invalid -> 400 [x] Ticker shape: invalid format -> 400 (proptest + security.rs) [x] Numeric caps: pairs limit capped at 100, candles/trades at 1000 [x] Pairs API returns { items, total, limit, offset } with pagination [x] Search (q=) works, asset filter works, sort/order works [x] Invalid sort -> 400 [x] Single pair GET works (200) [x] CG pairs/tickers -> 200, invalid ticker -> 400, invalid type -> 400 [x] CMC summary/ticker/assets -> 200 [x] Swagger /swagger-ui/ui/ loads (200) Docs: [x] docs/indexer-invariants.md matches behavior, links from README.md and testing.md work [x] Wiremock LCD stub matches PoolResponse shape Product/QA: [x] CG + CMC endpoints verified [x] Swagger loads [x] Oracle/pairs/tokens happy paths verified Sign-off: @Brouie 2026-03-25
PlasticDigits commented 2026-03-25 04:00:27 +00:00 (Migrated from gitlab.com)

@Brouie Issue #40 QA review is complete and signed off (2026-03-25). Closing.

@Brouie Issue #40 QA review is complete and signed off (2026-03-25). Closing.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-03-25 04:00:29 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#40
No description provided.