feat(projectconfig): validate component group membership#191
Merged
Conversation
Fail config loading if any component group's explicit `components` list references a name not defined under `[components]`. All undefined references are reported together via errors.Join so a single run surfaces every issue. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds validation to ensure that any component name listed in a [component-groups.*].components array refers to a component actually defined under [components]. All offending references are aggregated via errors.Join and returned as a single error.
Changes:
- New
ErrUndefinedComponentsentinel error andvalidateComponentGroupMembershiphelper invoked fromProjectConfig.Validate(). - Existing loader tests updated to declare the components they reference in their group memberships, so they pass the new validation.
- New unit tests covering undefined member, valid reference, spec-pattern-only group, and aggregated-error cases.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/projectconfig/component.go | Defines ErrUndefinedComponent sentinel. |
| internal/projectconfig/project.go | Wires validateComponentGroupMembership into Validate() and implements the check with deterministic, aggregated error reporting. |
| internal/projectconfig/component_test.go | Adds TestValidateComponentGroupMembership covering positive, negative, spec-only, and multi-error cases. |
| internal/projectconfig/loader_test.go | Updates existing loader tests to declare referenced components so they satisfy the new validation. |
dmcilvaney
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fails project config loading if any component group's explicit
componentslist references a name not defined under[components].All undefined references are collected and reported together via
errors.Join, so a single run surfaces every issue instead of forcing a fix-run-repeat loop.Slots in alongside the existing
validatePackageGroupMembershipandvalidateImageTestReferenceschecks inProjectConfig.Validate(). New sentinelErrUndefinedComponentfollows theErrUndefinedTestSuitepattern.Tests cover: undefined member, defined member, spec-pattern-only group, and the aggregate-reporting case.