feat: add IPAddress attribute kind for bare IP addresses [INFP-551]
Summary
Adds a new IPAddress attribute kind for storing bare IP addresses (IPv4 or IPv6) with no netmask/prefix, alongside the existing IPHost and IPNetwork kinds. Resolves the recurring pain of IPHost silently appending /32·/128 for data that has no subnet context (DNS records, NTP/syslog/SNMP server addresses, monitoring targets, etc.), and sidesteps the mask-inconsistency class of bug (#8896) for bare-IP use cases.
Implements INFP-551 (targets the 1.11 release). Built via the Spec Kit flow — spec/plan/tasks/research live in dev/specs/infp-551-ipaddress-attribute-kind/.
| Kind | Python mapping | Stores | Example |
|---|---|---|---|
IPAddress (new) | ipaddress.ip_address | bare IP, no prefix | 192.168.1.1 |
IPHost | ipaddress.ip_interface | IP + prefix | 192.168.1.1/24 |
IPNetwork | ipaddress.ip_network | network + prefix | 192.168.1.0/24 |
Design decision — dedicated DB node type
IPAddress gets its own AttributeIPAddress graph value-node label (not a reuse of AttributeIPHost), with its own binary_address RANGE index and write-path Cypher, storing value + version + binary_address but no prefixlen. This keeps bare addresses self-describing in the graph and preserves range/containment querying. See dev/knowledge/backend/database-schema.md.
Changes
Backend
types.py: register theIPAddressdata type;core/attribute.py:IPAddress/IPAddressOptionalclasses (validate as IP, reject any/).- Dedicated storage:
AttributeDBNodeType.IPADDRESSflag,GraphAttributeIPAddress*graph schema node,attr_ipaddress_binindex, write/update-path Cypher. - GraphQL
IPAddresstype (value,version). GRAPH_VERSION74 → 75 + migrationm075creating the index (no data backfill — new label applies to new writes only).
Frontend
- Additive kind constant + list-view membership, icon, and input/display/table-cell/filter switch cases (plain text input, no prefix selector). Regenerated GraphQL types.
Docs
- Attribute-kinds reference (regenerated) +
nodes-and-attributestopic + adev/knowledge/backendnote on the new DB node type.
Testing
- Backend: 1844 unit tests pass; component tests for attribute validation/
to_db, node DB round-trip + filtering, GraphQL query + HFID round-trip, create-mutation prefix rejection, graph constraints, and them075migration. - Frontend: list-view unit test; biome + betterer clean.
- End-to-end on a locally-built image + the Python SDK: an
IPAddressattribute reads back as a bareIPv4Address/IPv6Address, whileIPHost/IPNetworkstill return prefixed objects (no regression).
Cross-repo / merge order
The Python SDK companion change is opsmill/infrahub-sdk-python#1190 (base infrahub-develop). Per the submodule rules, this PR does not yet bump the python_sdk pointer — that lands as a follow-up commit here once #1190 is merged.
Out of scope
Bulk data-migration tooling to convert existing IPHost /32·/128 attributes into IPAddress (the generic attribute-kind-change path still works for a manual change).
🤖 Generated with Claude Code
Summary by cubic
Adds a new IPAddress attribute kind for storing bare IPv4/IPv6 addresses (no prefix), fixing the /32//128 suffix issue with IPHost and meeting INFP-551’s requirement to handle IPs with no subnet context.
-
New Features
- Backend:
IPAddressattribute with strict validation (rejects any/), dedicatedAttributeIPAddressvalue node andbinary_addressRANGE index; query/utils wiring for binary range lookups. - GraphQL: new
IPAddresstype exposingvalueandversion. - Frontend: added
IPAddresskind, icon, and input/display/filter handling; regenerated GraphQL types, includinggraphql-env.d.tsandgraphql-cache.d.ts(gql.tada). - Docs/specs and tests updated; added DB constraint assertions for
AttributeIPAddress; GraphQL types regenerated.
- Backend:
-
Migration
- Graph version bumped to 75 with migration
m075creating theattr_ipaddress_binindex. - No data backfill; new label applies to new writes only.
- Run standard migrations; no breaking changes for existing
IPHost/IPNetwork.
- Graph version bumped to 75 with migration