Skip to content

fix(validation): warn on unknown gen.yaml config keys - #2122

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/choregen-config-warn-on-dead-and-stale-696c26
Draft

fix(validation): warn on unknown gen.yaml config keys#2122
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/choregen-config-warn-on-dead-and-stale-696c26

Conversation

@posthog

@posthog posthog Bot commented Aug 26, 2026

Copy link
Copy Markdown

Problem

  • Customers who audit their gen.yaml see fix-named flags that do nothing, and our tooling never warns them.
  • ValidateTarget (internal/validation/config.go) walks only the known fields from GetLanguageConfigFields, so it never inspects a key the customer actually wrote.
  • Two failure modes slip through:
    • Dead flags — declared in a schema but read by no generator code (e.g. fixFlags.responseRequiredSep2024). Present on nearly all recent Python generations.
    • Stale keys — dropped from the current schema but still set by customers (e.g. legacyPyright). Still accepted in silence.
  • The Fixes struct in sdk-gen-config keeps an inline AdditionalProperties catch-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

  • Add a reverse pass in ValidateTarget: after the forward field check, warn on every language config key that matches no known field.
  • The warning is non-fatal — it uses the logger, not the error list, so generation continues.
  • Warnings are sorted for stable output.
  • Thread the target logger through ValidateConfigValidateTarget.
WARN  field 'legacyPyright' in gen.yaml matches no known config field for target python. The generator ignores it. Remove the field or correct its spelling.

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:

Change Repo
Reverse-pass warning in ValidateTarget this repo ✅
Drop allowUnknownFieldsInWeakUnions from go.schema.json / terraform.schema.json sdk-gen-config
Extend the schema-gen test guard to cover the two schemas sdk-gen-config
Remove fixFlags.responseRequiredSep2024 from the Python schema private generator repo
Update python-config.mdx docs repo

Test 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/validation package depends on private modules (openapi-generation, speakeasy-core) that this environment cannot fetch, so the new tests were verified with gofmt locally and run in CI.

Why

Customers auditing their gen.yaml during 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.yaml config keys so dead and stale flags are no longer silently accepted. Previously only known fields were validated, so keys like legacyPyright or fixFlags.responseRequiredSep2024 passed without any signal; now every key that no config field reads logs a non-fatal warning and generation continues.

  • Adds a reverse pass in ValidateTarget that warns on keys with no matching known field.
  • Sorts warnings for stable output.
  • Threads the target logger through ValidateConfig and ValidateTarget.
  • Covers warning and no-warning cases in new tests.

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.

Review in cubic

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
@linear-code

linear-code Bot commented Aug 26, 2026

Copy link
Copy Markdown

GEN-3184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants