Skip to content

feat(projectconfig): validate component group membership#191

Merged
reubeno merged 1 commit into
microsoft:mainfrom
reubeno:checks
May 14, 2026
Merged

feat(projectconfig): validate component group membership#191
reubeno merged 1 commit into
microsoft:mainfrom
reubeno:checks

Conversation

@reubeno
Copy link
Copy Markdown
Member

@reubeno reubeno commented May 14, 2026

Fails project config loading if any component group's explicit components list 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 validatePackageGroupMembership and validateImageTestReferences checks in ProjectConfig.Validate(). New sentinel ErrUndefinedComponent follows the ErrUndefinedTestSuite pattern.

Tests cover: undefined member, defined member, spec-pattern-only group, and the aggregate-reporting case.

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>
Copilot AI review requested due to automatic review settings May 14, 2026 03:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ErrUndefinedComponent sentinel error and validateComponentGroupMembership helper invoked from ProjectConfig.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.

@reubeno reubeno merged commit ab4a158 into microsoft:main May 14, 2026
20 checks passed
@reubeno reubeno deleted the checks branch May 14, 2026 04:47
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.

3 participants