Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Implementation of ExactMatch (and Substring) is broken

Đang mở
#353 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DataDog/datadog-sync-cli

Tất cả issue của DataDog/datadog-sync-cli

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.