Fixed registries maintainer README route dispatch details.
CI / Formatting (push) Successful in 5s
CI / Linting (push) Successful in 4s
CI / Tests (Python 3.12) (push) Successful in 2m55s
CI / Tests (Python 3.13) (push) Successful in 2m54s
CI / Tests (Python 3.14) (push) Successful in 2m50s
CI / Type Checking (push) Successful in 8s
CI / Spelling (push) Successful in 4s

This commit is contained in:
2026-05-11 19:58:32 -04:00
parent 34115999b4
commit 9ca341a389
+11 -9
View File
@@ -43,7 +43,7 @@ registered handlers, cooldowns, or active route tasks.
Every registered command, event handler, and route belongs to a `module_name`. Every registered command, event handler, and route belongs to a `module_name`.
The module-scoped wrappers (`ModuleCommands`, `ModuleEvents`, and The module-scoped wrappers (`ModuleCommands`, `ModuleEvents`, and
`ModuleRoutes`) automatically supply that name for dynamic registration and keep `ModuleRoutes`) automatically supply that name for dynamic registration and keep
modules from unregistering other modules' commands or event handlers. modules from unregistering other modules' commands, event handlers, or routes.
During unload, `ModuleLoader._cleanup_module()` calls `unregister_by_module()` During unload, `ModuleLoader._cleanup_module()` calls `unregister_by_module()`
on all three dispatchers so a module's registrations are removed together. on all three dispatchers so a module's registrations are removed together.
@@ -159,24 +159,26 @@ Command handler exceptions and timeouts are logged and swallowed.
## Route Dispatch ## Route Dispatch
`HttpServer` owns the aiohttp catch-all routes under `/owlbot/{module_name}` and `HttpServer` owns the aiohttp catch-all routes under `/owlbot/{module_name}` and
`/owlbot/{module_name}/{path:.*}`. Requests under those paths are delegated to `/owlbot/{module_name}/{path:.*}`. Requests that reach those catch-alls are
`RouteDispatcher.dispatch()`, which matches them against module-registered delegated to `RouteDispatcher.dispatch()`, which matches them against
routes. module-registered routes. The built-in `/owlbot/connect` session routes and
`/owlbot/static` assets are registered before the catch-alls, and those module
names are reserved.
```mermaid ```mermaid
flowchart TD flowchart TD
Request["HTTP request under /owlbot/{module}"] --> Server["HttpServer catch-all"] Request["HTTP request under /owlbot/{module}"] --> Server["HttpServer catch-all"]
Server --> Routes["run route dispatcher"] Server --> Routes["run route dispatcher"]
Routes --> FullPath["build module-namespaced path"] Routes --> Session["resolve browser session cookie"]
Session --> FullPath["build module-namespaced path"]
FullPath --> Match["match registered route and HTTP method"] FullPath --> Match["match registered route and HTTP method"]
Match --> Result{"route match result"} Match --> Result{"route match result"}
Result -->|no path| NotFound["404"] Result -->|no path| NotFound["404"]
Result -->|method not allowed| MethodNotAllowed["405 with Allow header"] Result -->|method not allowed| MethodNotAllowed["405 with Allow header"]
Result -->|handler found| Session["resolve browser session cookie"] Result -->|handler found| Context["build RouteContext"]
Session --> Guards{"session/auth/moderator guards pass?"} Context --> Guards{"session/auth/moderator guards pass?"}
Guards -->|no| Guidance["return 401 or 403 guidance page"] Guards -->|no| Guidance["return 401 or 403 guidance page"]
Guards -->|yes| Context["build RouteContext"] Guards -->|yes| Streaming{"streaming route?"}
Context --> Streaming{"streaming route?"}
Streaming -->|yes| StreamTask["track streaming task for shutdown"] Streaming -->|yes| StreamTask["track streaming task for shutdown"]
Streaming -->|no| HandlerTask["track non-streaming task for shutdown"] Streaming -->|no| HandlerTask["track non-streaming task for shutdown"]
StreamTask --> NoTimeout["call handler without timeout"] StreamTask --> NoTimeout["call handler without timeout"]