main
md 45 lines 1.9 KB
Rendered Raw
1 # rate_limiter.py DOX
2
3 ## Purpose
4
5 - Own the `rate_limiter.py` helper module.
6 - This module provides simple rate-limiting primitives.
7 - Keep this file-level DOX profile synchronized with `rate_limiter.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `rate_limiter.py` owns the runtime implementation.
12 - `rate_limiter.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Classes:
14 - `RateLimiter` (no explicit base class)
15 - `add(self, **kwargs)`
16 - `async cleanup(self)`
17 - `async get_total(self, key: str) -> int`
18 - `async wait(self, callback: Callable[[str, str, int, int], Awaitable[bool]] | None=...)`
19
20 ## Runtime Contracts
21
22 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
23 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
24 - Imported dependency areas include: `asyncio`, `time`, `typing`.
25
26 ## Key Concepts
27
28 - Important called helpers/classes observed in the source: `asyncio.Lock`, `time.time`, `self.cleanup`, `asyncio.sleep`, `self.get_total`, `callback`.
29 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
30
31 ## Work Guidance
32
33 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
34 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
35 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
36
37 ## Verification
38
39 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
40 - Related tests observed by source search:
41 - `tests/test_stream_tool_early_stop.py`
42
43 ## Child DOX Index
44
45 No child DOX files.