Buckets:

download
raw
2.8 kB
{
"role_mappings": [
{
"role": "Entity",
"status": "missing",
"symbol": "",
"file": "",
"lines": "",
"notes": "Requests come from external HTTP clients outside the repo; no in-repo UI/SDK/CLI sends requests to the RateLimitMiddleware (only tests and example scripts)."
},
{
"role": "Enforcer",
"status": "present",
"symbol": "__call__",
"file": "zenith/middleware/rate_limit.py",
"lines": "469",
"notes": "ASGI __call__ of RateLimitMiddleware intercepts every HTTP request, calls _check_rate_limits_asgi (line 484-489) and returns a 429 JSON response when blocked, otherwise forwards to self.app (line 549). Registered by Zenith._add_essential_middleware at zenith/app.py:243 when production mode is on (off by default; also opt-in via add_rate_limiting in zenith/mixins/middleware.py:120)."
},
{
"role": "Limiter",
"status": "present",
"symbol": "_check_rate_limits_asgi",
"file": "zenith/middleware/rate_limit.py",
"lines": "674",
"notes": "Called by Enforcer __call__ at rate_limit.py:489; derives the key per limit (_get_rate_limit_key_asgi, IP/user/endpoint), increments the counter via storage.increment (line 691) and returns allowed=False when count exceeds rate_limit.requests (line 693)."
},
{
"role": "HistoryProvider",
"status": "present",
"symbol": "increment",
"file": "zenith/middleware/rate_limit.py",
"lines": "86",
"notes": "Limiter calls self.storage.increment at rate_limit.py:691; default storage is MemoryRateLimitStorage (created at rate_limit.py:276), whose increment keeps a fixed-window (count, expires_at) per key in an in-memory dict and returns the new count (get + update in one call). Alternative RedisRateLimitStorage.increment at line 185 is opt-in."
},
{
"role": "PolicyProvider",
"status": "present",
"symbol": "_get_applicable_limits_asgi",
"file": "zenith/middleware/rate_limit.py",
"lines": "662",
"notes": "Called by Enforcer __call__ at rate_limit.py:481 (result passed to the Limiter); returns endpoint-specific limits registered via add_endpoint_limit (line 294) or default_limits (RateLimit dataclass, line 30), configured as 100 req/60s per IP at zenith/app.py:245."
},
{
"role": "System",
"status": "missing",
"symbol": "",
"file": "",
"lines": "",
"notes": "Zenith is a web framework library; it has no protected business handler of its own (rule 6.1.7). Only built-in health endpoints (health_check, zenith/app.py:344) and example apps (examples/08-rate-limiting.py, which registers RateLimitMiddleware itself at line 67) sit behind the middleware; examples are out of scope."
}
]
}

Xet Storage Details

Size:
2.8 kB
·
Xet hash:
32a9a3e7cc794f56843067bf3214730049841e2faa2d74bf5ad96292d79815c9

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.