From 20a6820d9a9fd29da633df9fea6853190e0082df Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 5 Aug 2026 03:02:51 +0000 Subject: [PATCH] feat: add independent dashboard health endpoint (#26) --- src/main.py | 6 ++++++ tests/test_health.py | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/test_health.py diff --git a/src/main.py b/src/main.py index 1c4679b..6da7ab4 100644 --- a/src/main.py +++ b/src/main.py @@ -21,6 +21,12 @@ app.add_middleware( app.include_router(frontend_router) +@app.get("/healthz") +def health() -> dict[str, str]: + """Return process liveness without depending on Gitea.""" + return {"status": "ok", "service": "stackchain-dashboard"} + + @app.get("/api/v1/context") async def context() -> JSONResponse: try: diff --git a/tests/test_health.py b/tests/test_health.py new file mode 100644 index 0000000..c82299c --- /dev/null +++ b/tests/test_health.py @@ -0,0 +1,6 @@ +from src.main import app, health + + +def test_health_endpoint_reports_service_liveness_without_gitea_access(): + assert any(getattr(route, "path", None) == "/healthz" for route in app.routes) + assert health() == {"status": "ok", "service": "stackchain-dashboard"} -- 2.43.0