lbny22727-create commented on PR #73827: URL: https://github.com/apache/airflow/pull/73827#issuecomment-7288321515
مرحباً Copilot، شكراً جزيلاً لك على مراجعة الكود وتقديم هذه الملاحظات الدقيقة. سأقوم فوراً بالعمل على تعديل الـ regex والقيود الخاصة بإصدار بايثون، كما سأضيف اختبارات التراجع (regression assertions) المطلوبة للرسائل التي تم تحديثها. سأقوم بتحديث الـ Pull Request بمجرد الانتهاء من التنفيذ. مع أطيب التحيات، [اسمك] بتاريخ ٣٠ نوفمبر ٢٠٢٦ ٨:٤٤:٠٩ م GMT+02:00، Copilot ***@***.***> الرسالة: >@Copilot commented on this pull request. > ><!-- ccr-overview-v2 --> > >### 🟡 Changes recommended > >The checker misses valid `%.f` conversions, counts unsupported `%zd` forms, and lacks the repository’s Python 3.10 pin, while changed runtime messages lack complete regression assertions. > ><details open> ><summary><strong>3 open issues</strong></summary> > >- <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [Pin the standalone hook to Python 3.10](https://github.com/apache/airflow/pull/73827#discussion_r4743784355) · New >- <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [Fix printf regex handling of precision and length modifiers](https://github.com/apache/airflow/pull/73827#discussion_r4743784412) · New >- <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> [Add regression assertions for complete rendered error messages](https://github.com/apache/airflow/pull/73827#discussion_r4743784483) · New ></details> > ><details> ><summary><strong>What changed in this PR</strong></summary> > >This PR fixes exception-message formatting across Airflow core, the Task SDK, and providers, and adds a preventive check to catch similar mistakes. > >**Changes:** >- Interpolate 28 exception messages with f-strings instead of passing formatting arguments separately. >- Register a prek hook that detects matching positional placeholders and trailing exception arguments. >- Add tests for placeholder counting, detection boundaries, and hook execution. > >| File | Description | >| ---- | ----------- | >| `task-sdk/src/airflow/sdk/serde/__init__.py` | Format incompatible-version diagnostics. | >| `task-sdk/src/airflow/sdk/definitions/taskgroup.py` | Format cross-Dag TaskGroup errors. | >| `scripts/tests/ci/prek/test_check_exception_format_args.py` | Test the new detector and command-line behavior. | >| `scripts/ci/prek/check_exception_format_args.py` | Add the exception-format-argument checker. | >| `providers/google/src/airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py` | Include experiment names in errors. | >| `providers/google/src/airflow/providers/google/cloud/operators/gen_ai.py` | Format batch-job and file-operation errors. | >| `providers/google/src/airflow/providers/google/cloud/operators/dataflow.py` | Include underlying pipeline errors. | >| `providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/resource.py` | Include missing resource-file paths. | >| `providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py` | Format Istio shutdown errors. | >| `providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/job.py` | Format invalid deletion-status diagnostics. | >| `providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor.py` | Format pod-lookup errors for streaming logs. | >| `providers/amazon/src/airflow/providers/amazon/aws/operators/redshift_cluster.py` | Include cluster state in resume errors. | >| `providers/amazon/src/airflow/providers/amazon/aws/operators/kinesis_analytics.py` | Include failure events in application errors. | >| `providers/amazon/src/airflow/providers/amazon/aws/operators/glue_databrew.py` | Include failure events in job errors. | >| `providers/amazon/src/airflow/providers/amazon/aws/operators/comprehend.py` | Format completion-failure diagnostics. | >| `providers/amazon/src/airflow/providers/amazon/aws/hooks/step_function.py` | Include the state-machine ARN in validation errors. | >| `providers/amazon/src/airflow/providers/amazon/aws/hooks/ec2.py` | Format supported API-type diagnostics. | >| `providers/amazon/src/airflow/providers/amazon/aws/executors/aws_lambda/lambda_executor.py` | Include function names in health-check errors. | >| `airflow-core/src/airflow/models/taskinstance.py` | Format unsupported metric-state errors. | >| `airflow-core/src/airflow/dag_processing/dagbag.py` | Include task and Dag identifiers in listener-conflict errors. | >| `.pre-commit-config.yaml` | Register and scope the new prek hook. | ></details> > ><sub>Review effort: Balanced</sub> > >> +# distributed with this work for additional information >+# regarding copyright ownership. The ASF licenses this file >+# to you under the Apache License, Version 2.0 (the >+# "License"); you may not use this file except in compliance >+# with the License. You may obtain a copy of the License at >+# >+# http://www.apache.org/licenses/LICENSE-2.0 >+# >+# Unless required by applicable law or agreed to in writing, >+# software distributed under the License is distributed on an >+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >+# KIND, either express or implied. See the License for the >+# specific language governing permissions and limitations >+# under the License. >+# /// script >+# requires-python = ">=3.10" > >This requirement allows the standalone hook to select Python minors beyond Airflow’s current minimum, unlike neighboring hooks such as `scripts/ci/prek/check_provider_docs.py:19`, which constrain the interpreter to 3.10. Please use the repository’s `>=3.10,<3.11` pin so this hook selects the current minimum supported minor. > >> + (?:\.(?:\*|\d+))? # precision >+ [hlLqjzt]? # length modifier, accepted and ignored > >The regex misses valid zero-precision conversions such as `%.f`, so `raise ValueError("took %.f sec", elapsed)` escapes detection, while it incorrectly counts unsupported forms such as `%zd`. Allow an empty numeric precision, restrict length modifiers to `h`, `l`, and `L`, and add regression cases for both forms. > >> + f"serialized version of {classname} is newer than module version " >+ f"({version} > {class_version})" > >The corrected runtime messages lack regression assertions: for example, `TestDeserialize.test_incompatible_version` only matches `"newer than"`, which also passes with the old tuple-shaped message. Add assertions for the complete rendered messages and interpolated values across the changed SDK, core, and provider error paths, so reverting each interpolation fails its corresponding test. > >-- >Reply to this email directly or view it on GitHub: >https://github.com/apache/airflow/pull/73827#pullrequestreview-6118239942 >You are receiving this because you are subscribed to this thread. > >Message ID: ***@***.***> -- 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]
