Skip to content

Remove dead type-mismatched guard in airflow-ctl command generation - #70945

Open
rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:fix-airflowctl-datamodel-field-dedup
Open

Remove dead type-mismatched guard in airflow-ctl command generation#70945
rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:fix-airflowctl-datamodel-field-dedup

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

The condition guarding this initialisation compares a Pydantic model class against a dict keyed by model name, so it has never been true. The branch is dead code, and has been since it was introduced.

It is deleted rather than repaired because repairing it would be a regression. The field loop beneath appends unconditionally, so the always-taken reset is what keeps datamodels that several operations share — ConnectionBody across three, BackfillPostBody and VariableBody across two — from accumulating a duplicate copy of their fields on every visit: a type-correct comparison expands ConnectionBody to 27 entries instead of 9.

Nothing changes at runtime, and the duplicates a repair would introduce are consumed idempotently, so this is a readability fix — it removes a condition that reads as live logic and invites the wrong correction.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

The condition compared a Pydantic model class against a dict keyed by
model name, so it never held. It happened to be load-bearing: it forced
the field list to be rebuilt on every visit, which is what kept
datamodels shared by several operations (ConnectionBody, VariableBody,
BackfillPostBody) from accumulating duplicate entries. Correcting the
comparison to match the key type would have silently introduced those
duplicates, so the guard is dropped in favour of the unconditional reset
it was already performing.
@rjgoyln
rjgoyln force-pushed the fix-airflowctl-datamodel-field-dedup branch from 63ff28a to fe4414e Compare August 3, 2026 12:18
@rjgoyln
rjgoyln marked this pull request as ready for review August 3, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant