bugraoz93 commented on PR #63579: URL: https://github.com/apache/airflow/pull/63579#issuecomment-4062529390
> Hey @bugraoz93, appreciate you taking the time to share your thoughts, that's a fair concern in general about `while True`. I've run into cases myself where a missed exit condition in a loop caused headaches, especially in background services or networking code, where you can end up with a silent busy-wait. > > That said, I think the context here makes it a pretty safe choice: > > - `_read_char()` is a blocking call that waits on TTY input (or `inputimeout` in CI), so each iteration either returns immediately on valid input or blocks until the user presses something. There's no spinning or CPU burn happening. > > - `prompt_triage_action` right below in the same file uses `while True` for the exact same re-prompt-on-invalid-key pattern. Having two different patterns for the same behavior in the same file would be a bit confusing for anyone reading the code later. > > - I did think about what a flag-based version would look like, something like `valid = False; while not valid:` but since every recognized key path does a `return`, the flag would never actually flip to `True`. It'd just sit there unused. You could restructure to store the result and `break`, but that adds a variable and a branch for no real clarity gain here. > > And yeah, fair enough on the AI comment, I do use AI tools as part of my workflow and polishing the content(eg: comments, asking questions to improve grammar before publishing, I think most of us do these days to some degree). But I did read through the file and trace the code paths before commenting. Things like the merge conflict with `console_print()` and pointing to `prompt_triage_action` as precedent came from actually looking at the code, not from a prompt. Happy to dig into any specific point further if you think there's something I missed! The current state of the code can work and there could be no problem which I wasn't stated that the current code is flaky nor have incomplete checks. My observation is more on future, lots of different people touching each of the code pieces. This doesn't mean we always see all the exits clearly via just looking at the code you need to expand entire method to ensure all new exits align with all others. That was my concern where we missed an `if` in the future, not running code in main. One of the thing generally breeze commands end up in our CI where then these commands also outside of your local usage territory that can do busy waits and cost hours of GH Action hours of processing until someone goes and check if Python won't be forgiving in certain cases. I would say if you checked the code yourself, the best way to express it not tagging me to tell the PR owners to close my comment, rather answer in the comment, share your thoughts then we can discuss the solution while all of us can improve while Airflow is improving. Even answering to the comment with `Claude saying this, what do you think? Or I think this could be useful because of X`. There is no harm on this and this is human interaction after all to make things better which I am having lots of fun discussing these technical details. I am and the Airflow not against usage of AI but if you think of you spending most of your free time to the community to make Airflow better while I am every now and then just copy pasting entire thing from AI without even talking with you but directing PR owner to close the comment. That is not a human behavior at all. We use AI but if we lose our behavior over it, it looks to me fully AI generation or automation rather you spent a minute. We sh ould leverage as tools and it should not change the way how we express our thoughts as a community. To each other, not as a 3rd person. That is rude. I stated as a small nit not a blocker already gives the PR owner to either discuss with me or close the thread with thoughts. This was pretty clear while if AI wasn't generated all, you would also skip and left the part to PR author if you don't have objection to it. If you have lets discuss in the threads as humans rather pointing the ideas are wrong from AI context (with AI help is always okay until it do everything for you which makes you losing the human behavior). -- 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]
