Skip to content

Add optional YAML matrix loader for goldengen#138

Merged
sourcehawk merged 1 commit into
feature/version-matrix-goldensfrom
pr/135-yaml-loader
Jun 1, 2026
Merged

Add optional YAML matrix loader for goldengen#138
sourcehawk merged 1 commit into
feature/version-matrix-goldensfrom
pr/135-yaml-loader

Conversation

@sourcehawk
Copy link
Copy Markdown
Owner

Towards #135

Adds LoadMatrix, an optional YAML-driven entry point for the goldengen version matrix. It reads a matrix file that mirrors Config without its Go-only fields and returns a Config ready to run, with Build and Scheme supplied as arguments.

Behaviour

  • Top level mirrors Config: dir, versions, exclude, fixtures.
  • Each fixture sets exactly one of spec (inline CR) or specFile (path relative to the matrix file). Both-set or neither-set is a load error.
  • Each fixture spec is unmarshalled into a fresh typed spec from newSpec. The inline spec is captured as json.RawMessage (sigs.k8s.io/yaml has already converted YAML to JSON), which round-trips nested fields cleanly into the typed spec.
  • requires / forbids carry name and optional for.
  • The assembled Config is validated via Config.Validate before returning, so invariants such as for not being a member of versions are enforced.

Tests

Table-driven coverage for inline load, specFile load with relative resolution, both-set error, neither-set error, for-not-in-versions error, missing file error, and that the produced Config is runnable end to end (build a unit and render it).

make all passes.

Add LoadMatrix, which reads a YAML matrix file and returns a runnable
Config. Each fixture's CR comes from an inline spec or an external
specFile (exactly one), unmarshalled into a fresh typed spec. specFile
paths resolve relative to the matrix file. The result is validated via
Config.Validate before returning.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sourcehawk sourcehawk merged commit d376921 into feature/version-matrix-goldens Jun 1, 2026
2 of 3 checks passed
@sourcehawk sourcehawk deleted the pr/135-yaml-loader 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