Skip to content

test(generate): add absolute byte-identical baseline gate for single-component output - #515

Merged
joshua-temple merged 1 commit into
mainfrom
feat/byte-identical-gate
Jul 8, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
feat/byte-identical-gate

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

The single-component byte-identical invariant is the load-bearing guarantee of the monorepo campaign, but every existing check is a RELATIVE oracle (regenerate and compare, so got and want move together). A template edit that changes single-component output would pass all of them undetected.

Fix

Add an ABSOLUTE snapshot gate, TestByteIdenticalBaseline_SingleComponent (internal/generate/byte_identical_baseline_test.go). For a realistic multi-env single-component manifest (builds, deploys, external, promote, release-publish, hotfix, rollback) it asserts:

  • each emitted file is byte-for-byte equal to a committed golden under internal/generate/testdata/byte_identical_baseline/,
  • the emitted and golden file sets match exactly,
  • no components-keyed artifact appears (no orchestrate-*.yaml, exactly one orchestrate.yaml, no namespaced name, no top-level components:).

It reds on any single-component byte drift, proven both by flipping a golden byte and by hiding a golden. Regenerate with -update.

Test and fixtures only; no production change.

Verification

go build ./..., go test ./... (2562 pass), go test ./... -race (2562 pass), golangci-lint run ./... clean.

Refs #285.

…component output

The prior single-component byte-identical checks are all relative oracles (regenerate and compare, so got and want move together): a template edit passes them all. This adds an absolute snapshot gate, TestByteIdenticalBaseline_SingleComponent, that asserts a realistic multi-env single-component manifest emits output byte-for-byte equal to committed golden fixtures, that the emitted and golden file sets match exactly, and that no components-keyed artifact appears. It reds on any single-component byte drift (proven both by flipping a golden byte and by hiding one). Test and fixtures only; no production change. Regenerate with -update.

Refs #285.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit 50b6223 into main Jul 8, 2026
20 checks passed
@joshua-temple
joshua-temple deleted the feat/byte-identical-gate branch July 8, 2026 04:13
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.

1 participant