Skip to content

feat(lint): add dedicated selector regex validation phase#66

Merged
ghaskins merged 1 commit intomanetu:mainfrom
ghaskins:regex-validation
Apr 8, 2026
Merged

feat(lint): add dedicated selector regex validation phase#66
ghaskins merged 1 commit intomanetu:mainfrom
ghaskins:regex-validation

Conversation

@ghaskins
Copy link
Copy Markdown
Contributor

@ghaskins ghaskins commented Apr 8, 2026

Previously, invalid regex patterns in operation/mapper/resource selector fields were only caught by the parser, surfacing as a generic "failed to load PolicyDomain" error with no entity context or line info.

This adds a new Phase 1.5 (lintSelectors) that walks the YAML node tree and validates each selector pattern individually, emitting structured Diagnostic entries with entity type, ID, Field="selector", and the exact YAML line number of the offending pattern.

Introduces SourceSelector as a new diagnostic source constant and covers the new phase with 19 tests across unit and integration paths.

Previously, invalid regex patterns in operation/mapper/resource
selector fields were only caught by the parser, surfacing as a generic
"failed to load PolicyDomain" error with no entity context or line info.

This adds a new Phase 1.5 (lintSelectors) that walks the YAML node tree
and validates each selector pattern individually, emitting structured
Diagnostic entries with entity type, ID, Field="selector", and the
exact YAML line number of the offending pattern.

Introduces SourceSelector as a new diagnostic source constant and
covers the new phase with 19 tests across unit and integration paths.

Signed-off-by: Greg Haskins <greg@manetu.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 87.69231% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/policydomain/lint/selector.go 87.50% 4 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Contributor

@muralisrini muralisrini left a comment

Choose a reason for hiding this comment

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

lgtm

@ghaskins ghaskins merged commit 66f9c70 into manetu:main Apr 8, 2026
17 checks passed
@ghaskins ghaskins deleted the regex-validation branch April 8, 2026 14:48
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.

2 participants