Copilot commented on code in PR #68627:
URL: https://github.com/apache/airflow/pull/68627#discussion_r3420619812
##########
airflow-core/src/airflow/models/dag_version.py:
##########
@@ -91,12 +91,13 @@ def __repr__(self):
@property
def bundle_url(self) -> str | None:
"""Render the bundle URL using the joined bundle metadata if
available."""
- # Prefer using the joined bundle relationship when present to avoid
extra queries
- if getattr(self, "bundle", None) is not None and hasattr(self.bundle,
"signed_url_template"):
- return self.bundle.render_url(self.bundle_version)
+ # When the bundle row is loaded, use it (render_url returns None if it
has no URL template).
+ # Only when there is no bundle row do we fall back to the deprecated
manager lookup -- doing
+ # so for an empty template would hit the deprecated path (and its
warning) on every call.
Review Comment:
The new comment says "When the bundle row is loaded", but `bundle =
getattr(self, "bundle", None)` will still trigger a lazy-load query when the
relationship isn’t eagerly loaded. This is just a wording mismatch that could
mislead future readers about query behavior; consider rephrasing to avoid
implying the relationship is already loaded.
--
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]