fix(validation): warn on unknown gen.yaml config keys - #2122
Draft
posthog[bot] wants to merge 1 commit into
Draft
Conversation
ValidateTarget walked only the known config fields, so it never saw a key that no field reads. Dead flags like fixFlags.responseRequiredSep2024 and stale keys like legacyPyright were accepted in silence, which misleads customers who audit their gen.yaml. Add a reverse pass that warns on every language config key with no matching field. The warning is non-fatal, so generation still runs. Generated-By: PostHog Desktop Task-Id: 2732fda5-486c-408d-b872-d1dfc72f00e3
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
gen.yamlsee fix-named flags that do nothing, and our tooling never warns them.ValidateTarget(internal/validation/config.go) walks only the known fields fromGetLanguageConfigFields, so it never inspects a key the customer actually wrote.fixFlags.responseRequiredSep2024). Present on nearly all recent Python generations.legacyPyright). Still accepted in silence.Fixesstruct insdk-gen-configkeeps an inlineAdditionalPropertiescatch-all that absorbs anything unrecognized, which hides the problem further.Nothing breaks — the SDK still generates. This is configuration hygiene, so a flag named like a fix reads as something the customer is missing.
Changes
ValidateTarget: after the forward field check, warn on every language config key that matches no known field.ValidateConfig→ValidateTarget.Scope
This PR carries the part of the fix that lives in this repo. The rest of GEN-3184 lands in other repos and is out of scope here:
ValidateTargetallowUnknownFieldsInWeakUnionsfromgo.schema.json/terraform.schema.jsonsdk-gen-configsdk-gen-configfixFlags.responseRequiredSep2024from the Python schemapython-config.mdxTest plan
TestValidateTarget_WarnsOnUnknownFields— unknown keys (legacyPyright,fixFlags) warn; known keys do not.TestValidateTarget_NoWarningsForKnownFields— a config of only known keys produces no warnings.Note
The
internal/validationpackage depends on private modules (openapi-generation,speakeasy-core) that this environment cannot fetch, so the new tests were verified withgofmtlocally and run in CI.Why
Customers auditing their
gen.yamlduring config reviews were confused by flags that read like fixes but had no effect, and the tooling gave no signal. This surfaces those keys so they can be removed.Agent context
Traced the symptom to the forward-only walk in
ValidateTarget. The schema, schema-gen, and docs edits were confirmed to live in separate repos, so they are not included here.Created with PostHog Desktop from this inbox report, addressing GEN-3184.
Summary by cubic
Warns on unknown
gen.yamlconfig keys so dead and stale flags are no longer silently accepted. Previously only known fields were validated, so keys likelegacyPyrightorfixFlags.responseRequiredSep2024passed without any signal; now every key that no config field reads logs a non-fatal warning and generation continues.ValidateTargetthat warns on keys with no matching known field.ValidateConfigandValidateTarget.This covers the validation part of GEN-3184 that lives in this repo; schema and docs changes land in their respective repos.
Written for commit 0ae3895. Summary will update on new commits.