Implementation of ExactMatch (and Substring) is broken
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Bắt đầu với datadog_sync/utils/filter.py, khoảng dòng 150, và đọc phần README về việc ngừng sử dụng substring và ExactMatch. Xác định xem hướng giải quyết dự kiến là sửa các toán tử đã ngừng sử dụng hay làm rõ việc escape bắt buộc trong tài liệu; được xem là hoàn tất khi hành vi được chọn được các kiểm tra hiện có của dự án bao phủ và phù hợp với hướng dẫn đã được ghi lại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello,
I was experimenting with datadog-sync and the filter option.
I wanted to exactly match a single Synthetics Test with name [Synthetics][Multilocator] Browser test to test multilocator in org 2 for Conductor gates.
I took the recommended approach and wrote a Regular expression, wrapping the name with ^ and $.
--filter "Type=synthetics_tests;Name=name;Value=^[Synthetics][Multilocator] Browser test to test multilocator in org 2 for Conductor gates$"
It didn't work.
I realized I had [ and ] in the name, so I escaped them.
--filter "Type=synthetics_tests;Name=name;Value=^\[Synthetics\]\[Multilocator\] Browser test to test multilocator in org 2 for Conductor gates$"
Since it's a pain and a pitfall to escape chars for a simple exact match, I gave a try at the ExactMatch Operator despite it being deprecated.
--filter "Type=synthetics_tests;Name=name;Value=[Synthetics][Multilocator] Browser test to test multilocator in org 2 for Conductor gates;Operator=ExactMatch"
It didn't work.
Because of the deprecation, I had an idea what could be the cause, and indeed, it's a bug in the code, simply wrapping the string without RegExp escaping the content:
elif operator_lower == EXACT_MATCH_OPERATOR:
reg_exp = f"^{f_dict[FILTER_VALUE_KEY]}$"
On the bug itself
I understand the rational for maintainers to try and have a single implementation and it's nice to have put a deprecation notice.
The feature is only deprecated at the moment, it believe should still work (a reasonable expectation from a user perspective), and, as a user, I would expect a fix.
However, the feature is deprecated, so depending on when it will be effectively deleted, possibly the best option is to update documentation and warn users that strings must be Regexp-escaped regardless of the operator.
WDYT?
Let me know when it's going to be deleted and I can offer to contribute the doc fix in the meantime if it helps.
On the deprecation of operators ExactMatch and Substring
I would like to challenge the deprecation of these operators.
I understand maintainers would like to simplify the code and I agree the Regexp operator covers all needs in one shot.
However, I would like to point that this choice puts an expectation, a responsibility and extra complexity on users that I don't find reasonable.
Yes, the tool is probably intended for devs, yes they can certainly figure how to escape their strings.
However, I doubt going beyond exact match or substring is so common of a use case (and it's only an opinion, happy to be proven wrong with data and numbers).
This means the escaping problem I faced will be solved numerous times at DD (wasting time and resources) while it could be solved just once with an improvement (revert?) to this tool and not using a regexp implementation (also slower) for everything.
WDYT?
- Ngôn ngữ chính
- Python
- Star
- 81
- Fork
- 26
- Merge trung bình
- 10 giờ 34 phút
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DataDog/datadog-sync-cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
DataDog/datadog-sync-cli#729 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
DataDog/datadog-sync-cli#698 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CCM ResourcesĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
DataDog/datadog-sync-cli#697 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
All security_monitoring_rules fail to sync: cases.condition is stripped from the create payloadĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
DataDog/datadog-sync-cli#598 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
DataDog/datadog-sync-cli#597 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của DataDog/datadog-sync-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
webrecorder/warcio#209 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Jeffy123-zhu/logspecter#20 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày