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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to