1fanwang opened a new pull request, #70336:
URL: https://github.com/apache/airflow/pull/70336
`run_id`, `path` and `output_file_name` are template fields, so they are
rendered after `__init__` runs. When `output_file_name` was omitted, the
constructor built the default from `self.run_id` and `self.path` and flattened
slashes then — on the un-rendered Jinja expressions. With a templated `path`,
the `'/'`→`'-'` replacement ran on the expression, not the resolved path, so a
rendered path like `a/b/c.json` kept its slashes in the file name (`Path` then
wrote into nested directories). Derive the default in `execute()`, after
rendering.
related: #70296
cc @shahar1
<details><summary>Testing Done</summary>
New `test_default_output_file_name_uses_rendered_path` renders a templated
`path` (`{{ params.p }}` → `path/to/my/manifest.json`) and asserts the default
name is `<run_id>_path-to-my-manifest.json`. It fails on the pre-fix source
(slashes survive, name is `<run_id>_path/to/my/manifest.json`) and passes
after. `TestDbtCloudGetJobRunArtifactOperator`: 11 passed.
`validate_operators_init.py` on the operator exits 0.
</details>
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: GitHub Copilot CLI 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]