| 1 | # file_info.py DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own the `file_info.py` API endpoint. |
| 6 | - This module handles file info API requests. |
| 7 | - Keep this file-level DOX profile synchronized with `file_info.py` because this directory is intentionally flat. |
| 8 | |
| 9 | ## Ownership |
| 10 | |
| 11 | - `file_info.py` owns the runtime implementation. |
| 12 | - `file_info.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation. |
| 13 | - Classes: |
| 14 | - `FileInfoApi` (`ApiHandler`) |
| 15 | - `async process(self, input: Input, request: Request) -> Output` |
| 16 | - `FileInfo` (`TypedDict`) |
| 17 | - Top-level functions: |
| 18 | - `async get_file_info(path: str) -> FileInfo` |
| 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 | - `FileInfoApi` is an `ApiHandler`. |
| 25 | - `FileInfoApi` defines `process(...)`. |
| 26 | - Observed side-effect areas: filesystem reads. |
| 27 | - Imported dependency areas include: `helpers`, `helpers.api`, `os`, `typing`. |
| 28 | |
| 29 | ## Key Concepts |
| 30 | |
| 31 | - Important called helpers/classes observed in the source: `files.get_abs_path`, `os.path.exists`, `os.path.dirname`, `os.path.basename`, `runtime.call_development_function`, `os.path.isdir`, `os.path.isfile`, `os.path.islink`, `os.path.getsize`, `os.path.getmtime`, `os.path.getctime`, `os.path.splitext`, `os.stat`. |
| 32 | - Keep request/response, tool, or helper semantics documented here at the same time as source changes. |
| 33 | |
| 34 | ## Work Guidance |
| 35 | |
| 36 | - Preserve authentication, CSRF, loopback, and API-key checks unless the endpoint contract explicitly changes. |
| 37 | - Update frontend callers, plugin callers, and tests together when payload shape changes. |
| 38 | - Use `helpers.api.Response` for non-JSON responses, files, redirects, or status-specific replies. |
| 39 | |
| 40 | ## Verification |
| 41 | |
| 42 | - Run endpoint-specific or API/WebSocket tests for changed behavior; smoke-test browser callers when no focused test exists. |
| 43 | - No direct test reference was found by name search; choose the nearest behavioral test or perform a focused smoke check. |
| 44 | |
| 45 | ## Child DOX Index |
| 46 | |
| 47 | No child DOX files. |