0d5882b32f
Fix HIGH priority issues: unbounded queries, rate limiting, health checks
...
Issue #3 - Unbounded Query Results (OOM):
- get_all_archived_history() now uses keyset pagination with bounded max_rows (50k default)
- Added 'id' field to records from get_archived_history() and get_archived_history_keyset()
- Protocol signature updated with page_size, max_rows, last_ban_id params
Issue #7 - Docker Health Check Fails:
- Added curl to Dockerfile.backend runtime image
- HEALTHCHECK now uses 'curl -f http://localhost:8000/api/health '
- compose.prod.yml: increased start_period to 40s, timeout to 10s
- Frontend healthcheck proxies to backend /api/health
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com >
2026-05-01 21:47:36 +02:00
5480dce221
refactor: Remove duplicate router-level exception helpers
...
All routers now let domain exceptions propagate to the global handlers in main.py
instead of catching and converting them to HTTPException. This eliminates:
- Duplicate exception-to-HTTP-status mappings across 8 routers
- Duplicate helper functions (_bad_gateway, _not_found, _conflict, etc.)
- Inconsistent error response formats
Changes:
- Removed all try/except blocks from routers that catch domain exceptions
- Removed duplicate helper functions from all routers
- Added missing exception handlers to main.py for:
* ActionNameError
* FilterNameError
* JailNameError
* JailNotFoundInConfigError
* FilterInvalidRegexError
- Removed unused imports from affected routers
All domain exceptions now propagate to the single authoritative mapping in
main.py, ensuring consistent error codes, messages, and logging across the API.
Affected routers:
- action_config.py: Removed _action_not_found, _bad_request, _not_found helpers
- bans.py: Removed try/except in ban/unban endpoints
- config_misc.py: Removed try/except blocks
- file_config.py: Removed 6 try/except blocks and _service_unavailable helper
- filter_config.py: Removed try/except blocks
- geo.py: Removed try/except in lookup_ip endpoint
- jail_config.py: Removed try/except blocks
- jails.py: Removed try/except blocks
- server.py: Removed try/except blocks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com >
2026-04-23 16:00:37 +02:00
7f81f0614b
Stage 7: configuration view — backend service, routers, tests, and frontend
...
- config_service.py: read/write jail config via asyncio.gather, global
settings, in-process regex validation, log preview via _read_tail_lines
- server_service.py: read/write server settings, flush logs
- config router: 9 endpoints for jail/global config, regex-test,
logpath management, log preview
- server router: GET/PUT settings, POST flush-logs
- models/config.py expanded with JailConfig, GlobalConfigUpdate,
LogPreview* models
- 285 tests pass (68 new), ruff clean, mypy clean (44 files)
- Frontend: types/config.ts, api/config.ts, hooks/useConfig.ts,
ConfigPage.tsx full implementation (Jails accordion editor,
Global config, Server settings, Regex Tester with preview)
- Fixed pre-existing frontend lint: JSX.Element → React.JSX.Element
(10 files), void/promise patterns in useServerStatus + useJails,
no-misused-spread in client.ts, eslint.config.ts self-excluded
2026-03-01 14:37:55 +01:00