Buckets:

download
raw
3.31 kB
{
"role_mappings": [
{
"role": "Entity",
"status": "missing",
"symbol": "",
"file": "",
"lines": "",
"notes": "Callers of the rate-limited FastAPI app are external HTTP clients (browsers, API users) outside the repo; the Enforcer keys them by scope['client'] IP at bloom_lims/api/rate_limiting.py:340-341. Searched for in-repo JS/Python clients of /api/v1; only test_bloom_endpoints.py (test script) and outbound integrations (dewey client) exist, which do not count."
},
{
"role": "Enforcer",
"status": "present",
"symbol": "__call__",
"file": "bloom_lims/api/rate_limiting.py",
"lines": "322",
"notes": "ASGI middleware RateLimitMiddleware.__call__, registered globally via app.add_middleware(RateLimitMiddleware) at bloom_lims/app.py:266 (on by default unless BLOOM_RATE_LIMIT=no). It extracts the client IP, calls self.limiter.is_allowed(client_id) at line 343, and returns 429 with Retry-After when blocked; excludes health paths and /api/v1/external/atlas/, and is bypassed when BLOOM_DISABLE_RATE_LIMITING is set."
},
{
"role": "Limiter",
"status": "present",
"symbol": "is_allowed",
"file": "bloom_lims/api/rate_limiting.py",
"lines": "119",
"notes": "RateLimiter.is_allowed, called by the Enforcer at bloom_lims/api/rate_limiting.py:343. Refills a per-client token bucket, resets minute/hour windows, rejects on hourly limit or minute limit with no burst tokens, otherwise consumes a token and increments counters (updating history inline)."
},
{
"role": "HistoryProvider",
"status": "present",
"symbol": "_buckets",
"file": "bloom_lims/api/rate_limiting.py",
"lines": "104",
"notes": "In-memory dict RateLimiter._buckets (defaultdict of ClientBucket dataclasses, line 62) keyed by client id; read at line 134 and updated at lines 137-180 inside is_allowed (the Limiter). No dedicated getter/updater method exists on the traced path, so the field is cited; per-process only, not shared across workers."
},
{
"role": "PolicyProvider",
"status": "present",
"symbol": "__init__",
"file": "bloom_lims/api/rate_limiting.py",
"lines": "83",
"notes": "RateLimiter.__init__ sets the policy (requests_per_minute, requests_per_hour, burst_size, enabled) and tries to override per-minute limit from get_settings().api.rate_limit_per_minute (line 115-117); instantiated by RateLimitMiddleware.__init__ at line 316 with defaults 60/min and 1000/h. Caveat: APISettings (bloom_lims/config.py:645) defines rate_limit_requests/rate_limit_window_seconds but not rate_limit_per_minute, so the config values are not actually used and the hard-coded defaults apply."
},
{
"role": "System",
"status": "present",
"symbol": "list_objects",
"file": "bloom_lims/api/v1/objects.py",
"lines": "41",
"notes": "Example protected handler: GET /api/v1/objects/ (objects router included in api_v1_router, bloom_lims/api/v1/__init__.py:45, mounted at bloom_lims/app.py:272). The middleware forwards allowed requests via await self.app(scope, receive, send) at bloom_lims/api/rate_limiting.py:370; it guards all non-excluded routes, this one is representative."
}
]
}

Xet Storage Details

Size:
3.31 kB
·
Xet hash:
bd71a22e29d4eebfaef4845080f49204e2da02f40415d4e937409d75b6879292

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