Commit a11c7a89d5 for bind

commit a11c7a89d54ffd111b46103f9f0176a400180bf7
Author: Nicki Křížek <nicki@isc.org>
Date:   Tue Oct 20 11:44:41 2026 +0000

    Match the first N matching queries with a matcher

    A handler leaving the first few matching queries unanswered, as the
    filters test needs, has to count them; Once is the case of one.

    Assisted-by: Claude:claude-opus-5-5

diff --git a/bin/tests/system/isctest/asyncserver/matchers.py b/bin/tests/system/isctest/asyncserver/matchers.py
index cc577331c9..5d2a302890 100644
--- a/bin/tests/system/isctest/asyncserver/matchers.py
+++ b/bin/tests/system/isctest/asyncserver/matchers.py
@@ -311,20 +311,33 @@ class LabelCount(Matcher):
         return f"QNAME of {self._count} labels"


-class Once(Matcher):
+class FirstN(Matcher):
     """
-    Match the first query the given matcher matches, and only that one.
+    Match the first `count` queries the given matcher matches, and only those.
     """

-    def __init__(self, matcher: Matcher) -> None:
+    def __init__(self, count: int, matcher: Matcher) -> None:
+        self._count = count
         self._matcher = matcher
-        self._done = False
+        self._matched = 0

     def match(self, qctx: QueryContext) -> bool:
-        if self._done or not self._matcher.match(qctx):
+        if self._matched >= self._count or not self._matcher.match(qctx):
             return False
-        self._done = True
+        self._matched += 1
         return True

+    def __str__(self) -> str:
+        return f"first {self._count}, {self._matcher}"
+
+
+class Once(FirstN):
+    """
+    Match the first query the given matcher matches, and only that one.
+    """
+
+    def __init__(self, matcher: Matcher) -> None:
+        super().__init__(1, matcher)
+
     def __str__(self) -> str:
         return f"once, {self._matcher}"