Skip to content

fix(values): preserve inferred types across null overlays - #5412

Merged
brandtkeller merged 2 commits into
zarf-dev:mainfrom
ntwkninja:fix/native-chart-schema-precedence
Sep 30, 2026
Merged

brandtkeller merged 2 commits into
zarf-dev:mainfrom
ntwkninja:fix/native-chart-schema-precedence

Conversation

@ntwkninja

@ntwkninja ntwkninja commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

Preserves types inferred from native chart defaults when later overlays are null or unknown.

Changes

  • Evaluates chart defaults, valuesFiles, and package defaults separately.
  • Preserves known types across null overlays.
  • Retains package-only null values as unconstrained properties.
  • Keeps exclusions scoped to each chart mapping
  • Keeps explicit Helm schemas authoritative.
  • Adds precedence and regression coverage.

Scope

Null or unknown overlays do not erase types inferred from native chart defaults. Concrete overlays retain existing effective-value behavior, explicit Helm schemas remain authoritative, and exclusions remain scoped per mapping.

Related Issue

Fixes #5336

Checklist before merging

@ntwkninja
ntwkninja requested review from a team as code owners September 29, 2026 15:17
@netlify

netlify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

βœ… Deploy Preview for zarf-docs canceled.

Name Link
πŸ”¨ Latest commit ffb58ec
πŸ” Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6abc06e291528a0008cad2c0

@codecov

codecov Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 14.92537% with 57 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/cmd/dev.go 0.00% 56 Missing ⚠️
src/pkg/value/generate.go 90.90% 1 Missing ⚠️
Files with missing lines Coverage Ξ”
src/pkg/value/generate.go 75.58% <90.90%> (+0.24%) ⬆️
src/cmd/dev.go 35.69% <0.00%> (-1.14%) ⬇️

... and 1 file with indirect coverage changes

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ntwkninja

ntwkninja commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Tested against Zarf’s own packages/zarf-agent chart with a temporary root values mapping. Compared with v0.86.0, the branch restores native types for affinity, mutationExclusions, nodeSelector, tolerations, and webhookAnnotations; no other schema fields changed.

@@ -3,7 +3,9 @@
   "properties": {
     "zarf-agent": {
       "properties": {
-        "affinity": {},
+        "affinity": {
+          "type": "object"
+        },
         "clusterRole": {
           "properties": {
             "name": {
@@ -45,11 +47,15 @@
           },
           "type": "object"
         },
-        "mutationExclusions": {},
+        "mutationExclusions": {
+          "type": "array"
+        },
         "mutationPolicy": {
           "type": "string"
         },
-        "nodeSelector": {},
+        "nodeSelector": {
+          "type": "object"
+        },
         "resources": {
           "properties": {
             "limits": {
@@ -123,8 +129,12 @@
           },
           "type": "object"
         },
-        "tolerations": {},
-        "webhookAnnotations": {}
+        "tolerations": {
+          "type": "array"
+        },
+        "webhookAnnotations": {
+          "type": "object"
+        }
       },
       "type": "object"
     }

Steps to repro

zarf version # v0.86.0
make

zarf tools yq -i \
  '.components[0].charts[0].values = [{"sourcePath": ".zarf-agent", "targetPath": "."}]' \
  "packages/zarf-agent/zarf.yaml"

args=(
  --features=values=true
  --set AGENT_IMAGE_DOMAIN=ghcr.io/
  --set AGENT_IMAGE=zarf-dev/zarf/agent
  --set AGENT_IMAGE_TAG=local
)

zarf dev generate-schema packages/zarf-agent "${args[@]}" > /tmp/v086.json
build/zarf-mac-apple dev generate-schema packages/zarf-agent "${args[@]}" > /tmp/branch.json

diff -u /tmp/v086.json /tmp/branch.json

@ntwkninja
ntwkninja force-pushed the fix/native-chart-schema-precedence branch from b70d97d to 7cdce68 Compare September 29, 2026 18:39
Signed-off-by: Gabe Scarberry <gabe@defenseunicorns.com>
Signed-off-by: Gabe Scarberry <gabe@defenseunicorns.com>
@ntwkninja
ntwkninja force-pushed the fix/native-chart-schema-precedence branch from 7cdce68 to ffb58ec Compare September 29, 2026 18:43

@brandtkeller brandtkeller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm - thanks for improving this!

@brandtkeller
brandtkeller added this pull request to the merge queue Sep 30, 2026
Merged via the queue into zarf-dev:main with commit 9213afd Sep 30, 2026
31 checks passed
sei-pearl pushed a commit to sei-pearl/zarf that referenced this pull request Oct 1, 2026
)

Signed-off-by: Gabe Scarberry <gabe@defenseunicorns.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Define schema inference precedence for chart defaults and valuesFiles

3 participants