Skip to content

[v3-3-test] Raise the datamodel-code-generator floor for the codegen toolchain (#70670) - #70976

Merged
vatsrahul1001 merged 6 commits into
v3-3-testfrom
backport-70670-v3-3-test
Aug 4, 2026
Merged

[v3-3-test] Raise the datamodel-code-generator floor for the codegen toolchain (#70670)#70976
vatsrahul1001 merged 6 commits into
v3-3-testfrom
backport-70670-v3-3-test

Conversation

@vatsrahul1001

Copy link
Copy Markdown
Contributor

Backport of #70670 to v3-3-test. Not a plain cherry-pick — the generated models had to be regenerated against v3-3-test's own spec rather than copied from main.

What was done:

  • Bumped datamodel-code-generator[http] floor 0.33.0>=0.71.0 in task-sdk/pyproject.toml and airflow-ctl/pyproject.toml (clears the advisories in that range; codegen is a dev-only dependency group), plus the AGENTS.md command doc.
  • Regenerated the datamodels against v3-3-test's spec with the new tool via the codegen prek hooks (generate-tasksdk-datamodels, generate-airflowctl-datamodels, generate-supervisor-schemas-snapshot). check-supervisor-schemas-versions passes — the server contract is unchanged; this is purely a rendering change (drops spurious = None defaults on required-nullable fields; tightens list[Any] roots to typed tuples).
  • Updated the affected test constructions for the now-required nullable fields; re-locked uv.lock.

Intentionally excluded: test_task_command.py (main-only) and main's divergent test_operations.py tail (tests ctl task-instance operations that don't exist on this branch).

Local mypy for both airflow-ctl and task-sdk is green; codegen is idempotent on re-run.

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

Generated-by: Claude Code (Opus 4.8) following the guidelines — manual backport with local regeneration + test adaptation (documented above).

…70670)

(cherry picked from commit b301429)

Manual backport: datamodel-code-generator floor bumped 0.33.0 -> >=0.71.0 and
models REGENERATED against v3-3-test's own spec (not copied from main). Test
constructions in test_operations.py updated for the now-required nullable fields.
test_task_command.py is main-only; main's divergent test_operations.py tail
(ctl task-instance ops not on this branch) intentionally not backported.
vatsrahul1001 and others added 5 commits August 3, 2026 17:20
…l test

The regenerated model exposes the field as `schema_` with `Field(alias="schema")`
and no `populate_by_name`, so pydantic requires the alias `schema=` at construction.
Matches main's fix (#70670): construct with `schema=` plus `# type: ignore[call-arg]`.
ConnectionResponse.schema_ has Field(alias=schema) and no populate_by_name, so the
source validates responses by the schema alias. The mock handlers dumped the model
by field name, breaking the round-trip. Dump connection_response / connections_response
mocks with by_alias=True (matches main #70670).
The #70127/#69719 reverts (now on v3-3-test) removed BackfillDagRunResponse,
BackfillDagRunCollectionResponse and bundle_version from the API spec. Regenerated
generated.py from the current spec with datamodel-code-generator>=0.71.0 so it reflects
the reverts in the new-tool format. mypy airflow-ctl clean; no tests reference the removed models.
@vatsrahul1001
vatsrahul1001 merged commit a052689 into v3-3-test Aug 4, 2026
226 of 227 checks passed
@vatsrahul1001
vatsrahul1001 deleted the backport-70670-v3-3-test branch August 4, 2026 14:01
vatsrahul1001 added a commit that referenced this pull request Aug 5, 2026
…toolchain (#70670) (#70976)

* Raise the datamodel-code-generator floor for the codegen toolchain (#70670)

(cherry picked from commit b301429)

Manual backport: datamodel-code-generator floor bumped 0.33.0 -> >=0.71.0 and
models REGENERATED against v3-3-test's own spec (not copied from main). Test
constructions in test_operations.py updated for the now-required nullable fields.
test_task_command.py is main-only; main's divergent test_operations.py tail
(ctl task-instance ops not on this branch) intentionally not backported.

* Fix ConnectionResponse construction to use schema alias in airflow-ctl test

The regenerated model exposes the field as `schema_` with `Field(alias="schema")`
and no `populate_by_name`, so pydantic requires the alias `schema=` at construction.
Matches main's fix (#70670): construct with `schema=` plus `# type: ignore[call-arg]`.

* Serialize connection mock responses by alias in airflow-ctl tests

ConnectionResponse.schema_ has Field(alias=schema) and no populate_by_name, so the
source validates responses by the schema alias. The mock handlers dumped the model
by field name, breaking the round-trip. Dump connection_response / connections_response
mocks with by_alias=True (matches main #70670).

* Regenerate airflow-ctl datamodels after merging v3-3-test

The #70127/#69719 reverts (now on v3-3-test) removed BackfillDagRunResponse,
BackfillDagRunCollectionResponse and bundle_version from the API spec. Regenerated
generated.py from the current spec with datamodel-code-generator>=0.71.0 so it reflects
the reverts in the new-tool format. mypy airflow-ctl clean; no tests reference the removed models.
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.

3 participants