Improve FunctionConfig related validation errors#4512
Open
mozesl-nokia wants to merge 2 commits intokptdev:mainfrom
Open
Improve FunctionConfig related validation errors#4512mozesl-nokia wants to merge 2 commits intokptdev:mainfrom
mozesl-nokia wants to merge 2 commits intokptdev:mainfrom
Conversation
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
25bec25 to
d270969
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves user-facing validation errors when a configPath-based functionConfig cannot be found, replacing the prior vague message with more actionable context. It also refactors pipeline validation to deduplicate error construction and updates e2e expected outputs accordingly.
Changes:
- Reword
functionConfigopen/validation errors to include the configured path and underlying filesystem error. - Refactor pipeline
configPathvalidation to reuse a helper for consistent error construction (and to include function name/image context). - Update e2e harness/expected outputs to make stderr comparisons stable across temp dirs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/test/runner/runner.go | Adds stderr normalization for temp-dir prefixes when comparing e2e outputs. |
| pkg/api/kptfile/v1/validation.go | Improves configPath functionConfig open error to include path and wrapped error. |
| internal/pkg/pkg.go | Refactors pipeline configPath validation errors and adds helpers for step naming. |
| internal/pkg/pkg_test.go | Adds unit tests for step name/image display helper. |
| e2e/testdata/fn-render/missing-fnconfig/.expected/config.yaml | Updates expected stderr to match new validation message. |
| e2e/testdata/fn-render/fnconfig-cannot-refer-subpkgs/.expected/diff.patch | Updates expected output to match new validation message. |
| e2e/testdata/fn-render/fnconfig-cannot-refer-subpkgs/.expected/config.yaml | Updates expected stderr to match new validation message. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
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.
Currently, the error message is rather vague when a configPath based functionConfig cannot be found, simply stating that
functionConfig must exist in the current package.This PR rewords and improves that validation message in both places it could be returned + some code deduplication and refactoring.