Buckets:

download
raw
4.09 kB
{
"role_mappings": [
{
"role": "Entity",
"status": "missing",
"symbol": "",
"file": "",
"lines": "",
"notes": "The requester of the v1 FastAPI API (archive/v1/src/app.py) is an outside HTTP client. The in-repo Python client SDK (python/wifi_densepose/client/ws.py) targets the Rust sensing-server /ws/sensing on port 8765, not the traced middleware, and archive/v1/scripts/test_api_endpoints.py plus archive/v1/test_auth_rate_limit.py are test scripts, so neither counts."
},
{
"role": "Enforcer",
"status": "present",
"symbol": "dispatch",
"file": "archive/v1/src/middleware/rate_limit.py",
"lines": "312",
"notes": "dispatch of RateLimitMiddleware (BaseHTTPMiddleware), registered by setup_middleware at archive/v1/src/app.py:99 when enable_rate_limiting is true (the default, src/config/settings.py:143), and app.py is the default entry point (CLI start uses src.app:app). It skips /health, /metrics and /docs paths, calls rate_limiter.check_rate_limit(request) at line 323, raises HTTP 429 with Retry-After on a block (lines 325-339), and otherwise forwards via call_next at line 342. Caveat: because the HTTPException is raised inside BaseHTTPMiddleware, FastAPI's handlers do not catch it, so the client probably gets a 500 instead of a 429, but the request is still blocked."
},
{
"role": "Limiter",
"status": "present",
"symbol": "is_allowed",
"file": "archive/v1/src/middleware/rate_limit.py",
"lines": "93",
"notes": "Reached from the Enforcer (dispatch, line 323) through RateLimiter.check_rate_limit (line 240), which builds the entity key (user or IP plus method and path, _get_rate_limit_key line 234), gets the policy limit (line 252), fetches or creates the per-key window (lines 255-258) and calls window.is_allowed() at line 263. is_allowed in SlidingWindowCounter makes the final decision `allowed = current_requests < self.limit` (line 105) and returns (allowed, RateLimitInfo) back to the Enforcer."
},
{
"role": "HistoryProvider",
"status": "present",
"symbol": "_sliding_windows",
"file": "archive/v1/src/middleware/rate_limit.py",
"lines": "138",
"notes": "This is the in-memory dict in RateLimiter.__init__ that maps each client/endpoint key to a SlidingWindowCounter, whose requests deque (line 90) holds the request timestamps. check_rate_limit reads it at lines 255-258 (get_history), and is_allowed drops expired timestamps (lines 100-101) and appends the allowed request (line 108) (update). A field is cited because no dedicated method owns the history: the reads and writes are inline, and _cleanup_old_data (line 172) is never scheduled because RateLimiter.start is never called."
},
{
"role": "PolicyProvider",
"status": "present",
"symbol": "_get_rate_limit",
"file": "archive/v1/src/middleware/rate_limit.py",
"lines": "225",
"notes": "check_rate_limit (line 252) calls _get_rate_limit, which returns authenticated_limit when request.state.user is set and default_limit otherwise. RateLimiter.__init__ (lines 128-130) loads these limits and the window size from the Settings fields rate_limit_requests, rate_limit_authenticated_requests and rate_limit_window (archive/v1/src/config/settings.py:41-43, defaults 100/1000 per 3600 s), and check_rate_limit pushes the limit into the window at line 261."
},
{
"role": "System",
"status": "present",
"symbol": "get_current_pose_estimation",
"file": "archive/v1/src/api/routers/pose.py",
"lines": "116",
"notes": "This is one representative business handler (GET /api/v1/pose/current) reached when the Enforcer forwards the request with call_next at rate_limit.py:342. The pose router is mounted at archive/v1/src/app.py:186-190, and the middleware equally guards every other non-exempt route (the other pose handlers and the stream router). The handler runs pose_service.estimate_poses and returns the result directly to the client."
}
]
}

Xet Storage Details

Size:
4.09 kB
·
Xet hash:
57ab2c9f0712f9bcce32f34183ea84e0e793dfcb882716490d3deae3026a105e

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