Add overwrite parameter to IMAP hook download_mail_attachments#66850
Add overwrite parameter to IMAP hook download_mail_attachments#66850kyupark wants to merge 2 commits into
Conversation
|
@kyupark — There is 1 unresolved review thread on this PR from If yes, please mark the thread as resolved and ping the reviewer ( If you are still working on the thread, please reply with what is outstanding so the threads stay unresolved on purpose. Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you. Drafted-by: Claude Code (Opus 4.7); reviewed by @potiuk before posting |
|
@phanikumv I added the focused FileExistsError retry test you suggested: the first Local checks passed and CI is green. I’ve marked the thread resolved. Could you take a final look when you have a chance? |
| file_name = name | ||
| self._create_file(file_name, payload, local_output_directory) | ||
|
|
||
| def _unique_name(self, name: str, seen: dict[str, int], local_output_directory: str) -> str: |
There was a problem hiding this comment.
Names of methods should start with a verb (_generate_unique_name)
| f.write(payload) | ||
| break | ||
| except FileExistsError: | ||
| seen[file_name] = 0 |
There was a problem hiding this comment.
Might be redundant considering the logic below
|
@kyupark can you please address the open comments? |
|
@kyupark — this PR has 2 unresolved review thread(s) that still look like they need your attention. Once you've addressed them (push changes and/or reply in-thread), please resolve the threads or reply to confirm, and give the reviewer a nudge for another look. Thanks! See the PR quality criteria. Automated first-pass triage note drafted by an AI-assisted tool — may get things wrong; once addressed, a real Apache Airflow maintainer takes the next look. (why automated) Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting |
|
Fixed in #68838 |
Add an
overwriteparameter to the IMAP hook'sdownload_mail_attachments()method.When
overwrite=True(default), duplicate filenames are overwritten (current behavior).When
overwrite=False, unique filenames are generated by appending a suffix (e.g.report_1.csv,report_2.csv).The non-overwrite path uses exclusive create mode (
"xb") to avoid TOCTOU races, and checks both in-memory state and the filesystem to handle files left over from previous runs.closes: #65870
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.7) following the guidelines
Important
🛠️ Maintainer triage note for @kyupark · by
@potiuk· 2026-07-02 17:46 UTCSome review feedback from
@shahar1is waiting on you:@shahar1need a reply or a fix.The ball is in your court — you've been assigned to this PR. Reply or push a fix in each thread, then mark them resolved.
Automated triage — may be imperfect; a maintainer takes the next look.