feat: clear a schema value by loading an explicit null [IFC-3337]

Draft
OG
2d ago
+1193-0

Why

A schema author who sets a value on an attribute or relationship in a schema file, such as parameters.regex, cannot remove it by loading the schema again, on main or on a branch. Removing the key or setting it to null changes nothing, and infrahubctl reports that the schema is already up to date. IFC-3337 reports the problem.

This branch, schema-null-clears-ifc-3337, is the feature branch for IFC-3337. This pull request contains only the spec-kit files for the feature. The implementation will be added to this branch, and this pull request stays a draft until it is.

Spec-kit files in dev/specs/ifc-3337-schema-null-clears/

  • spec.md: user stories, requirements FR-001 to FR-012 and success criteria SC-001 to SC-005.
  • plan.md, research.md (Decisions 1 to 9), data-model.md and contracts/schema-load.md: where a null is lost today, how the load records and applies it, and how the merge, rebase and proposed-change checks use a cleared value.
  • tasks.md: 44 tasks across the Infrahub repository and the python_sdk submodule.
  • quickstart.md and checklists/requirements.md: manual validation scenarios and the requirements checklist.

Planned behavior changes

  • A null on parameters (or a field inside it), default_value, computed_attribute or enum on an attribute, or on common_parent on a relationship, removes the stored value. A null on any other field is ignored, as today, and the load response contains an ignored_value warning.
  • A missing key keeps the stored value, as today. When the file lists the attribute or relationship, the load response contains a kept_value warning.
  • A missing optional key keeps the stored value. Making an attribute required needs optional: false.
  • infrahubctl schema export and infrahubctl schema format --strip-defaults keep optional: false on attributes.
  • A Git repository sync logs the load warnings in its task log.

How to review

Start with spec.md, then research.md Decision 3, which describes where the load applies the clears, and Decision 7, which describes the merge, rebase and proposed-change checks.

Impact and rollout

  • No code, schema or API change in this pull request yet.
  • The implementation needs a separate pull request on the SDK's infrahub-develop branch, which adds the two new warning types and the optional: false change. That pull request merges before this one, and SDK and infrahubctl releases older than it cannot parse the new warning types.