Skip to content

feat(helm): render canonicalization and the contentDigest/inputDigest split (#1237) - #1889

Merged
lex00 merged 5 commits into
mainfrom
feat/1237-digest-split
Aug 25, 2026
Merged

lex00 merged 5 commits into
mainfrom
feat/1237-digest-split

Conversation

@lex00

@lex00 lex00 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1228 — Phase 2.

What

A pinned render's output now normalizes to a canonical byte form before digesting, and a render record carries two digests with different jobs.

inputDigest answers "same inputs?" cheaply. It is a sha256: over the canonical JSON of the declared inputs — chart reference, chart version, resolved values, capability facts. It is the same digest helmInstall records in the release ledger (#1243): both now delegate to one shared helper, helmInputDigest, so the two cannot drift.

contentDigest answers "same bytes on the cluster?". It is a full sha256: over the canonical rendered bytes and is the artifact identity.

They diverge exactly when a render is not a function of its declared inputs. Two renders with the same inputDigest and different contentDigests mean the chart is unstable or an input escaped declaration. renderStability(records) reads the recorded renders and names that divergence.

Canonicalization scope

Follows the epic's findings, nothing more.

  • Mapping key order is normalized (sorted). Kubernetes treats mappings as unordered, so key order is render noise. Sequence order is never touched — list order is meaningful.
  • Document order is preserved, not sorted. The epic verified document ordering is already stable across renders.
  • Duplicate documents are preserved (epic finding 11 — an aliased dependency emits the same CRD twice). Helm dedupes on install; the canonical form keeps both, and per-document order-preserving canonicalization keeps the digest stable.
  • The helm-inserted # Source: header survives as each document's leading line (it is the origin-routing key). CRLF endings, trailing whitespace, other comments, and empty or comment-only documents do not.
  • A document that fails to parse is kept verbatim rather than dropped — the canonical form never silently loses content.

Gate

Only pinned renders (capability profile present — the v1 gate) record digests. An unpinned render's bytes depend on the local helm binary's defaulted capabilities, so a digest over them would assert an identity the render does not have; unpinned renders record neither. The classifier (#1234) is not forced into the render path — it needs chart source on disk, which a repo-fetched render does not keep.

The 16-hex cache key stays as it was, cache lookup only, so existing caches remain valid.

Stack

Stacked on #1886 (feat/1235-capability-profiles) — the HelmRenderRecord / getHelmRenderRecords() seam and the profile plumbing come from there. That branch predates #1243/#1234 on main, so this branch also merges origin/main to reach helmInstallInputDigest; the base-branch diff shows those main commits until #1886 lands. If the base branch goes away, this rebases onto main.

Tests

  • Canonical form stable across two pinned renders of the deterministic fixture (real helm), digests equal, renderStability reports stable
  • Digests recorded only when pinned; unpinned renders record neither
  • inputDigest equals helmInstallInputDigest for the same inputs (both sides of the shared helper)
  • contentDigest and inputDigest both move when values change
  • Same input, different content flagged by renderStability; different release names never grouped
  • Document-order preservation, sequence-order preservation, duplicate-document tolerance, CRLF/whitespace/comment normalization
  • Hand-written canonical form + hand-computed sha256 as a non-circular cross-machine anchor

npx vitest run lexicons/helm/src — 654 passed. npm run build -w @intentius/chant-lexicon-helm clean. just lint clean.

Closes #1237

Absorbs #1886 (its branch is this PR's base and its CI would not trigger after two pushes; the profile work rides here).

Closes #1235

@lex00
lex00 changed the base branch from feat/1235-capability-profiles to main August 25, 2026 00:09
@lex00
lex00 merged commit 3a98e6c into main Aug 25, 2026
7 checks passed
@lex00
lex00 deleted the feat/1237-digest-split branch August 25, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(helm): render canonicalization + contentDigest/inputDigest split feat(helm): per-cluster capability profile as declared render inputs

1 participant