Skip to content

Add dry-run mode to teams sync - #72494

Merged
potiuk merged 2 commits into
apache:mainfrom
SameerMesiah97:Multi-Team-Sync-Dry-Run
Sep 22, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
SameerMesiah97:Multi-Team-Sync-Dry-Run

Conversation

@SameerMesiah97

@SameerMesiah97 SameerMesiah97 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

This change adds a --dry-run option to airflow teams sync.

The new dry-run mode reports the teams and default team pools that would be created from the DAG bundle configuration without writing anything to the metadata database. The sync command also reports default team pool creation separately from team creation, making the output clearer when existing teams are missing their default pools.

Rationale

airflow teams sync can create teams and default team pools from DAG bundle configuration. In managed or production deployments, operators may want to preview those changes before applying them. A dry-run mode makes the command safer to use in deployment workflows and gives users visibility into pending multi-team synchronization changes.

Tests

Added unit tests verifying that:

  • test_team_sync_dry_run_reports_changes_without_writing confirms dry-run reports pending teams/default pools without creating them.
  • test_team_sync_dry_run_reports_missing_default_pool_without_writing confirms dry-run reports a missing default pool for an existing team without creating it.
  • test_team_sync_dry_run_reports_no_changes confirms dry-run reports when there are no pending teams or default pools to synchronize.

Backwards compatibility

Existing airflow teams sync behavior is unchanged unless the new --dry-run flag is provided.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: [GPT 5.6] following the guidelines

@SameerMesiah97
SameerMesiah97 force-pushed the Multi-Team-Sync-Dry-Run branch 2 times, most recently from b708a4f to 720a583 Compare September 5, 2026 17:05
@SameerMesiah97
SameerMesiah97 marked this pull request as ready for review September 5, 2026 18:09

@justinpakzad justinpakzad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Left one comment

@SameerMesiah97
SameerMesiah97 force-pushed the Multi-Team-Sync-Dry-Run branch 2 times, most recently from a7f2b18 to 972847f Compare September 10, 2026 20:19

@justinpakzad justinpakzad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — computing teams_to_add / pools_to_add up front and then either reporting or applying them keeps the real sync path behaviour-identical, and the three tests each assert that nothing was written. Approving.

Small, non-blocking notes:

  • The description says the sync command now reports default-pool creation separately from team creation, but the non-dry-run path still only prints N teams added.; pool creation is only surfaced under --dry-run. Either add a matching line for the real sync or adjust the description.
  • The newsfragment isn't required — AGENTS.md reserves airflow-core/newsfragments/ for major or breaking changes — keep or drop as you prefer.
  • #72036 (teams inspect) just landed and touches the same team_command.py / cli_config.py, so I'm rebasing the branch to get a CI run against it before merge.

This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Airflow handles maintainer review:
contributing-docs/05_pull_requests.rst.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

Sameer Mesiah added 2 commits September 23, 2026 00:55
…t team pools derived from the DAG bundle configuration without writing to the metadata database. Add tests covering dry-run behavior for missing teams, missing default team pools, and no-op sync scenarios.
@potiuk
potiuk force-pushed the Multi-Team-Sync-Dry-Run branch from 972847f to 12ab2e8 Compare September 22, 2026 22:55
@potiuk
potiuk merged commit 6ae2133 into apache:main Sep 22, 2026
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants