Skip to content

Fix sync-perm applying permissions from every stored Dag version - #74360

Open
Eason09053360 wants to merge 2 commits into
apache:mainfrom
Eason09053360:fix-iter-all-latest-version-dags-v2
Open

Eason09053360 wants to merge 2 commits into
apache:mainfrom
Eason09053360:fix-iter-all-latest-version-dags-v2

Conversation

@Eason09053360

Copy link
Copy Markdown
Contributor

Why

airflow sync-perm --include-dags iterates DBDagBag.iter_all_latest_version_dags, which despite its name reads every serialized_dag row. Each Dag is synced once per stored version, and with no ORDER BY an older version's access_control can be applied last (e.g. re-granting a role that was removed) until the Dag processor next parses that file.

What

  • Read only the latest version per Dag via the existing SerializedDagModel.get_latest_serialized_dags(), whose dag_ids is now optional; the underlying select already supported all Dags.
  • The old test mocked session.scalars; the new one writes two real versions to the database.

related: #70935 (same change rebased onto main; the original was closed under the open-PR limit)


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

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

The method promised latest-version dags in its name and docstring but read
every serialized_dag row, so FAB permission syncing processed each Dag once
per version and could apply an outdated access_control last.

This branch has not been deployed

No deployments
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