Commit d326e05c authored by George Papathanail's avatar George Papathanail
Browse files

fix: report the real package version in health endpoints

app_version was hardcoded to 1.0.0, and pyproject.toml also said 1.0.0
on the 2.0 release, so /platform/healthz and /platform/readyz reported
the wrong version.

Bump pyproject.toml to 2.0.0 and relock (only OEG's own uv.lock entry
changes). app_version now defaults to the installed package version
from importlib.metadata. If the metadata is missing it falls back to
0.0.0+unknown. APP_VERSION still overrides it.

The Dockerfile's non-editable uv sync keeps the package metadata, so
the image reports 2.0.0.
parent bbb5dcbf
Loading
Loading
Loading
Loading
Loading
+1 −1
Changes for pyproject.toml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "open-exposure-gateway"
version = "1.0.0"
version = "2.0.0"
description="Open Exposure Gateway microservice"
readme="README.md"
authors = [
+10 −2
Changes for src/open_exposure_gateway/core/config.py: 10 added lines, 2 removed lines.
Original line number Diff line number Diff line
import base64
import binascii
from functools import lru_cache
from importlib.metadata import PackageNotFoundError, version
from uuid import UUID, uuid5

from pydantic import BaseModel, HttpUrl, SecretStr, field_validator
from pydantic import BaseModel, Field, HttpUrl, SecretStr, field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict

# QoD and Location Retrieval have no CAMARA registration step to resolve a
@@ -16,6 +17,13 @@ _SPECIFICATION_VERSION = "1"
_NAMESPACE_URL = UUID("6ba7b811-9dad-11d1-80b4-00c04fd430c8")


def _package_version() -> str:
    try:
        return version("open-exposure-gateway")
    except PackageNotFoundError:
        return "0.0.0+unknown"


def well_known_service_specification_id(ref: str) -> UUID:
    return uuid5(
        _NAMESPACE_URL,
@@ -141,7 +149,7 @@ class Settings(BaseSettings):
    )

    app_name: str = "Open Exposure Gateway"
    app_version: str = "1.0.0"
    app_version: str = Field(default_factory=_package_version)
    debug: bool = False
    host: str = "0.0.0.0"
    port: int = 8080
+7 −0
Changes for tests/unit/test_platform_flows.py: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
"""Flow tests for the platform endpoints (health/readiness)."""

from importlib.metadata import version

from fastapi.testclient import TestClient

from open_exposure_gateway.dependencies import get_token_verifier
@@ -52,6 +54,11 @@ class TestReadyzFlow:
        assert api_client.get("/platform/readyz").status_code == 200
        assert fake_verifier.warm_calls == 0

    def test_reports_package_version(self, api_client: TestClient) -> None:
        response = api_client.get("/platform/readyz")

        assert response.json()["version"] == version("open-exposure-gateway")


class TestHealthzFlow:
    def test_liveness_does_not_depend_on_downstreams(
+1 −1
Changes for uv.lock: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -755,7 +755,7 @@ wheels = [

[[package]]
name = "open-exposure-gateway"
version = "1.0.0"
version = "2.0.0"
source = { editable = "." }
dependencies = [
    { name = "asyncpg" },