| 1 | # health.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the `health.py` API endpoint. |
| 6 | - This module reports process health for probes and startup checks. |
| 7 | - Keep this file-level DOX profile synchronized with `health.py` because this directory is intentionally flat. |
| 8 | |
| 9 | ## Ownership |
| 10 | |
| 11 | - `health.py` owns the runtime implementation. |
| 12 | - `health.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation. |
| 13 | - Classes: |
| 14 | - `HealthCheck` (`ApiHandler`) |
| 15 | - `requires_auth(cls) -> bool` |
| 16 | - `requires_csrf(cls) -> bool` |
| 17 | - `get_methods(cls) -> list[str]` |
| 18 | - `async process(self, input: dict, request: Request) -> dict | Response` |
| 19 | |
| 20 | ## Runtime Contracts |
| 21 | |
| 22 | - HTTP handlers must derive from `helpers.api.ApiHandler`; WebSocket handlers must derive from `helpers.ws.WsHandler`. |
| 23 | - Update this file whenever request payloads, authentication or CSRF requirements, response shapes, route side effects, or WebSocket event contracts change. |
| 24 | - `HealthCheck` is an `ApiHandler`. |
| 25 | - `HealthCheck` defines `process(...)`. |
| 26 | - `HealthCheck` defines `get_methods(...)`. |
| 27 | - `HealthCheck` defines `requires_auth(...)`. |
| 28 | - `HealthCheck` defines `requires_csrf(...)`. |
| 29 | - Imported dependency areas include: `helpers`, `helpers.api`. |
| 30 | |
| 31 | ## Key Concepts |
| 32 | |
| 33 | - Important called helpers/classes observed in the source: `git.get_git_info`, `errors.error_text`. |
| 34 | - Keep request/response, tool, or helper semantics documented here at the same time as source changes. |
| 35 | |
| 36 | ## Work Guidance |
| 37 | |
| 38 | - Preserve authentication, CSRF, loopback, and API-key checks unless the endpoint contract explicitly changes. |
| 39 | - Update frontend callers, plugin callers, and tests together when payload shape changes. |
| 40 | - Use `helpers.api.Response` for non-JSON responses, files, redirects, or status-specific replies. |
| 41 | |
| 42 | ## Verification |
| 43 | |
| 44 | - Run endpoint-specific or API/WebSocket tests for changed behavior; smoke-test browser callers when no focused test exists. |
| 45 | - Related tests observed by source search: |
| 46 | - `tests/test_oauth_providers.py` |
| 47 | - `tests/test_office_document_store.py` |
| 48 | - `tests/test_self_update_tag_filter.py` |
| 49 | |
| 50 | ## Child DOX Index |
| 51 | |
| 52 | No child DOX files. |