Skip to content

fix(experimental): make circuit_service and modules_routing_engine loadable - #79

Open
minitriga wants to merge 2 commits into
mainfrom
atg-fix-experimental-schema-load-errors
Open

fix(experimental): make circuit_service and modules_routing_engine loadable#79
minitriga wants to merge 2 commits into
mainfrom
atg-fix-experimental-schema-load-errors

Conversation

@minitriga

Copy link
Copy Markdown
Contributor

What

Two experimental extensions cannot be loaded into Infrahub at all. Both are published to the Infrahub marketplace, where they break the install check for the infrahub/circuits-peering and infrahub/physical-cabling Collections.

experimental/circuit_service

Unable to load the schema:
  Unable to find the schema 'CircuitEndpoint' in the registry

CircuitEndpoint is defined in extensions/circuit/circuit.yml:82 with namespace: Dcim, so its resolved kind is DcimCircuitEndpoint — which is exactly how circuit.yml:77 refers to it. circuit_service.yml referenced it bare in two places, so the reference never resolved.

experimental/modules_routing_engine

Unable to load the schema:
  DeviceRoutingEngine.order_by: name is not a valid attribute of DcimPhysicalDevice

DeviceRoutingEngine inherits device from DeviceGenericModule, which peers to the DcimPhysicalDevice generic (extensions/modules/modules.yml:61). That generic carries position, serial and rack_facename lives on DcimGenericDevice. Both human_friendly_id and order_by traversed device__name__value.

Adding name to DcimPhysicalDevice is not a viable fix: nodes inherit both generics (base/dcim.yml:429-430), so it would collide with the existing attribute.

So:

  • human_friendly_idserial_number__value, matching the node's own uniqueness constraint and the DeviceGenericModule default. The old value had no uniqueness constraint behind it either way — the device/slot one is commented out.
  • order_bydevice__serial__value, keeping the grouping-by-device intent using an attribute the declared peer actually has. This mirrors how the sibling linecards extension orders through a parent (linecard__serial_number__value).

DeviceLinecard inherits the same generic but never traverses device__name__value, so it is unaffected — as are patch_panel, dwdm and optical_transport, which inherit DcimPhysicalDevice without that traversal.

Why CI never caught this

invoke schemas.load-all-schemas skips everything under experimental/ unless TEST_EXPERIMENTAL is set (tasks/schemas.py:92), and CI does not set it. These extensions are published to the marketplace regardless, so the only place the breakage surfaces is downstream. Worth deciding separately whether the load test should cover experimental/ — this PR does not change that.

Verification

Ran infrahubctl schema check over each extension's full transitive dependency closure (from .metadata.yml, matching what the marketplace ships as the Collection bundle) against a throwaway Infrahub via infrahub-testcontainers:

Extension before after
experimental/circuit_service Unable to find the schema 'CircuitEndpoint'
experimental/modules_routing_engine DeviceRoutingEngine.order_by: name is not a valid attribute

Both errors reproduced verbatim against unfixed main first, so the check is not vacuous. infrahubctl schema check always exits 0, so the assertion greps the output for load-error text.

Reference docs regenerated with invoke docs.generate. That command also produces unrelated diffs in dcim.mdx, security.mdx, lag.mdx, mlag.mdx, sfp.mdx, optical_transport.mdx, circuit_contract.mdx and home.mdx from earlier commits that did not regenerate; those are left out of this PR. Note the check-documentation job diffs docs/reference/ while the files live in docs/docs/reference/, so that drift currently goes unnoticed.

Downstream

Unblocks opsmill/infrahub-marketplace#110 and opsmill/infrahub-marketplace#116, the two known reds in that repo's Collection install check. They clear once this lands and the schema-library sync re-publishes.


🤖 Generated with Claude Code

minitriga and others added 2 commits August 18, 2026 14:01
`CircuitEndpoint` is defined in extensions/circuit with `namespace: Dcim`,
so its resolved kind is `DcimCircuitEndpoint` — which is how circuit.yml
itself references it. circuit_service referenced it bare, so the reference
never resolved and the extension could not load:

    Unable to load the schema:
      Unable to find the schema 'CircuitEndpoint' in the registry

Verified with `infrahubctl schema check` over the extension's full
dependency closure against a throwaway Infrahub: red before, green after.

Refs opsmill/infrahub-marketplace#110

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`DeviceRoutingEngine` inherits its `device` relationship from
`DeviceGenericModule`, which peers to the `DcimPhysicalDevice` generic.
That generic carries `position`, `serial` and `rack_face` — but no `name`,
which lives on `DcimGenericDevice`. Both the human_friendly_id and the
order_by traversed `device__name__value`, so the extension could not load:

    Unable to load the schema:
      DeviceRoutingEngine.order_by: name is not a valid attribute of
      DcimPhysicalDevice

Adding `name` to `DcimPhysicalDevice` is not an option: nodes inherit both
generics, so it would collide with the existing attribute.

- human_friendly_id becomes `serial_number__value`, matching the node's own
  uniqueness constraint and the DeviceGenericModule default. The old value
  was not backed by a uniqueness constraint either way — the device/slot one
  is commented out.
- order_by keeps grouping by device, via `device__serial__value`, which the
  declared peer does have. This mirrors how the sibling linecards extension
  orders through a parent (`linecard__serial_number__value`).

Verified with `infrahubctl schema check` over the extension's full
dependency closure against a throwaway Infrahub: red before, green after.

Refs opsmill/infrahub-marketplace#116

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying schema-library with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1b9aca0
Status: ✅  Deploy successful!
Preview URL: https://d4b058cb.schema-library.pages.dev
Branch Preview URL: https://atg-fix-experimental-schema.schema-library.pages.dev

View logs

@PhillSimonds PhillSimonds left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

- serial_number__value
order_by:
- device__name__value
- device__serial__value

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Routing engine is serial_number__value where this is serial__value. Probably a very negligable thing, but it might be nice to make that consistent

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.

2 participants