diff --git a/Docs/Tasks.md b/Docs/Tasks.md index 975c759..9f86cca 100644 --- a/Docs/Tasks.md +++ b/Docs/Tasks.md @@ -7,80 +7,3 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue. --- ## Open Issues - -### Bug: `GET /api/history` returns 500 — missing `origin` parameter through the call chain - -**Severity:** Critical (page-level breakage — History page fails to load) - -The router (`backend/app/routers/history.py`) passes `origin=origin` (a `BanOrigin | None` query param) to `history_service.list_history()`, but **the service function signature does not accept an `origin` parameter**. This causes a `TypeError` at runtime → 500. - -The fix must be threaded through two layers: - -1. **`backend/app/services/history_service.py` → `list_history()`** — add `origin: BanOrigin | None = None` parameter, import `BanOrigin`, and forward it to `fail2ban_db_repo.get_history_page()`. -2. **`backend/app/repositories/fail2ban_db_repo.py` → `get_history_page()`** — add `origin: BanOrigin | None = None` parameter and apply the already-existing `_origin_sql_filter()` helper (defined at line 73 but never called in this function). - -**Status:** Done - -Key files: -- `backend/app/routers/history.py` (caller — correct, passes `origin`) -- `backend/app/services/history_service.py` (missing `origin` param) -- `backend/app/repositories/fail2ban_db_repo.py` (missing `origin` param in `get_history_page`; `_origin_sql_filter` already exists but isn't wired in) - -Tests: add/update tests for `list_history` and `get_history_page` with `origin` filtering. - ---- - -### Bug: `GET /api/config/jails/inactive` returns 500 — missing import of `_get_active_jail_names` - -**Severity:** Critical (Config → Jails tab cannot show inactive jails) - -`backend/app/services/jail_config_service.py` calls `_get_active_jail_names()` at 6 call sites (lines 504, 563, 699, 824, 882, 975) but **does not import it**. The current imports from `app.utils.config_file_utils` include `_parse_jails_sync` and `_build_inactive_jail` but are missing `_get_active_jail_names`. This causes `NameError` → 500. - -Fix: add `_get_active_jail_names` to the import block at line 33–38 in `jail_config_service.py`: - -```python -from app.utils.config_file_utils import ( - _build_inactive_jail, - _get_active_jail_names, # ← add - _ordered_config_files, - _parse_jails_sync, - _validate_jail_config_sync, -) -``` - -Key file: `backend/app/services/jail_config_service.py` - ---- - -### Bug: `GET /api/config/filters` returns 500 — missing imports of `_parse_jails_sync` and `_get_active_jail_names` - -**Severity:** Critical (Config → Filters tab fails to load) - -`backend/app/services/filter_config_service.py` calls `_parse_jails_sync()` (lines 509, 609, 880) and `_get_active_jail_names()` (lines 510, 610) but **neither is imported**. This causes `NameError` → 500. - -Fix: add the missing imports. Both are available from `app.utils.config_file_utils` (re-exported from `config_file_service`): - -```python -from app.utils.config_file_utils import ( - _get_active_jail_names, - _parse_jails_sync, -) -``` - -Key file: `backend/app/services/filter_config_service.py` - ---- - -### Bug: `GET /api/config/service-status` returns 500 — missing `bangui_version` in response construction - -**Severity:** Critical (Config → Server tab health check fails) - -The `ServiceStatusResponse` Pydantic model (`backend/app/models/config.py`, line 1005) declares `bangui_version: str = Field(...)` as a **required field with no default**. However, `config_service.get_service_status()` (`backend/app/services/config_service.py`, ~line 820) constructs the response **without supplying `bangui_version`**, causing a Pydantic `ValidationError` → 500. - -Fix: -1. Import `__version__` from `app` (or `app.__init__`) in `config_service.py`. -2. Add `bangui_version=__version__` to the `ServiceStatusResponse(...)` constructor call. - -Key files: -- `backend/app/services/config_service.py` (missing field in constructor) -- `backend/app/models/config.py` (model definition — correct, requires `bangui_version`)