divyanshus2404 opened a new pull request, #77026: URL: https://github.com/apache/airflow/pull/77026
closes: #76992 With `[core] multi_team` on, `add_asset_trigger_references` managed asset watcher triggers with no notion of which team's parse was running. This PR scopes diffing, trigger reuse and watcher removal to the parsing team's `team_name`: - **Reuse lookup filters on `Trigger.team_name`** — two teams declaring the identical watcher on the same asset each get their own trigger row, so each team's triggerer runs its own copy. Previously the second team silently reused the first team's trigger and its asset stopped receiving events once the first team stopped running it (failure mode 1 in the issue). - **The diff against `AssetModel.triggers` only considers this team's triggers** — a team that merely schedules on the asset without declaring the watcher no longer computes the other team's watcher into `refs_to_remove` on every parse, which was recreating the trigger each parse cycle so it never fired (failure mode 3). - **The removal branch never touches another team's watchers.** Additionally, the reuse lookup now matches candidate rows by `classpath` and compares kwargs via `BaseEventTrigger.hash` in Python, instead of comparing `encrypted_kwargs` in SQL: Fernet encryption is not deterministic, so with a Fernet key set the SQL equality never matched an existing row (the Fernet asymmetry noted in the issue). Behavior with `multi_team` off is unchanged: all scoping is gated on the config flag, and teamless triggers (`team_name IS NULL`) match a teamless parse as before. A pre-existing trigger with no team under multi-team (failure mode 4) is no longer reused by any team's parse, so each team creates its own properly-scoped trigger on its next parse and the teamless row is cleaned up as orphaned. Includes a regression test reproducing the two-team shared-watcher case, which fails on main and passes with this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
