Skip to content

Add goldengen accounting assertion, worked example, and testing docs#139

Merged
sourcehawk merged 3 commits into
feature/version-matrix-goldensfrom
pr/134-accounting-docs
Jun 1, 2026
Merged

Add goldengen accounting assertion, worked example, and testing docs#139
sourcehawk merged 3 commits into
feature/version-matrix-goldensfrom
pr/134-accounting-docs

Conversation

@sourcehawk
Copy link
Copy Markdown
Owner

Towards #134.

Completes the goldengen feature with its completeness check, a runnable example, and the testing documentation.

What this adds

  • AssertComplete accounting on *Generator[T]. Called from a consumer's TestMain as os.Exit(gen.AssertComplete(m.Run())), it proves the universe of registered mutation names across all fixtures equals union(Requires names) ∪ Exclude. It returns the incoming code unchanged when the tests already failed or accounting holds; otherwise it prints the violations (unaccounted mutation, stale Exclude/Requires name, empty name) to stderr and returns nonzero. Registration is version-independent, so each fixture is built once to gather the registered set.
  • Worked example under examples/version-matrix/: a StatefulSet built through goldengen with three version-gated mutations over the shared ExampleApp CRD. It exercises Run (with a -update flag wired through WithUpdate) and AssertComplete from TestMain. The committed testdata/ shows the two generated regime goldens and the coverage manifest for the version universe 8.7.0, 8.8.2, 8.9.0.
  • docs/testing.md: the golden helpers (AssertYAML/AssertComponentYAML/Serialize/SerializeComponent) and the full goldengen workflow (matrix declaration, the four Requires/Forbids assertions, firing-set classification with a diagram, the ascending version-ordering convention, the manifest, and the LoadMatrix YAML loader). Linked from the README documentation table.

Verification

make all and make build-examples both pass.

Note: the LoadMatrix section documents the loader that ships in the sibling PR (#135) against its locked signature, so the feature's documentation is complete in one place.

🤖 Generated with Claude Code

sourcehawk and others added 3 commits June 1, 2026 03:46
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sourcehawk sourcehawk merged commit 0fe4fcd into feature/version-matrix-goldens Jun 1, 2026
2 of 3 checks passed
@sourcehawk sourcehawk deleted the pr/134-accounting-docs branch June 1, 2026 01:57
sourcehawk added a commit that referenced this pull request Jun 1, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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