Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Implementation of ExactMatch (and Substring) is broken

オープン
#353 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
cli

調査の方向性

datadog_sync/utils/filter.py の150行目付近から始め、substring と ExactMatch の非推奨化について説明している README セクションを読んでください。意図された解決策が非推奨の演算子を修正することなのか、ドキュメントで必要なエスケープを明確にすることなのかを判断してください。選択した動作がプロジェクト既存のチェックでカバーされ、文書化されたガイダンスと一致すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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?

主要言語
Python
スター
81
フォーク
26
平均マージ
11時間 29分
マージ済み PR(30日)
22

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DataDog/datadog-sync-cli のほかの issue

DataDog/datadog-sync-cli の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。