fix(indexer): clamp /api/v1/hooks limit to >=1 (#284) #749

Merged
Brouie merged 1 commit from qa/284-clamp-hooks-limit into main 2026-06-05 03:18:20 +00:00
Brouie commented 2026-06-05 01:19:08 +00:00 (Migrated from gitlab.com)

Follow-up on #284. The .min() -> .clamp(1, MAX) sweep missed get_hook_events (indexer/src/api/hooks.rs:59), so a negative limit still reached Postgres as a negative LIMIT and 500'd on the registered /api/v1/hooks route.

GET /api/v1/hooks?limit=-1 -> 500 (controls ?limit=5 / ?limit=0 -> 200). It was the lone surviving .min() limit clamp in indexer/src/api/.

This clamps it to >=1 like the other 14 sites, plus a regression test (hooks_negative_and_zero_limit_clamp_to_one_not_500) — the original fix had no negative/zero-limit coverage, every *_limit_capped test only asserts the upper bound. api_hooks 4/4.

No closing keyword — leaving the close to @PlasticDigits.

Follow-up on #284. The `.min()` -> `.clamp(1, MAX)` sweep missed `get_hook_events` (`indexer/src/api/hooks.rs:59`), so a negative `limit` still reached Postgres as a negative `LIMIT` and 500'd on the registered `/api/v1/hooks` route. `GET /api/v1/hooks?limit=-1` -> 500 (controls `?limit=5` / `?limit=0` -> 200). It was the lone surviving `.min()` limit clamp in `indexer/src/api/`. This clamps it to `>=1` like the other 14 sites, plus a regression test (`hooks_negative_and_zero_limit_clamp_to_one_not_500`) — the original fix had no negative/zero-limit coverage, every `*_limit_capped` test only asserts the upper bound. api_hooks 4/4. No closing keyword — leaving the close to @PlasticDigits.
Brouie commented 2026-06-05 01:21:12 +00:00 (Migrated from gitlab.com)

mentioned in issue #284

mentioned in issue #284
PlasticDigits commented 2026-06-05 03:18:21 +00:00 (Migrated from gitlab.com)

mentioned in commit 9edb3b6430

mentioned in commit 9edb3b64306dcb955de4c11a44071bc695fbdc0c
PlasticDigits (Migrated from gitlab.com) merged commit 9edb3b6430 into main 2026-06-05 03:18:21 +00:00
ghost1 commented 2026-06-05 04:07:12 +00:00 (Migrated from gitlab.com)

mentioned in commit 6f620546a6

mentioned in commit 6f620546a648f47a7706c6916394fefe07d43413
PlasticDigits commented 2026-06-05 04:07:43 +00:00 (Migrated from gitlab.com)

mentioned in merge request !766

mentioned in merge request !766
PlasticDigits commented 2026-06-05 04:11:58 +00:00 (Migrated from gitlab.com)

mentioned in issue #317

mentioned in issue #317
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!749
No description provided.