test(indexer): limit-book LCD negative/zero limit/depth (#317) #806

Merged
PlasticDigits merged 1 commit from cursor/gitlab-issue-workflow-9373 into main 2026-06-05 13:07:39 +00:00
PlasticDigits commented 2026-06-05 12:43:54 +00:00 (Migrated from gitlab.com)

Summary

Follow-up to https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/317 (closes the gap after MR !773).

PlasticDigits asked for limit-book and limit-book-shallow lower-bound coverage in addition to the SQL list sweep already merged in !773.

Changes (tests + docs only):

  • api_limit_book_lcd_mock.rs: limit_book_negative_and_zero_limit_depth_clamp_not_500 — wiremock LCD harness asserts GET .../limit-book-shallow?depth=-1|0 and GET .../limit-book?limit=-1|0 return 200 (never 500) with orders.len() <= 1.
  • docs/indexer-invariants.md: numeric caps + on-chain book rows reference the new test.

No handler changes.

Acceptance checklist

Criterion Verification Result
SQL list routes limit=-1/0 cargo test --test api_limit_lower_bound (!773) PASS
CG/CMC orderbook depth cargo test --test api_orderbook_lcd_mock (!773) PASS
limit-book / limit-book-shallow cargo test --test api_limit_book_lcd_mock limit_book_negative PASS
Static guardrail cargo test --test limit_clamp_guardrail PASS
Docs docs/indexer-invariants.md PASS

Closes #317 when merged.


Note

Low Risk
Documentation and integration tests only; production API behavior is unchanged.

Overview
Closes the #317 test gap for LCD-backed limit book routes after the SQL list limit sweep in !773: tests and docs only, no handler changes.

Adds limit_book_negative_and_zero_limit_depth_clamp_not_500 in api_limit_book_lcd_mock.rs (wiremock LCD). It checks GET .../limit-book-shallow?depth=-1|0 and GET .../limit-book?limit=-1|0 return 200 (never 500) with orders.len() <= 1, matching the SQL lower-bound pattern in api_limit_lower_bound.rs.

docs/indexer-invariants.md now ties numeric caps and on-chain book invariants to this test and splits LCD coverage between api_limit_book_lcd_mock.rs and api_orderbook_lcd_mock.rs. api_limit_lower_bound.rs module docs point limit-book coverage at the LCD mock file instead of the CG/CMC orderbook tests.

Reviewed by Cursor Bugbot for commit 1538ea8550. Bugbot is set up for automated code reviews on this repo. Configure here.

## Summary Follow-up to https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/317 (closes the gap after MR !773). PlasticDigits asked for **limit-book** and **limit-book-shallow** lower-bound coverage in addition to the SQL list sweep already merged in !773. **Changes (tests + docs only):** - `api_limit_book_lcd_mock.rs`: `limit_book_negative_and_zero_limit_depth_clamp_not_500` — wiremock LCD harness asserts `GET .../limit-book-shallow?depth=-1|0` and `GET .../limit-book?limit=-1|0` return **200** (never **500**) with `orders.len() <= 1`. - `docs/indexer-invariants.md`: numeric caps + on-chain book rows reference the new test. No handler changes. ## Acceptance checklist | Criterion | Verification | Result | |-----------|--------------|--------| | SQL list routes `limit=-1`/`0` | `cargo test --test api_limit_lower_bound` (!773) | PASS | | CG/CMC orderbook depth | `cargo test --test api_orderbook_lcd_mock` (!773) | PASS | | limit-book / limit-book-shallow | `cargo test --test api_limit_book_lcd_mock limit_book_negative` | PASS | | Static guardrail | `cargo test --test limit_clamp_guardrail` | PASS | | Docs | `docs/indexer-invariants.md` | PASS | Closes #317 when merged. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation and integration tests only; production API behavior is unchanged. > > **Overview** > Closes the **#317** test gap for LCD-backed limit book routes after the SQL list `limit` sweep in !773: **tests and docs only**, no handler changes. > > Adds **`limit_book_negative_and_zero_limit_depth_clamp_not_500`** in `api_limit_book_lcd_mock.rs` (wiremock LCD). It checks `GET .../limit-book-shallow?depth=-1|0` and `GET .../limit-book?limit=-1|0` return **200** (never **500**) with **`orders.len() <= 1`**, matching the SQL lower-bound pattern in `api_limit_lower_bound.rs`. > > **`docs/indexer-invariants.md`** now ties numeric caps and on-chain book invariants to this test and splits LCD coverage between `api_limit_book_lcd_mock.rs` and `api_orderbook_lcd_mock.rs`. **`api_limit_lower_bound.rs`** module docs point limit-book coverage at the LCD mock file instead of the CG/CMC orderbook tests. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1538ea855007381c10c5affe95bdbaa9f45bb4b1. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
ghost1 commented 2026-06-05 12:44:01 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits commented 2026-06-05 12:44:03 +00:00 (Migrated from gitlab.com)

mentioned in issue #317

mentioned in issue #317
ghost1 commented 2026-06-05 12:44:07 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits commented 2026-06-05 12:44:54 +00:00 (Migrated from gitlab.com)

Security review

Commit reviewed: 1538ea855007381c10c5affe95bdbaa9f45bb4b1

Scope: 3 files — indexer/tests/api_limit_book_lcd_mock.rs (new regression test), indexer/tests/api_limit_lower_bound.rs (module doc), docs/indexer-invariants.md (documentation). No production handler or dependency changes.

Method: Inspected MR diff; traced query parameters limit/depth on LCD-backed limit-book and limit-book-shallow routes to existing .clamp(1, max) in indexer/src/api/pairs.rs (unchanged in this MR). New test asserts HTTP 200 and bounded order count for limit=-1|0 / depth=-1|0 via wiremock harness only.

Outcome: FINDINGS: 0 medium+

Security review: no medium+ findings on this diff.

No inline threads — nothing to flag at specific lines.

## Security review **Commit reviewed:** `1538ea855007381c10c5affe95bdbaa9f45bb4b1` **Scope:** 3 files — `indexer/tests/api_limit_book_lcd_mock.rs` (new regression test), `indexer/tests/api_limit_lower_bound.rs` (module doc), `docs/indexer-invariants.md` (documentation). No production handler or dependency changes. **Method:** Inspected MR diff; traced query parameters `limit`/`depth` on LCD-backed `limit-book` and `limit-book-shallow` routes to existing `.clamp(1, max)` in `indexer/src/api/pairs.rs` (unchanged in this MR). New test asserts HTTP 200 and bounded order count for `limit=-1|0` / `depth=-1|0` via wiremock harness only. **Outcome:** `FINDINGS: 0` medium+ Security review: no medium+ findings on this diff. No inline threads — nothing to flag at specific lines.
PlasticDigits commented 2026-06-05 13:07:39 +00:00 (Migrated from gitlab.com)

mentioned in commit c90c83b0bc

mentioned in commit c90c83b0bc95a37d5bf16a2170bc7d8783b47f76
PlasticDigits (Migrated from gitlab.com) merged commit c90c83b0bc into main 2026-06-05 13:07:39 +00:00
PlasticDigits commented 2026-06-08 08:43:13 +00:00 (Migrated from gitlab.com)

mentioned in commit 2c1302c377

mentioned in commit 2c1302c377f4b1c14c6ff9a0f6f86db8421e13b2
Sign in to join this conversation.
No reviewers
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!806
No description provided.