shivaam commented on code in PR #69295:
URL: https://github.com/apache/airflow/pull/69295#discussion_r3569527278
##########
task-sdk/src/airflow/sdk/coordinators/node/coordinator.py:
##########
@@ -45,6 +46,34 @@
BUNDLE_FILENAME = "bundle.mjs"
METADATA_FILENAME = "airflow-metadata.yaml"
+EMBEDDED_METADATA_MARKER = b"//# airflowMetadata="
+# Metadata sits on the bundle's first line; a bounded read is enough.
+EMBEDDED_METADATA_HEAD_BYTES = 1 << 20
+
+
+def _read_embedded_metadata(bundle_path: pathlib.Path) -> dict[str, Any] |
None:
+ """
+ Read the manifest ``airflow-ts-pack`` embeds in the bundle itself.
+
+ The packer prepends the ``airflow-metadata.yaml`` content as a leading
+ ``//# airflowMetadata=<base64>`` line comment, keeping bundle and metadata
+ a single artifact. Returns ``None`` when the bundle has no such marker.
+ """
+ try:
+ with bundle_path.open("rb") as bundle_file:
+ head = bundle_file.read(EMBEDDED_METADATA_HEAD_BYTES)
Review Comment:
We can use a bounded readline() here and report an explicit error when the
metadata line exceeds 1 MiB? The current bounded read() truncates oversized
metadata, which can produce a misleading base64 or YAML parsing error.
--
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]