You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "WonYong-Jang (via GitHub)" <gi...@apache.org> on 2026/07/28 13:18:11 UTC
[PR] Fix malformed GitdagBundle error message for missing repository path [airflow]
WonYong-Jang opened a new pull request, #70622:
URL: https://github.com/apache/airflow/pull/70622
When the bare repository path is missing, `GitDagBundle._clone_repo_if_required`
raised the error with printf-style formatting:
```
raise AirflowException("Repository path: %s not found", self.bare_repo_path)
```
`AirflowException` (like any `Exception`) does not perform `%s` substitution.
Passing a second positional argument just stores both values in `.args`, so `str(exc)`
returns the tuple `('Repository path: %s not found', '/path/to/bare')` instead of a readable message.
This changes it to an f-string, so the path is interpolated and the message reads correctly:
Repository path: /path/to/bare not found
The existing test asserted the broken output
(`"Repository path: %s not found" in str(...)`), which effectively locked in the
bug. It now asserts the correctly formatted message.
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
<!--
Thank you for contributing!
Please provide above a brief description of the changes made in this pull request.
Write a good git commit message following this guide: https://chris.beams.io/posts/git-commit/
Please make sure that your code changes are covered with tests.
And in case of new features or big changes remember to adjust the documentation.
For user-facing UI changes, please attach before/after screenshots (or a short
screen recording) so reviewers can assess the visual impact.
Feel free to ping (in general) for the review if you do not see reaction for a few days
(72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
In case of an existing issue, reference it using one of the following:
* closes: #ISSUE
* related: #ISSUE
-->
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR, please
change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
-->
- [ ] Yes (please specify the tool below)
<!--
Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
-->
---
* Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
* For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
* When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
* For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
--
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 malformed GitDagBundle error message for missing repository path [airflow]
Posted by "WonYong-Jang (via GitHub)" <gi...@apache.org>.
WonYong-Jang commented on PR #70622:
URL: https://github.com/apache/airflow/pull/70622#issuecomment-5187077804
> @WonYong-Jang could you resolve a conflicts?
@Miretpl @potiuk
Resolved conflicts. Thanks
--
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 malformed GitDagBundle error message for missing repository path [airflow]
Posted by "Miretpl (via GitHub)" <gi...@apache.org>.
Miretpl commented on PR #70622:
URL: https://github.com/apache/airflow/pull/70622#issuecomment-5185178713
@WonYong-Jang could you resolve a conflicts?
--
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 malformed GitDagBundle error message for missing repository path [airflow]
Posted by "WonYong-Jang (via GitHub)" <gi...@apache.org>.
WonYong-Jang commented on PR #70622:
URL: https://github.com/apache/airflow/pull/70622#issuecomment-5150269160
> Good catch — this is a real bug. `AirflowException("...%s...", value)` doesn't interpolate; both arguments are kept, so the message rendered as a tuple rather than a path. The f-string is the right fix, and tightening the test to an exact-equality assertion against the real path is exactly what it needed.
>
> One thing before this goes in. The project is actively reducing direct `AirflowException` usages, and the guidance is that when you touch a line that raises one, narrow it rather than leave it behind. Here the `except` clause tells you the specific failure — the path isn't there — so `FileNotFoundError` fits:
>
> ```python
> except NoSuchPathError as e:
> # Protection should the bare repo be removed manually
> raise FileNotFoundError(f"Repository path: {self.bare_repo_path} not found") from e
> ```
>
> The same method already does this a few lines above, so it stays consistent with its neighbours:
>
> ```python
> raise RuntimeError("Error cloning repository") from e
> raise RuntimeError(f"Invalid git repository at {self.bare_repo_path}") from e
> ```
>
> Two follow-on edits if you take it:
>
> * the test's `pytest.raises(AirflowException)` becomes `pytest.raises(FileNotFoundError)`
> * `generated/known_airflow_exceptions.txt` has `providers/git/src/airflow/providers/git/bundles/git.py::5` — drop it to `::4`, otherwise the ratchet check fails
>
> Happy to merge once that's in.
>
> Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
Thank you for the review! Applied all three changes.
--
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 malformed GitDagBundle error message for missing repository path [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #70622:
URL: https://github.com/apache/airflow/pull/70622#issuecomment-5148897977
Good catch — this is a real bug. `AirflowException("...%s...", value)` doesn't interpolate; both arguments are kept, so the message rendered as a tuple rather than a path. The f-string is the right fix, and tightening the test to an exact-equality assertion against the real path is exactly what it needed.
One thing before this goes in. The project is actively reducing direct `AirflowException` usages, and the guidance is that when you touch a line that raises one, narrow it rather than leave it behind. Here the `except` clause tells you the specific failure — the path isn't there — so `FileNotFoundError` fits:
```python
except NoSuchPathError as e:
# Protection should the bare repo be removed manually
raise FileNotFoundError(f"Repository path: {self.bare_repo_path} not found") from e
```
The same method already does this a few lines above, so it stays consistent with its neighbours:
```python
raise RuntimeError("Error cloning repository") from e
raise RuntimeError(f"Invalid git repository at {self.bare_repo_path}") from e
```
Two follow-on edits if you take it:
- the test's `pytest.raises(AirflowException)` becomes `pytest.raises(FileNotFoundError)`
- `generated/known_airflow_exceptions.txt` has `providers/git/src/airflow/providers/git/bundles/git.py::5` — drop it to `::4`, otherwise the ratchet check fails
Happy to merge once that's in.
---
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
--
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 malformed GitDagBundle error message for missing repository path [airflow]
Posted by "Miretpl (via GitHub)" <gi...@apache.org>.
Miretpl merged PR #70622:
URL: https://github.com/apache/airflow/pull/70622
--
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