feat: clear a schema value by loading an explicit null [IFC-3337]
Draft
OG
2d ago+1193+1193+0123456789012345678901234567890123456789-0-0-0123456789
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.mdandcontracts/schema-load.md: where anullis 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 thepython_sdksubmodule.quickstart.mdandchecklists/requirements.md: manual validation scenarios and the requirements checklist.
Planned behavior changes
- A
nullonparameters(or a field inside it),default_value,computed_attributeorenumon an attribute, or oncommon_parenton a relationship, removes the stored value. Anullon any other field is ignored, as today, and the load response contains anignored_valuewarning. - A missing key keeps the stored value, as today. When the file lists the attribute or relationship, the load response contains a
kept_valuewarning. - A missing
optionalkey keeps the stored value. Making an attribute required needsoptional: false. infrahubctl schema exportandinfrahubctl schema format --strip-defaultskeepoptional: falseon 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-developbranch, which adds the two new warning types and theoptional: falsechange. That pull request merges before this one, and SDK andinfrahubctlreleases older than it cannot parse the new warning types.