Commit 94b3a3fcd5 for bind

commit 94b3a3fcd52968805981b580f236d4ff9b14c87f
Author: Michal Nowak <mnowak@isc.org>
Date:   Fri Oct 9 15:17:26 2026 +0000

    Size statschannel responses by the wire form named sent

    The traffic test predicts named's response-size histogram buckets from
    the responses it receives.  It re-rendered each response with
    to_wire(), which matches the size named sent only as long as dnspython
    compresses names the same way.  Since dnspython 2.7.0, a parsed
    message keeps its original wire form in Message.wire; use that.

    dns.query records the rendered form of a query in Message.wire as well
    when it sends it, so the requests are sized after they have been sent,
    next to their answers, and no fallback to to_wire() is needed.  A
    message that was neither sent nor parsed now fails loudly instead of
    being measured in a form named never saw.

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

diff --git a/bin/tests/system/statschannel/generic.py b/bin/tests/system/statschannel/generic.py
index 540eeeba6d..d052076923 100644
--- a/bin/tests/system/statschannel/generic.py
+++ b/bin/tests/system/statschannel/generic.py
@@ -165,7 +165,9 @@ def create_expected(data):


 def update_expected(expected, key, msg):
-    msg_len = len(msg.to_wire())
+    # Message.to_wire(), which dns.query calls on send, records the exact
+    # octets in Message.wire, so size requests after they have been sent
+    msg_len = len(msg.wire)
     bucket_num = (msg_len // 16) * 16
     bucket = f"{bucket_num}-{bucket_num + 15}"

@@ -209,30 +211,30 @@ def test_traffic(fetch_traffic, **kwargs):
     exp = create_expected(data)

     msg = create_msg("short.example.", "TXT")
-    update_expected(exp, "dns-udp-requests-sizes-received-ipv4", msg)
     ans = isctest.query.udp(msg, statsip, attempts=1)
     isctest.check.noerror(ans)
+    update_expected(exp, "dns-udp-requests-sizes-received-ipv4", msg)
     update_expected(exp, "dns-udp-responses-sizes-sent-ipv4", ans)
     wait_for_traffic(fetch_traffic, statsip, statsport, exp)

     msg = create_msg("long.example.", "TXT")
-    update_expected(exp, "dns-udp-requests-sizes-received-ipv4", msg)
     ans = isctest.query.udp(msg, statsip, attempts=1)
     isctest.check.noerror(ans)
+    update_expected(exp, "dns-udp-requests-sizes-received-ipv4", msg)
     update_expected(exp, "dns-udp-responses-sizes-sent-ipv4", ans)
     wait_for_traffic(fetch_traffic, statsip, statsport, exp)

     msg = create_msg("short.example.", "TXT")
-    update_expected(exp, "dns-tcp-requests-sizes-received-ipv4", msg)
     ans = isctest.query.tcp(msg, statsip, attempts=1)
     isctest.check.noerror(ans)
+    update_expected(exp, "dns-tcp-requests-sizes-received-ipv4", msg)
     update_expected(exp, "dns-tcp-responses-sizes-sent-ipv4", ans)
     wait_for_traffic(fetch_traffic, statsip, statsport, exp)

     msg = create_msg("long.example.", "TXT")
-    update_expected(exp, "dns-tcp-requests-sizes-received-ipv4", msg)
     ans = isctest.query.tcp(msg, statsip, attempts=1)
     isctest.check.noerror(ans)
+    update_expected(exp, "dns-tcp-requests-sizes-received-ipv4", msg)
     update_expected(exp, "dns-tcp-responses-sizes-sent-ipv4", ans)
     wait_for_traffic(fetch_traffic, statsip, statsport, exp)