You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "keith991001 (via GitHub)" <gi...@apache.org> on 2026/09/04 09:17:41 UTC

[PR] Fix lineage entities sharing mutable defaults across instances [airflow]

keith991001 opened a new pull request, #72509:
URL: https://github.com/apache/airflow/pull/72509

   The attrs entities in `airflow.providers.common.compat.lineage.entities` declare bare mutable defaults (`tags: list[Tag] = []`, `extra: dict[str, Any] = {}`). With `@attr.s(auto_attribs=True)` such a default is evaluated once and shared class-wide, so mutating one instance silently mutates every other instance:
   
   ```python
   t1 = Table(database="db", cluster="c", name="t1")
   t2 = Table(database="db", cluster="c", name="t2")
   t1.tags.append(Tag(tag_name="pii"))
   t2.tags  # [Tag(tag_name='pii')] — polluted
   t1.tags is t2.tags  # True
   ```
   
   This affects `Table.tags` / `columns` / `owners` / `extra` and `Column.tags`, i.e. lineage metadata can leak between unrelated entities whenever more than one is constructed. Found while writing the missing test module for this file (#72506).
   
   The fix switches the five defaults to `attr.Factory(list)` / `attr.Factory(dict)`. Regression tests assert per-instance isolation and fail on the previous code.
   
   Note: #72506 (in flight) adds broader coverage for the same module in the same test file; whichever lands second will be rebased.
   
   related: #35442
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Fable 5)
   
   Generated-by: Claude Code (Fable 5) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix lineage entities sharing mutable defaults across instances [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #72509:
URL: https://github.com/apache/airflow/pull/72509#issuecomment-5609242435

   Awesome work, congrats on your first merged pull request! You are invited to check our [Issue Tracker](https://github.com/apache/airflow/issues) for additional contributions.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix lineage entities sharing mutable defaults across instances [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #72509:
URL: https://github.com/apache/airflow/pull/72509#issuecomment-5592907870

   cc: @kacpermuda @mobuchowski ? 


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix lineage entities sharing mutable defaults across instances [airflow]

Posted by "mobuchowski (via GitHub)" <gi...@apache.org>.
mobuchowski merged PR #72509:
URL: https://github.com/apache/airflow/pull/72509


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org