Skip to content

Report the BuEM version on health and every response - #43

Merged
jravani merged 2 commits into
enerplanetfrom
feat/report-version
Oct 14, 2026
Merged

jravani merged 2 commits into
enerplanetfrom
feat/report-version

Conversation

@jravani

@jravani jravani commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

BuEM now reports which release and commit served a request.

Behaviour

  • GET /api/health returns {"status": "ok", "version": "6.9.0", "commit": "<sha>"}.
  • Every response, including /api/process and /api/run, carries the same values in the X-BuEM-Version and X-BuEM-Commit headers.
  • Each /api/process result records them in features[].properties.buem.model_metadata: model_version is the release instead of the fixed BUEM-v3.0, and the new model_commit is the commit. The pinned response schema already allows extra keys in model_metadata.
  • An image built from a release tag reports that version (for example 6.10.0). An image built from a push to enerplanet reports enerplanet and its commit, so the commit distinguishes non-release images.
  • Outside the image, version is the installed package version and commit is unknown, unless BUEM_VERSION and BUEM_COMMIT are set.

Changes

  • buem.build_info(): the one source of version and commit, read by /api/health, the headers and model_metadata.
  • api_server.py: version and commit on /api/health, and an after_request hook that adds the two headers.
  • geojson_processor.py: model_version and model_commit from build_info().
  • Dockerfile and docker-publish.yml: BUEM_VERSION and BUEM_COMMIT build arguments, from the metadata-action version and github.sha. The image has neither .git nor _version.py, so without them it reports the 0.1.3 fallback.
  • openapi.yaml, response_format.rst and the CHANGELOG document them.

Testing

  • tests/test_version_report.py: health body and headers with the variables set, the package-version fallback without them, and model_version/model_commit in a result. All three fail before the change.
  • pytest -q -m "not slow": 354 passed, 29 skipped. ruff check and mypy src clean.
  • The docker build has not been run locally; the first publish run exercises the build arguments.

GET /api/health returns the release and commit that serve it, and
every response carries them in X-BuEM-Version and X-BuEM-Commit, so a
stored result can record the version that computed it. The published
image carries neither .git nor _version.py, so docker-publish.yml
passes the release tag and commit as build arguments; without them
the image would report the 0.1.3 fallback.
model_metadata.model_version was the fixed string BUEM-v3.0. It is
now the release that computed the result, and the new model_commit
holds the commit, so a stored response body records both without the
headers. /api/health, the X-BuEM-* headers and model_metadata read the
same values from buem.build_info().
@jravani
jravani merged commit 870b08f into enerplanet Oct 14, 2026
1 check passed
@jravani
jravani deleted the feat/report-version branch October 14, 2026 15:21
@jravani jravani added this to the v6.10.0 milestone Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant