Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring
TypeScript diagramhomelabhomelab-infrastructure-observabilitynetworkproxmox-veself-hostedzigbeezwavezwave-js
fix(api): read the advertised API version from the VERSION file
Pouzora6f6aeff9380
diff --git a/backend/app/main.py b/backend/app/main.pyindex fe4b5b3..c9545dd 100644--- a/backend/app/main.py+++ b/backend/app/main.py@@ -26,7 +26,7 @@ from app.api.routes import (zwave,)from app.api.routes import settings as settings_routes-from app.core.config import settings+from app.core.config import APP_VERSION, settingsfrom app.core.scheduler import start_scheduler, stop_schedulerfrom app.core.security import OIDCCSRFMiddlewarefrom app.db.database import AsyncSessionLocal, init_db@@ -58,7 +58,11 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:app = FastAPI(title="Homelable API",- version="1.9.0",+ # Read from the VERSION file, never hard-coded: a literal here froze at+ # 1.9.0 in April 2026 — the last value before VERSION took over as the+ # source of truth — and silently stayed there for ten releases. This is+ # what the OpenAPI schema and the Swagger UI badge print.+ version=APP_VERSION,lifespan=lifespan,)diff --git a/backend/tests/test_app_meta.py b/backend/tests/test_app_meta.pynew file mode 100644index 0000000..d3fc98e--- /dev/null+++ b/backend/tests/test_app_meta.py@@ -0,0 +1,38 @@+"""The API's advertised version tracks the VERSION file.++Regression guard: `FastAPI(version=...)` used to be a hard-coded literal that+the release process never touched. It froze at 1.9.0 in April 2026, when the+VERSION file took over as the source of truth, and drifted for ten releases —+`/openapi.json` and the Swagger UI badge advertised 1.9.0 while the app shipped+3.4.x. Nothing pinned it, so nothing caught it.+"""++from pathlib import Path++from httpx import AsyncClient++from app.core.config import APP_VERSION+from app.main import app++VERSION_FILE = Path(__file__).parent.parent.parent / "VERSION"+++def test_app_version_comes_from_the_version_file():+ assert app.version == APP_VERSION+++def test_app_version_is_not_a_stale_literal():+ # The loader falls back to "unknown" when it cannot find the file; in a repo+ # checkout it always can, so an "unknown" here means the fallback silently+ # took over and the schema would advertise nothing useful.+ assert VERSION_FILE.read_text().strip() == APP_VERSION+ assert APP_VERSION != "unknown"+++async def test_openapi_schema_advertises_the_current_version(client: AsyncClient):+ res = await client.get("/openapi.json")+ assert res.status_code == 200+ info = res.json()["info"]+ assert info["title"] == "Homelable API"+ # What the Swagger UI badge renders.+ assert info["version"] == VERSION_FILE.read_text().strip()