Repository navigation
air: Name the YAML path in unknown config field errors - #7526
Closed
abdulkareem-db wants to merge 2 commits into
Closed
abdulkareem-db wants to merge 2 commits into
abdulkareem-db wants to merge 2 commits into
Conversation
Unknown or misspelled keys in an `air run` workload YAML surfaced the raw go-yaml error, which names internal Go types (e.g. "field rot_path not found in type aircmd.codeSourceConfig") and gives no path or suggestion. Walk the parsed YAML against configSchema() before decoding and report every unknown key with its line, dotted YAML path, a did-you-mean suggestion, the valid sibling fields, and the matching `-h config.<path>` pointer. When a key has no close match, note that it may come from newer documentation than the running CLI version supports. KnownFields(true) stays as a backstop. Fixes CNXT-2566 and CNXT-2554. Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
|
Thanks for the contribution! This pull request was opened from a fork. If you're a member of the Databricks organization, please request access to the If you're an external contributor, no action is needed; a maintainer will review your pull request. |
Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Author
|
Superseded by #7528 (same change, opened from a branch in this repo). |
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.
Changes
Unknown or misspelled keys in an
air runworkload YAML now produce an error that names the YAML path and line, suggests the closest valid field, lists the valid fields at that level, and points at the matching-h config.<path>help. When a key has no close match, the error also says it may come from newer documentation than this CLI version supports.Before:
After:
No close match:
Why
The go-yaml error exposes internal Go type names (
aircmd.runConfig,aircmd.codeSourceConfig) and gives no path or suggestion. A common way to hit it is running a current workload YAML on an older CLI. For example, the flatcode_source.root_pathform is rejected by CLIs before v1.20.0 and nothing in the error suggests upgrading.The check walks the parsed YAML against
configSchema(), the same schema that--overridepath validation and-h configuse. It reusesfindConfigChildandclosestConfigField, so hidden and legacy fields (code_source.type,code_source.snapshot) and inline fields are handled the same way. All unknown keys are reported, not just the first.KnownFields(true)stays as a backstop.--overrideerrors are unchanged.Tests
cmd/air/runconfig_test.go: a top-level typo, a nested typo, an unknown key with no close match (version hint), several unknown keys reported together, line numbers, and hidden legacy keys still loading.go test ./cmd/air/...passes.air run --dry-run: the three error cases above, and an unchanged valid workload config still validates.This pull request and its description were written by Isaac.