feat(core): add experimantal cli arg to validate manifest - #9721
Merged
Conversation
Signed-off-by: Olblak <me@olblak.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an experimental manifest schema validation capability intended to catch misspelled/unknown keys (and other schema mismatches) before manifests are committed or executed, aligning with the request in #1001.
Changes:
- Add schema compilation/validation helpers and a manifest-oriented validator that validates resources “by kind” for more precise errors.
- Add
updatecli manifest validate(experimental) plus wiring to optionally validate schemas during other commands via a shared--validate-schemaflag. - Adjust resource specs / e2e fixtures to match the schema (e.g., conditional
urlrequirement, dockerimage versionfilter shape).
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/plugins/resources/gittag/main.go | Loosens schema “required” tagging for url to reflect conditional requirement. |
| pkg/plugins/resources/gitbranch/main.go | Loosens schema “required” tagging for url to reflect conditional requirement. |
| pkg/core/pipeline/scm/config.go | Extracts SCM kind→spec mapping for reuse (schema + validator). |
| pkg/core/pipeline/autodiscovery/main.go | Includes crawler aliases in autodiscovery spec mapping for schema/validation. |
| pkg/core/pipeline/action/main.go | Extracts action kind→spec mapping for reuse (schema + validator). |
| pkg/core/jsonschema/validate.go | Adds generic validator error flattening + YAML normalization. |
| pkg/core/jsonschema/main.go | Makes comment-map retrieval/cache optional so schemas can be built at runtime without cloning repo. |
| pkg/core/jsonschema/main_test.go | Adds coverage ensuring schema generation works without code comments available. |
| pkg/core/jsonschema/compile.go | Adds schema compilation helper that pins draft and strips $schema. |
| pkg/core/jsonschema/compile_test.go | Adds tests validating compilation behavior is draft-independent. |
| pkg/core/engine/manifest_validate.go | Adds engine entrypoint for validating manifests and aggregating problems. |
| pkg/core/engine/configuration.go | Refactors default-manifest detection and wires ValidateSchema option into config loading. |
| pkg/core/config/schemavalidate.go | Implements manifest schema validation with layered checks and per-kind spec validation. |
| pkg/core/config/schemavalidate_value.go | Adds helpers for case-normalization and “did you mean” suggestions. |
| pkg/core/config/schemavalidate_test.go | Adds unit tests for manifest schema validation behavior and messages. |
| pkg/core/config/schemavalidate_registry.go | Builds/compiles schema registry and per-section/per-kind schemas. |
| pkg/core/config/schemavalidate_registry_test.go | Ensures every supported kind compiles and mappings stay in sync. |
| pkg/core/config/schemavalidate_problem.go | Defines SchemaProblem/SchemaReport types and formatting/helpers. |
| pkg/core/config/schemavalidate_corpus_test.go | Validates shipped manifest corpus against schema to prevent regressions. |
| pkg/core/config/main.go | Makes manifest name optional in schema; adds ValidateSchema + OnSchemaProblem options and hooks validation into config loading. |
| pkg/core/compose/schemavalidate.go | Adds optional compose schema validation (single-schema validation path). |
| pkg/core/compose/schemavalidate_test.go | Adds tests for compose schema validation output. |
| pkg/core/compose/file.go | Hooks compose schema validation before post-processing defaults. |
| go.mod | Adds direct deps for Levenshtein suggestions and jsonschema validator. |
| e2e/venom.d/test_manifest_validate.yaml | Adds e2e test suite for updatecli manifest validate. |
| e2e/updatecli.d/success.d/golang/gomod.yaml | Updates fixture to remove schema-invalid kind field in spec. |
| e2e/updatecli.d/success.d/dockerimage.yaml | Updates fixture to match schema-required versionfilter structure. |
| e2e/updatecli.d/invalid.d/typos.yaml | Adds an intentionally-invalid manifest to assert error reporting. |
| e2e/scripts/test_manifest_validate.bash | Adds e2e helper script for validating deprecated manifests. |
| e2e/scripts/test_manifest_validate_invalid.bash | Adds e2e helper script expecting validation failure (inverted exit). |
| cmd/root.go | Wires new manifest/validate run target and global --validate-schema backing var. |
| cmd/pipeline_diff.go | Adds shared --validate-schema flag wiring for pipeline diff. |
| cmd/pipeline_apply.go | Adds shared --validate-schema flag wiring for pipeline apply. |
| cmd/manifest_validate.go | Adds experimental updatecli manifest validate command and flags. |
| cmd/flags.go | Adds shared --validate-schema flag with env default. |
| cmd/env.go | Adds UPDATECLI_VALIDATE_SCHEMA env var. |
| cmd/diff.go | Adds shared --validate-schema flag wiring for deprecated diff command. |
| cmd/compose_diff.go | Adds shared --validate-schema flag wiring + compose schema validation toggle. |
| cmd/compose_apply.go | Adds shared --validate-schema flag wiring + compose schema validation toggle. |
| cmd/apply.go | Adds shared --validate-schema flag wiring for deprecated apply command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
Signed-off-by: Olblak <me@olblak.com>
olblak
enabled auto-merge (squash)
July 28, 2026 15:00
Signed-off-by: Olblak <me@olblak.com>
|
Tick the box to add this pull request to the merge queue (same as
|
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.
Fix #1001
Add a function to validate manifest.
This is currently experimental to see if it solves the problem.
Test
To test this pull request, you can run the following commands:
make testAdditional Information
Checklist
Tradeoff
Potential improvement