Skip to content

Rewrite Zone09 fully after specification update - #1543

Open
marc-vanderwal wants to merge 4 commits into
zonemaster:developfrom
marc-vanderwal:bugfix/zone09-false-warnings
Open

Rewrite Zone09 fully after specification update#1543
marc-vanderwal wants to merge 4 commits into
zonemaster:developfrom
marc-vanderwal:bugfix/zone09-false-warnings

Conversation

@marc-vanderwal

@marc-vanderwal marc-vanderwal commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

⚠️ Do not merge yet – Specification and test scenarios should be stable enough but should be merged first.

Purpose

This PR is a complete rewrite of the Zone09 test case, after its specification and test scenarios were updated.

The previous implementation had two main issues: firstly, MX RRsets were not sorted before comparison; secondly, MX RRsets that only differ by TTL values were not deemed equal, although we wanted them to compare equal. Now, only the preference and exchange fields of the RDATA are used for sorting and comparison.

Test scenarios were updated as well, so this commit also updates the corresponding unit tests. Said unit tests are ported to the DSL for good measure. When relevant, even the messages’ arguments are tested.

Context

See:

Changes

  • Complete rewrite of Zone09 implementation
  • Complete rewrite of Zone09 unit tests, leveraging the DSL
  • Require Perl 5.26 in lib/Zonemaster/Engine/Test/Zone.pm so that lexical subroutines (state sub) can be used inside methods
  • Also refactor Zone11 a little bit as a drive-by change

How to test this PR

Unit tests should still pass.

@marc-vanderwal marc-vanderwal added this to the v2026.1.1 milestone Jul 20, 2026
@marc-vanderwal marc-vanderwal added V-Patch Versioning: The change gives an update of patch in version. RC-Fixes Release category: Fixes. labels Jul 20, 2026
@matsduf

matsduf commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Is the failing unit test due to error in a hint file for the scenarios?

@marc-vanderwal
marc-vanderwal marked this pull request as draft July 20, 2026 07:53
@marc-vanderwal

marc-vanderwal commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

It’s an obsolete unit test file I forgot to delete. Previously, when different root hints are to be used for a scenario, that scenario had to go in a different .t file. This isn’t necessary anymore with the DSL-based tests.

Comment thread lib/Zonemaster/Engine/Test/Zone.pm
@marc-vanderwal
marc-vanderwal force-pushed the bugfix/zone09-false-warnings branch from b86c93f to b4b29bc Compare July 20, 2026 08:27
@marc-vanderwal
marc-vanderwal marked this pull request as ready for review July 20, 2026 08:31
Rewrite the implementation of Zone09 completely, after the specification
was updated.

The previous implementation had two main issues: firstly, MX RRsets were
not sorted before comparison; secondly, MX RRsets that only differ by
TTL values were not deemed equal, although we wanted them to compare
equal. Now, only the preference and exchange fields of the RDATA are
used for sorting and comparison.

Test scenarios were updated as well, so this commit also updates the
corresponding unit tests. Said unit tests are ported to the DSL for good
measure. When relevant, even the messages’ arguments are tested.
The rewriting of Zone09 also involved a migration from old Methods to
MethodsV2, leading to a few more DNS queries made to authoritative
servers in parent zones. The corresponding packets do not exist in the
corresponding t/Test-zone.data file, so running this unit test fails. It
cannot easily be rerecorded either and the .t file barely exercised the
code anyway, so we can afford not to run Zone09 in that legacy test.
Use the newly-introduced _is_non_mail_domain() method and rewrite the
logic of Zone11 in a way that is equivalent to the current logic, while
involving fewer nested ifs.
@marc-vanderwal
marc-vanderwal force-pushed the bugfix/zone09-false-warnings branch from b4b29bc to 00c3a82 Compare July 20, 2026 09:46
@matsduf

matsduf commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

⚠️ Draft PR – Specification and test scenarios should be stable enough but aren’t merged yet.

Is this still a draft PR?

@marc-vanderwal

Copy link
Copy Markdown
Contributor Author

⚠️ Draft PR – Specification and test scenarios should be stable enough but aren’t merged yet.

Is this still a draft PR?

It’s ready for review, but it shouldn’t be merged yet. I just hope that the specifications and the scenarios are stable enough so that this code is stable too.

@matsduf

matsduf commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

It’s ready for review, but it shouldn’t be merged yet. I just hope that the specifications and the scenarios are stable enough so that this code is stable too.

We should have an additional review on both PRs. I will soon review this PRs.

matsduf
matsduf previously approved these changes Jul 22, 2026

@matsduf matsduf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the scenarios with zonemaster-cli while updating the test-zones-output.md file. I have also inspected the normal output (non-raw). Everything looks fine and as expected.

@matsduf

matsduf commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
zonemaster-cli   --test zone09 --hints hintfile.zone --level info mx-data.zone09.xa

Seconds Level    Message
======= ======== =======
   0.00 INFO     Using version v9.0.0 of the Zonemaster engine.
   0.07 INFO     The MX RDATA in the MX RRset, "10 mail.mx-data.zone09.xa.", as returned by name servers "ns1.mx-data.zone09.xa/127.19.9.31;ns1.mx-data.zone09.xa/fda1:b2:c3:0:127:19:9:31;ns2.mx-data.zone09.xa/127.19.9.32;ns2.mx-data.zone09.xa/fda1:b2:c3:0:127:19:9:32".

The mail exchange domain name has a final dot '.' in the presentation, but in name/IP pairs the final dot is removed. It looks better and it is easier to read if the final dot of a domain name is always removed (unless it is the root node).

When converting an MX record’s RDATA to string form, the domain name in
the exchange field always had its trailing dot, like in the RDATA’s
presentation format. This commit omits that trailing dot unless the
exchange is the root domain.
@marc-vanderwal

Copy link
Copy Markdown
Contributor Author

The mail exchange domain name has a final dot '.' in the presentation, but in name/IP pairs the final dot is removed. It looks better and it is easier to read if the final dot of a domain name is always removed (unless it is the root node).

Good point. I’ve fixed that.

@matsduf

matsduf commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Yesterday I ran the same zonemaster-cli commands for the scenarios, but without --raw to inspect the msgids. That is when I saw the final dots. I think we have them from other test cases too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RC-Fixes Release category: Fixes. V-Patch Versioning: The change gives an update of patch in version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants