Buckets:
AnonymousSpottedToad/candidate_bucket / preliminary /mappings /python /limit_request_rate /cemde_WhatsNext.json
| { | |
| "role_mappings": [ | |
| { | |
| "role": "Entity", | |
| "status": "present", | |
| "symbol": "append_queue", | |
| "file": "whatsnext/api/client/server.py", | |
| "lines": "215", | |
| "notes": "In-repo Python client SDK (Server class) sends HTTP requests to the WhatsNext FastAPI server; append_queue POSTs to /jobs (server.py:237), passing through RateLimitMiddleware.dispatch (middleware.py:85). Any Server method is an equivalent Entity; rate is keyed by client IP." | |
| }, | |
| { | |
| "role": "Enforcer", | |
| "status": "present", | |
| "symbol": "dispatch", | |
| "file": "whatsnext/api/server/middleware.py", | |
| "lines": "85", | |
| "notes": "dispatch in RateLimitMiddleware (Starlette BaseHTTPMiddleware), registered via app.add_middleware at main.py:50, intercepts every incoming request, identifies the client via _get_client_ip (middleware.py:71) and returns 429 with Retry-After or calls call_next. Caveat: only installed when settings.rate_limit_per_minute > 0, which defaults to 0 (disabled, warning logged at main.py:52)." | |
| }, | |
| { | |
| "role": "Limiter", | |
| "status": "present", | |
| "symbol": "dispatch", | |
| "file": "whatsnext/api/server/middleware.py", | |
| "lines": "85", | |
| "notes": "Decision is inline in the Enforcer's dispatch (same method): middleware.py:97 compares the count of timestamps in the window with requests_per_minute and blocks or allows. No smaller helper makes the decision; _clean_old_requests (line 80) only prunes history." | |
| }, | |
| { | |
| "role": "HistoryProvider", | |
| "status": "present", | |
| "symbol": "_clean_old_requests", | |
| "file": "whatsnext/api/server/middleware.py", | |
| "lines": "80", | |
| "notes": "Called by dispatch at middleware.py:94; prunes and returns the sliding-window history in the in-memory dict request_times (per client IP, declared middleware.py:69). The update step is the inline append in dispatch at middleware.py:109 (only allowed requests recorded)." | |
| }, | |
| { | |
| "role": "PolicyProvider", | |
| "status": "present", | |
| "symbol": "rate_limit_per_minute", | |
| "file": "whatsnext/api/server/config.py", | |
| "lines": "26", | |
| "notes": "No method supplies the policy: the limit is the pydantic Settings field rate_limit_per_minute (env/.env configurable, default 0), passed at main.py:50 into RateLimitMiddleware.__init__ (middleware.py:64) as requests_per_minute with a fixed 60s window_size; read by dispatch at middleware.py:97. Single global policy for all entities." | |
| }, | |
| { | |
| "role": "System", | |
| "status": "present", | |
| "symbol": "add_job", | |
| "file": "whatsnext/api/server/routers/jobs.py", | |
| "lines": "46", | |
| "notes": "After dispatch calls call_next (middleware.py:111), the request reaches the FastAPI routers included at main.py:63-66; for the traced client call (POST /jobs) this is add_job, which creates the job in the DB. All other routes are equally protected." | |
| } | |
| ] | |
| } | |
Xet Storage Details
- Size:
- 2.94 kB
- Xet hash:
- b574c5ff60b52db35f8cc0d3f15a69fa81067c6aa8116696dedd7cb53d5b8406
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.