Skip to content

fix(schema): make number_pool_id a read-only NumberPool parameter - #1466

Merged
ajtmccarty merged 1 commit into
infrahub-release-1.12from
ajtm-ifc-3381-number-pool-id-read-only
Oct 30, 2026
Merged

ajtmccarty merged 1 commit into
infrahub-release-1.12from
ajtm-ifc-3381-number-pool-id-read-only

Conversation

@ajtmccarty

@ajtmccarty ajtmccarty commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Human summary

we want to block/ignore changes to parameters.number_pool_id on NumberPool attributes in the schema. only Infrahub should modify this value.

Why

A team that loads a schema containing the number_pool_id of a NumberPool attribute can end up with an attribute that points to a pool that does not exist. This happens with a schema exported from another instance, or with an attribute copied from an existing one. If the attribute has no pool yet, the server stores the submitted id. The schema synchronizer then never creates a pool for the attribute, and every create of that kind fails (IFC-3381).

Only the server's schema synchronizer should assign this id. This PR makes number_pool_id a read-only field of the write contract. The Infrahub server already drops read-only fields on a schema load and returns a warning for each one.

Closes IFC-3381 together with opsmill/infrahub#11297.

What changed

  • NumberPoolParametersWrite no longer declares number_pool_id.
  • READ_ONLY_FIELDS lists number_pool_id for NumberPoolParametersWrite. Validating a schema file that sets it reports 'parameters.number_pool_id' is a read-only field, the submitted value is ignored. It is no longer accepted as a writable field.
  • NumberPoolParametersRead still has number_pool_id, so reading a schema from the server still returns the pool id.

How to review

Both files under infrahub_sdk/schema/generated/ are generated by uv run invoke backend.generate in the Infrahub repository, from tasks/backend.py. The generator change is in opsmill/infrahub#11297.

Impact & rollout

Checklist

🤖 Generated with Claude Code

Only the server's schema synchronizer assigns the pool of a NumberPool
attribute. A schema file that carries the id, for example one exported
from another instance, now validates with a read-only warning and the
server ignores the value instead of storing an id that points to no pool.

Regenerated from the Infrahub generator (tasks/backend.py).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying infrahub-sdk-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2a31f71
Status: ✅  Deploy successful!
Preview URL: https://c5ad6b8f.infrahub-sdk-python.pages.dev
Branch Preview URL: https://ajtm-ifc-3381-number-pool-id.infrahub-sdk-python.pages.dev

View logs

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@                    Coverage Diff                    @@
##           infrahub-release-1.12    #1466      +/-   ##
=========================================================
- Coverage                  87.74%   87.74%   -0.01%     
=========================================================
  Files                        155      155              
  Lines                      15518    15517       -1     
  Branches                    2085     2085              
=========================================================
- Hits                       13616    13615       -1     
  Misses                      1345     1345              
  Partials                     557      557              
Flag Coverage Δ
integration-tests 42.52% <ø> (+<0.01%) ⬆️
python-3.10 62.53% <ø> (+<0.01%) ⬆️
python-3.11 62.53% <ø> (+<0.01%) ⬆️
python-3.12 62.54% <ø> (+0.01%) ⬆️
python-3.13 62.54% <ø> (+0.01%) ⬆️
python-3.14 62.54% <ø> (+<0.01%) ⬆️
python-3.15 62.54% <ø> (+0.01%) ⬆️
python-filler-3.12 23.16% <ø> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
infrahub_sdk/schema/generated/contract.py 100.00% <ø> (ø)
infrahub_sdk/schema/generated/write.py 99.40% <ø> (-0.01%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ajtmccarty
ajtmccarty marked this pull request as ready for review October 29, 2026 22:35
@ajtmccarty
ajtmccarty requested a review from a team as a code owner October 29, 2026 22:35
@ajtmccarty
ajtmccarty merged commit 63e3bd6 into infrahub-release-1.12 Oct 30, 2026
32 checks passed
@ajtmccarty
ajtmccarty deleted the ajtm-ifc-3381-number-pool-id-read-only branch October 30, 2026 14:33
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants