refactor(config): rename parse-config to lint and reject unknown keys#563
Merged
Conversation
Swap the parse-config command to cascade lint (no external consumers to protect) and make top-level manifest parsing strict: an unknown or misspelled config key is now a hard error carrying a did-you-mean suggestion, rather than being silently dropped by the lenient decoder. Strictness mirrors the proven per-component catch-all one level up: an inline Extra map on TrunkConfig captures unmodeled keys, which a validation walk rejects against the reflected known-field set with a Levenshtein-nearest suggestion. Legitimately open maps stay open. The four generated lanes (validate_check, merge_queue, pr_preview, hotfix check-job), the two e2e scenarios, cascade's own build-cli smoke test, the byte-identical golden baseline, the schema description copies, and the CLI and manifest docs all move to lint. lint keeps the JSON validity surface the lanes gate on behind --json. Stale project: fixtures and the typed-remarshal note are updated for the new strictness. Verification: go build/test/-race and golangci-lint clean on the root and e2e modules; new regression tests fail before and pass after. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.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.
Problem
parse-configboth validates a manifest and prints it as JSON, but the top level of the manifest was parsed leniently: an unknown or misspelled key (sayenviroments:, or a component-scoped field pasted at the top level) was silently dropped instead of flagged. Components were already strict one level down; the top level was not.Fix
cascade lint. There are no external consumers pinned toparse-config, so this is a straight swap rather than an add.lintprints a human-readable report and exits non-zero when the manifest is invalid;--jsonpreserves thevalid/errors/warningssurface the generated lanes gate on.Extracatch-all onTrunkConfigcaptures unmodeled keys, and a validation walk rejects each one via the existing error tier with a "did you mean X?" suggestion (Levenshtein against the reflected known-field set). Legitimately open maps (inputs,env_inputs,action_pins) stay open.lint: the four generated lanes (validate_check, merge_queue, pr_preview, hotfix check-job), the two e2e scenarios, cascade's own build-cli smoke test, the byte-identical golden baseline, the schema-description copies, and the CLI and manifest docs. Staleproject:test fixtures and the typed-remarshal note are updated for the new strictness.Verification
go build,go test,go test -race, andgolangci-lint runclean on the root ande2emodules.internal/configfail before the change and pass after: a misspelled top-level key and a component-scoped field at the top level now produce an unknown-field error (with a suggestion for the misspelling); a known-field manifest stays valid.58-lint-strict-rejectionproves the merge-queue lane reds when a candidate carries an unknown top-level key.