Skip to content

bug: object get silently omits Generic-kind many relationships from its output #1275

Description

@lancamat1

Component

infrahubctl

Infrahub SDK version

1.23.0

Current Behavior

infrahubctl object get <kind> does not include cardinality-many relationships of kind Generic in its output — in any output format, even though list mode queries with prefetch_relationships=True. The SDK's query generation only includes many relationships of kind Attribute or Parent by default, and the object get command never passes include for the others.

Example with a TestingPerson node whose animals relationship (cardinality many, kind Generic) has three peers:

---
apiVersion: infrahub.app/v1
kind: Object
spec:
  kind: TestingPerson
  data:
  - name: Ethan Carter
    height: 185

The animals relationship is missing entirely — there is no indication in the output or on stderr that data was skipped.

Note: this is about the relationship kind Generic (the default kind for a relationship in the schema), not about the peer being a generic schema. The peers here are real, instantiated nodes (TestingCat/TestingDog inheriting TestingAnimal).

Expected Behavior

An export intended to be reloadable (object get --output yaml > backup.yml, as shown in the command's own help text) should carry the object's relationships, or at minimum make it visible that some relationships were not exported. Silent omission means a get → load round-trip quietly loses relationship data.

Steps to Reproduce

  1. Load a schema where a node kind has a cardinality-many relationship of kind Generic (e.g. TestingPerson.animals from the SDK's testing schemas).
  2. Create a person and several animals owned by that person.
  3. infrahubctl object get TestingPerson --output yaml
  4. The output contains only attributes; animals is absent.

Reproduced end-to-end with infrahub-testcontainers.

Additional Information

  • Related: bug: object get YAML output is not loadable by object load (many relationships exported as invalid nested data dict) #1274 (many relationships that are exported use a format object load rejects). Together these two issues currently prevent a faithful get → load round-trip.
  • Origin of the behavior: generate_query_data_node (infrahub_sdk/node/node.py) skips many relationships whose kind is not Attribute/Parent unless they are explicitly listed in include; object get (infrahub_sdk/ctl/object/get.py) doesn't pass include. The SDK default is likely a deliberate performance choice (many-rels can be huge), so the gap is in how object get uses it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions