feat: add the WORKER_TIMEOUT error code to the generated catalogue

Merged
OG
7d ago
+103-1

Why

The Infrahub server now returns a WORKER_TIMEOUT error code when a call to a worker runs past its timeout (opsmill/infrahub#10668, part of opsmill/infrahub#10530). The SDK's generated error catalogue does not have this code yet, so the Infrahub backend-validate-generated CI job fails on opsmill/infrahub#10530 with python_sdk/infrahub_sdk/exceptions/catalogue.py is out of date with schema/error-catalogue.json.

What changed

  • Regenerated infrahub_sdk/exceptions/catalogue.py from the server's error catalogue with uv run invoke backend.generate.
  • Added WorkerTimeoutData and WorkerTimeoutError, and registered WORKER_TIMEOUT in CODE_TO_EXCEPTION, CODE_TO_DATA_MODEL and the builder mapping.
  • Exported WorkerTimeoutError from infrahub_sdk.exceptions and added it to the public_names.json snapshot.
  • Added a WORKER_TIMEOUT case to the per-code tests in tests/unit/sdk/test_error_catalogue.py, with a captured response in tests/fixtures/error_catalogue/codes/worker_timeout.json.
  • The other catalogue entries are unchanged.

How to review

catalogue.py is generated. Review it against the WORKER_TIMEOUT entry in schema/error-catalogue.json on opsmill/infrahub#10530. The fixture uses the payload and message the server builds for a connectivity check that times out.

How to test

uv run pytest tests/unit/sdk/test_error_catalogue.py tests/unit/sdk/test_exceptions_public_names.py

Once the Infrahub PR points its python_sdk submodule at this branch, its backend-validate-generated job should pass.

Checklist

  • Tests added/updated
  • Changelog entry added: not needed, because the error catalogue has not been released and +typed-per-code-exceptions.added.md already covers it
  • External docs updated (if user-facing or ops-facing change)
  • Internal .md docs updated (internal knowledge and AI code tools knowledge)