Skip to content

Corrects message and message argument (Consistency05) - #1560

Open
matsduf wants to merge 7 commits into
zonemaster:developfrom
matsduf:corrects-messages-consistency05
Open

matsduf wants to merge 7 commits into
zonemaster:developfrom
matsduf:corrects-messages-consistency05

Conversation

@matsduf

@matsduf matsduf commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

This PR corrects some errors for Consistency05 implementation:

  • CS05_OOD_ADDR_MISMATCH had wrong msgid
  • Wrong argument name was used

Context

Issue #1559.

How to test this PR

Correct messages (msgids) should be displayed.

@matsduf matsduf added this to the v2026.2 milestone Oct 5, 2026
@matsduf matsduf added T-Bug Type: Bug in software or error in test case description A-TestCase Area: Test case specification or implementation of test case RC-Fixes Release category: Fixes. labels Oct 5, 2026
@matsduf matsduf linked an issue Oct 5, 2026 that may be closed by this pull request
@marc-vanderwal

Copy link
Copy Markdown
Contributor

I preferred using __ over __x if the msgid has no arguments to interpolate. Other than that, it seems that __x was used correctly.

This PR could also have been an opportunity to add to the scenario .t file the appropriate tests for the message arguments, like t/test-Zone09.t does.

@matsduf

matsduf commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor Author

@marc-vanderwal!

I preferred using __ over __x if the msgid has no arguments to interpolate. Other than that, it seems that __x was used correctly.

I checked if that could be the case, but __ is (was) not consistently used for msgid without argument. Do you want me to revert that change?

This PR could also have been an opportunity to add to the scenario .t file the appropriate tests for the message arguments, like t/test-Zone09.t does.

Well, then it is more than a bug fix. I could be in the same PR or in a new one. I will check how to do it.

Else, did you see any problem with the PR?

@marc-vanderwal

Copy link
Copy Markdown
Contributor

Writing a failing unit test that reproduces the bug is the best way to make sure that we’ve actually fixed the bug and don’t reintroduce it later on.

diff --git a/t/Test-consistency05.t b/t/Test-consistency05.t
index a640e824..cac4c226 100644
--- a/t/Test-consistency05.t
+++ b/t/Test-consistency05.t
@@ -155,7 +155,13 @@ scenario 'NO-NS-ADDR-CHILD-2' => sub {
 scenario 'OOD-ADDR-MISMATCH' => sub {
     zone 'child.{SCENARIO}.{TESTCASE}.xa';

-    expect 'CS05_OOD_ADDR_MISMATCH';
+    expect 'CS05_OOD_ADDR_MISMATCH' => {
+        nsname => 'ns1.sibbling.ood-addr-mismatch.consistency05.xa',
+        ns_ip_list_glue => '127.14.5.39;'
+                         . 'fda1:b2:c3:0:127:14:5:39',
+        ns_ip_list_lookup => '127.14.5.33;'
+                           . 'fda1:b2:c3:0:127:14:5:33',
+    };
     forbid_others;
 };

(I’m not entirely sure that the arguments’ values I’m expecting in the unit test are correct. Feel free to fix them for me.)

When I check out your branch and apply my changes to have the failing unit test, I realize that there is another problem with the same code.

    #   Failed test 'Messages of tag 'CS05_OOD_ADDR_MISMATCH' exist with specified arguments'
    #   at t/Test-consistency05.t line 158.
    # Looked for a message whose tag is 'CS05_OOD_ADDR_MISMATCH'
    #   where 'ns_ip_list_glue' equals '127.14.5.39;fda1:b2:c3:0:127:14:5:39'
    #     and 'ns_ip_list_lookup' equals '127.14.5.33;fda1:b2:c3:0:127:14:5:33'
    #     and 'nsname' equals 'ns1.sibbling.ood-addr-mismatch.consistency05.xa'
    #     and contains no argument other than those listed above
    # Here are all messages that unsuccessfully matched:
    #   CS05_OOD_ADDR_MISMATCH ns_ip_list_glue=3;3; ns_ip_list_lookup=3;3; nsname="ns1.sibbling.ood-addr-mismatch.consistency05.xa"

Notice the arguments of the last line.

Let’s not change what isn’t strictly necessary to change to fix the bug.

@matsduf matsduf changed the title Corrects Gettext command, message and message argument Corrects message and message argument Oct 5, 2026
@marc-vanderwal

Copy link
Copy Markdown
Contributor

Okay, basically you also need this:

diff --git a/lib/Zonemaster/Engine/Test/Consistency.pm b/lib/Zonemaster/Engine/Test/Consistency.pm
index 90ca034d..5699b1de 100644
--- a/lib/Zonemaster/Engine/Test/Consistency.pm
+++ b/lib/Zonemaster/Engine/Test/Consistency.pm
@@ -1057,8 +1057,8 @@ sub consistency05 {
             if ( not $set->equals( $lookup ) ) {
                 push @results, _emit_log( CS05_OOD_ADDR_MISMATCH => {
                     nsname => $n,
-                    ns_ip_list_glue => join( ";", map { $_->address() } $set->sorted_items() ),
-                    ns_ip_list_lookup => join( ";", map { $_->address() } $lookup->sorted_items() )
+                    ns_ip_list_glue => join( ";", map { $_->address()->short() } $set->sorted_items() ),
+                    ns_ip_list_lookup => join( ";", map { $_->address()->short() } $lookup->sorted_items() )
                 } );
             }
         }

Then the failing test I mentioned in my previous comment passes.

@matsduf
matsduf requested review from marc-vanderwal and removed request for marc-vanderwal October 5, 2026 14:43
Comment thread t/Test-consistency05.t Outdated
Co-authored-by: Marc van der Wal <103426270+marc-vanderwal@users.noreply.github.com>
marc-vanderwal
marc-vanderwal previously approved these changes Oct 6, 2026
@matsduf matsduf changed the title Corrects message and message argument Corrects message and message argument (Consistency05) Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-TestCase Area: Test case specification or implementation of test case RC-Fixes Release category: Fixes. T-Bug Type: Bug in software or error in test case description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CS05_OOD_ADDR_MISMATCH shows empty address lists (Consistency05)

2 participants