Skip to content

fix(sdk): rename Priority.NORMAL to MEDIUM to match server contract#1208

Open
fatih-acar wants to merge 1 commit into
infrahub-developfrom
fac/infrahub-develop-priority-rename-7n5gi
Open

fix(sdk): rename Priority.NORMAL to MEDIUM to match server contract#1208
fatih-acar wants to merge 1 commit into
infrahub-developfrom
fac/infrahub-develop-priority-rename-7n5gi

Conversation

@fatih-acar

@fatih-acar fatih-acar commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

The Infrahub API backpressure layer renamed its middle X-Priority tier from normal to medium (opsmill/infrahub#9879) and now parses the header against enum member names. An SDK client emitting normal no longer matches any tier, so background flows (artifact generation, generators, diffs) crash with ValueError: 'medium' is not a valid Priority. This renames the SDK's Priority enum to keep the emitted header aligned with the server contract.

Key Changes

  • The SDK now emits X-Priority: high | medium | low, matching the server's tiers — background workflows that carry a request priority no longer error.
  • Priority.NORMALPriority.MEDIUM (wire value "normal""medium") in infrahub_sdk.constants. The feature is unreleased, so no backward-compatible NORMAL alias is kept.
  • Config.priority description, the regenerated config.mdx reference, and the unreleased changelog fragment updated to high|medium|low.
  • Priority / config / relogin unit tests updated for the new member and the pydantic validation message.
  • The ihs-259 design docs under dev/specs/ re-titled normalmedium.

Related Context

Server-side counterpart: opsmill/infrahub#9879 (IFC-2886). The tier rename is documented in that PR's "Update since original description" section.

Documentation Updates

  • docs/docs/python-sdk/reference/config.mdx regenerated.
  • changelog/1151.added.md (unreleased X-Priority fragment) updated.
  • dev/specs/ihs-259-sdk-x-priority-header/* design docs updated.

Test Plan

  • uv run invoke format lint-code — ruff, ty, mypy clean.
  • uv run invoke lint-docs — rumdl clean.
  • uv run pytest tests/unit/sdk/test_priority.py tests/unit/sdk/test_config.py tests/unit/sdk/test_relogin_headers.py — 91 passed.
  • CI to watch: validate-generated-documentation (the regenerated config reference is committed).

Summary by cubic

Renamed the SDK’s middle priority from NORMAL to MEDIUM and now emit X-Priority: high|medium|low to match the server contract. This fixes crashes in background workflows caused by the server expecting medium.

  • Bug Fixes
    • Updated Priority enum in infrahub_sdk/constants.py: NORMALMEDIUM (wire value "medium").
    • Synced Config.priority docs and descriptions to high|medium|low.
    • Adjusted tests and validation messages to the new value.
    • Updated specs and the unreleased changelog.

Written for commit 3ba71b4. Summary will update on new commits.

Review in cubic

The Infrahub API backpressure layer (opsmill/infrahub#9879) renamed the
middle X-Priority tier from `normal` to `medium`, and the server now
parses the header against enum member names. An SDK emitting `normal` no
longer resolves, so background flows raised
`ValueError: 'medium' is not a valid Priority`.

Rename the SDK `Priority` enum's middle member to `MEDIUM`/`medium` so the
emitted X-Priority header matches the server's high/medium/low contract.
The feature is unreleased, so no backward-compatible alias is kept.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@fatih-acar
fatih-acar requested a review from a team as a code owner July 23, 2026 10:42
@fatih-acar fatih-acar added the type/bug Something isn't working as expected label Jul 23, 2026
@github-actions github-actions Bot added the type/documentation Improvements or additions to documentation label Jul 23, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3ba71b4
Status: ✅  Deploy successful!
Preview URL: https://c7ffdcb0.infrahub-sdk-python.pages.dev
Branch Preview URL: https://fac-infrahub-develop-priorit.infrahub-sdk-python.pages.dev

View logs

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@                 Coverage Diff                  @@
##           infrahub-develop    #1208      +/-   ##
====================================================
- Coverage             83.98%   83.17%   -0.82%     
====================================================
  Files                   139      139              
  Lines                 14390    12437    -1953     
  Branches               2381     1852     -529     
====================================================
- Hits                  12085    10344    -1741     
+ Misses                 1654     1528     -126     
+ Partials                651      565      -86     
Flag Coverage Δ
integration-tests 40.29% <0.00%> (-2.39%) ⬇️
python-3.10 56.91% <0.00%> (-1.74%) ⬇️
python-3.11 56.91% <0.00%> (-1.74%) ⬇️
python-3.12 56.91% <0.00%> (-1.72%) ⬇️
python-3.13 56.93% <0.00%> (-1.72%) ⬇️
python-3.14 56.91% <0.00%> (-1.74%) ⬇️
python-filler-3.12 22.51% <100.00%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/config.py 91.46% <ø> (-3.30%) ⬇️
infrahub_sdk/constants.py 93.33% <100.00%> (-1.12%) ⬇️

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 17 files

Re-trigger cubic

@dgarros

dgarros commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@fatih-acar this is already covered in #1205
I think we should close this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/bug Something isn't working as expected type/documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants