Commit 8617367
committed
refactor(rate-limiter): review fixes, Redis hardening, key-format parity tests
- Extract _dispatch_hook() shared by prompt_pre_fetch and tool_pre_invoke,
reducing each hook to a single-line wrapper
- Elevate Redis val_i64/val_f64 parse-error logging from warn to error so
silent fail-open degradation surfaces in operator dashboards
- Clamp sliding-window reset_timestamp with .max(1) so it is always strictly
in the future even when the oldest entry expires in < 1 s
- Add 5 s tokio::time::timeout around Redis connection establishment to
prevent indefinite blocking on network partition
- Replace silent except-pass in EVALSHA SHA tracking with logger.debug
- Document dual Lua-script invariant (rolling-upgrade key-format parity)
in both Python RedisBackend docstring and Rust redis_backend.rs header
- Add 7 parametrized test_redis_key_format_parity_* tests validating that
Python and Rust produce identical Redis keys for the same inputs
- Revert unrelated .pyi stub changes for encoded_exfil_detection, pii_filter,
retry_with_backoff, and secrets_detection
Signed-off-by: Jonathan Springer <jps@s390x.com>1 parent 8e632ea commit 8617367
16 files changed
Lines changed: 1612 additions & 891 deletions
File tree
- mcpgateway
- plugins_rust/rate_limiter
- python/rate_limiter_rust
- src
- plugins
- rate_limiter
- tests
- integration
- loadtest
- unit/mcpgateway
- plugins/plugins/rate_limiter
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
10510 | 10510 | | |
10511 | 10511 | | |
10512 | 10512 | | |
10513 | | - | |
10514 | | - | |
10515 | | - | |
10516 | | - | |
10517 | | - | |
10518 | | - | |
10519 | | - | |
10520 | | - | |
10521 | 10513 | | |
10522 | 10514 | | |
10523 | 10515 | | |
10524 | 10516 | | |
10525 | | - | |
| 10517 | + | |
10526 | 10518 | | |
10527 | 10519 | | |
10528 | 10520 | | |
10529 | 10521 | | |
10530 | 10522 | | |
10531 | 10523 | | |
10532 | 10524 | | |
10533 | | - | |
| 10525 | + | |
10534 | 10526 | | |
10535 | 10527 | | |
10536 | 10528 | | |
10537 | 10529 | | |
10538 | 10530 | | |
10539 | 10531 | | |
10540 | 10532 | | |
10541 | | - | |
| 10533 | + | |
10542 | 10534 | | |
10543 | 10535 | | |
10544 | 10536 | | |
10545 | 10537 | | |
10546 | 10538 | | |
10547 | 10539 | | |
10548 | 10540 | | |
10549 | | - | |
| 10541 | + | |
10550 | 10542 | | |
10551 | 10543 | | |
10552 | 10544 | | |
10553 | 10545 | | |
10554 | 10546 | | |
10555 | 10547 | | |
10556 | 10548 | | |
10557 | | - | |
| 10549 | + | |
10558 | 10550 | | |
10559 | 10551 | | |
10560 | 10552 | | |
10561 | 10553 | | |
10562 | 10554 | | |
10563 | 10555 | | |
10564 | 10556 | | |
10565 | | - | |
| 10557 | + | |
10566 | 10558 | | |
10567 | 10559 | | |
10568 | 10560 | | |
10569 | 10561 | | |
10570 | 10562 | | |
10571 | 10563 | | |
10572 | 10564 | | |
10573 | | - | |
| 10565 | + | |
10574 | 10566 | | |
10575 | 10567 | | |
10576 | 10568 | | |
10577 | 10569 | | |
10578 | 10570 | | |
10579 | 10571 | | |
10580 | 10572 | | |
10581 | | - | |
| 10573 | + | |
| 10574 | + | |
| 10575 | + | |
| 10576 | + | |
| 10577 | + | |
| 10578 | + | |
| 10579 | + | |
| 10580 | + | |
| 10581 | + | |
10582 | 10582 | | |
10583 | 10583 | | |
10584 | 10584 | | |
10585 | 10585 | | |
10586 | 10586 | | |
10587 | 10587 | | |
10588 | 10588 | | |
10589 | | - | |
| 10589 | + | |
10590 | 10590 | | |
10591 | 10591 | | |
10592 | 10592 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1248 | 1248 | | |
1249 | 1249 | | |
1250 | 1250 | | |
1251 | | - | |
1252 | 1251 | | |
1253 | 1252 | | |
| 1253 | + | |
1254 | 1254 | | |
1255 | 1255 | | |
1256 | 1256 | | |
| |||
1378 | 1378 | | |
1379 | 1379 | | |
1380 | 1380 | | |
1381 | | - | |
1382 | 1381 | | |
1383 | 1382 | | |
| 1383 | + | |
1384 | 1384 | | |
1385 | 1385 | | |
1386 | 1386 | | |
| |||
1517 | 1517 | | |
1518 | 1518 | | |
1519 | 1519 | | |
1520 | | - | |
1521 | 1520 | | |
1522 | 1521 | | |
| 1522 | + | |
1523 | 1523 | | |
1524 | 1524 | | |
1525 | 1525 | | |
| |||
1699 | 1699 | | |
1700 | 1700 | | |
1701 | 1701 | | |
1702 | | - | |
1703 | 1702 | | |
1704 | 1703 | | |
| 1704 | + | |
1705 | 1705 | | |
1706 | 1706 | | |
1707 | 1707 | | |
| |||
1717 | 1717 | | |
1718 | 1718 | | |
1719 | 1719 | | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
1720 | 1723 | | |
1721 | 1724 | | |
1722 | 1725 | | |
| |||
1764 | 1767 | | |
1765 | 1768 | | |
1766 | 1769 | | |
1767 | | - | |
1768 | | - | |
1769 | | - | |
1770 | | - | |
1771 | | - | |
1772 | | - | |
1773 | 1770 | | |
1774 | 1771 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
0 commit comments