Skip to content

Expose registered mutations and firing-set; export golden serializer#136

Merged
sourcehawk merged 6 commits into
feature/version-matrix-goldensfrom
pr/132-mutation-introspection
Jun 1, 2026
Merged

Expose registered mutations and firing-set; export golden serializer#136
sourcehawk merged 6 commits into
feature/version-matrix-goldensfrom
pr/132-mutation-introspection

Conversation

@sourcehawk
Copy link
Copy Markdown
Owner

Towards #132

Description

Adds the read-only framework introspection surface and golden serializer export that the version-matrix golden generator (later sub-PRs) builds on. No reconcile-path behavior changes; every addition is an inert getter or a thin wrapper.

What changed

  • New concepts.MutationInspector interface (pkg/component/concepts/mutation_inspector.go): RegisteredMutations() []string and FiringSet() ([]string, error).
  • Implemented on generic.BaseResource: iterates its existing Mutations. A nil Feature fires unconditionally; otherwise Feature.Enabled() decides. RegisteredMutations dedupes in registration order; FiringSet preserves registration order and propagates gate errors wrapped with the mutation name.
  • Implemented on *component.Component as the deduplicated union across managed (non read-only) resources, mirroring the Preview iteration. Read-only resources and resources that do not implement the interface contribute nothing; a managed resource's FiringSet error is wrapped with the resource identity and propagated.
  • Delegation block plus a var _ concepts.MutationInspector = (*Resource)(nil) compile-time assertion on every primitive Resource (all 21 single-kind primitives and the 4 unstructured sub-resources: static, task, workload, integration). The assertion makes a missed primitive a build failure.
  • Exported golden.Serialize(obj, scheme) and golden.SerializeComponent(objs, scheme) as thin wrappers over the existing private serializeObject. Refactored CompareComponentYAML to reuse SerializeComponent (DRY); output stays byte-identical.

New public surface

  • concepts.MutationInspector interface { RegisteredMutations() []string; FiringSet() ([]string, error) }
  • golden.Serialize(client.Object, *runtime.Scheme) ([]byte, error)
  • golden.SerializeComponent([]client.Object, *runtime.Scheme) ([]byte, error)

Testing

  • TDD throughout (failing test first, then minimal implementation) for BaseResource, Component, the statefulset anchor, and the golden serializer.
  • BaseResource: dedup, nil-gate-fires, enabled/disabled gates, gate-error propagation.
  • Component: union of registered mutations and firing-sets, read-only exclusion, error propagation.
  • Primitives: statefulset satisfies the interface and reports its firing-set; the var _ assertions cover the remaining 24 resource types at compile time.
  • Golden: Serialize is byte-identical to what CompareYAML writes; SerializeComponent joins multi-document YAML identically to CompareComponentYAML; existing golden tests still pass.
  • make all is green (fmt, lint, test, test-examples, build-examples).

sourcehawk and others added 6 commits June 1, 2026 03:15
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…#132)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rce (#132)

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 added a commit that referenced this pull request Jun 1, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sourcehawk sourcehawk merged commit 3a43546 into feature/version-matrix-goldens Jun 1, 2026
2 of 3 checks passed
@sourcehawk sourcehawk deleted the pr/132-mutation-introspection branch June 1, 2026 01:24
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