Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile fixes #1356

Merged
merged 5 commits into from
Jul 4, 2024
Merged

Conversation

mattias-p
Copy link
Member

@mattias-p mattias-p commented Jun 4, 2024

Purpose

The initial aim of this PR was to add some missing properties to the default profile. But in the process of making the update I discovered more problems with the profile and I'm including fixes for all of them here.

Context

Fixes #1355.

Conflicts but is not blocked by #1257.

I marked this minor because of the new Zonemaster::Engine::Profile->all_properties method. Otherwise this would be V-Patch.

Changes

  • The default value for one property is specified:
    • cache
  • The default values for some properties are implemented:
    • asnroots
    • cache
  • Validation error messages are updated to state that the empty string is a valid value for some properties:
    • resolver.source4
    • resolver.source6
  • Unit tests for invariants that cover all properties are updated to loop over the properties. Historically we tried and failed to include all properties in these tests.
    • 'new() returns a profile with all properties unset'
    • 'default() returns a profile with all properties set'
    • 'from_json("{}") returns a profile with all properties unset'
    • 'set() dies on attempts to unset properties'
  • A new method is introduced to facilitate the improved unit testing:
    • Zonemaster::Engine::Profile->all_properties()

How to test this PR

Run the unit tests.

@mattias-p mattias-p added the V-Minor Versioning: The change gives an update of minor in version. label Jun 4, 2024
@mattias-p mattias-p added this to the v2024.1 milestone Jun 4, 2024
@mattias-p mattias-p marked this pull request as draft June 4, 2024 09:26
Comment on lines 89 to 90
if ( $_[0] ne $RESOLVER_SOURCE_OS_DEFAULT and not Net::IP::XS->new( $_[0] ) ) {
die "Property resolver.source must be an IP address or the exact string $RESOLVER_SOURCE_OS_DEFAULT";
Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I can see Net::IP::XS->new( "10.0.1/24" ) is true.

@tgreenx
Copy link
Contributor

tgreenx commented Jun 4, 2024

Conflicts with #1343. That one should be merged first.

FYI this also conflicts with #1257 which removes the deprecated asnroots property.

@mattias-p
Copy link
Member Author

FYI this also conflicts with #1257 which removes the deprecated asnroots property.

True. I'd prefer if we could merge these two PRs in any order though, and whoever comes in second place gets to rebase. Is that okay with you?

@matsduf matsduf modified the milestones: v2024.1, v2024.2 Jun 10, 2024
The profile module specifies a contract that each profile property must
respect. This change makes all properties respect the contract with
regard to definedness, default values and hierarchy.

To ease upholding certain aspects of the contract the new utility method
all_properties() was added.

Validation error messages for resolver.source4 and resolver.source6 are
clarified regarding the empty string.
@mattias-p mattias-p force-pushed the 1355-profile-contract branch from ff0984d to 5f5edfb Compare June 25, 2024 10:31
@mattias-p mattias-p marked this pull request as ready for review June 25, 2024 10:37
Copy link
Contributor

@marc-vanderwal marc-vanderwal left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Contributor

@MichaelTimbert MichaelTimbert left a comment

Choose a reason for hiding this comment

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

Good for me

@mattias-p mattias-p merged commit 07bea1c into zonemaster:develop Jul 4, 2024
3 checks passed
@tgreenx tgreenx linked an issue Dec 3, 2024 that may be closed by this pull request
@tgreenx tgreenx added the S-ReleaseTested Status: The PR has been successfully tested in release testing label Dec 4, 2024
@tgreenx
Copy link
Contributor

tgreenx commented Dec 4, 2024

Release testing v2024.2: no issues found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-ReleaseTested Status: The PR has been successfully tested in release testing V-Minor Versioning: The change gives an update of minor in version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing profile properties
5 participants