From b1d7fef5217027d5667161fd434d5d09dc01ce42 Mon Sep 17 00:00:00 2001 From: Gus Brodman Date: Mon, 5 Aug 2024 16:17:15 -0400 Subject: [PATCH] Use a config point for domain-contacts-optional We don't want to always have a feature flag for this, and once August 21 rolls around we can get rid of it in favor of a configuration point (once we no longer need minute control of the timing) --- .../registry/config/RegistryConfig.java | 12 ++++ .../config/RegistryConfigSettings.java | 1 + .../registry/config/files/default-config.yaml | 7 +++ .../flows/domain/DomainFlowUtils.java | 6 +- .../flows/domain/DomainUpdateFlow.java | 6 +- .../flows/EppLifecycleDomainTest.java | 9 --- .../registry/flows/EppLifecycleHostTest.java | 18 ------ .../registry/flows/EppPointInTimeTest.java | 12 ---- .../flows/domain/DomainCreateFlowTest.java | 62 ++++++------------- .../flows/domain/DomainUpdateFlowTest.java | 51 +++++---------- .../registry/tools/EppLifecycleToolsTest.java | 12 ---- .../domain/domain_create_response_eap_fee.xml | 2 +- .../domain_create_response_premium_eap.xml | 2 +- 13 files changed, 63 insertions(+), 137 deletions(-) diff --git a/core/src/main/java/google/registry/config/RegistryConfig.java b/core/src/main/java/google/registry/config/RegistryConfig.java index 6fd282867dd..5eab35c1b98 100644 --- a/core/src/main/java/google/registry/config/RegistryConfig.java +++ b/core/src/main/java/google/registry/config/RegistryConfig.java @@ -1793,6 +1793,18 @@ public static ImmutableSet getTieredPricingPromotionRegistrarIds() { CONFIG_SETTINGS.get().registryPolicy.tieredPricingPromotionRegistrarIds); } + /** + * If the registry stores the minimum data set according to the ICANN Registration Data Policy. + * + *

See the + * ICANN policy for more details. One significant change that this indicates is that the + * registry will not require contact information on domain creations. Eventually, contact + * information will be forbidden if the registry uses the minimum data set. + */ + public static boolean useMinimumDataset() { + return CONFIG_SETTINGS.get().registryPolicy.useMinimumDataset; + } + /** * Memoizes loading of the {@link RegistryConfigSettings} POJO. * diff --git a/core/src/main/java/google/registry/config/RegistryConfigSettings.java b/core/src/main/java/google/registry/config/RegistryConfigSettings.java index 2385851abdf..963135c5396 100644 --- a/core/src/main/java/google/registry/config/RegistryConfigSettings.java +++ b/core/src/main/java/google/registry/config/RegistryConfigSettings.java @@ -114,6 +114,7 @@ public static class RegistryPolicy { public boolean requireSslCertificates; public double sunriseDomainCreateDiscount; public Set tieredPricingPromotionRegistrarIds; + public boolean useMinimumDataset; } /** Configuration for Hibernate. */ diff --git a/core/src/main/java/google/registry/config/files/default-config.yaml b/core/src/main/java/google/registry/config/files/default-config.yaml index 1c5ddc1044e..a191a33a657 100644 --- a/core/src/main/java/google/registry/config/files/default-config.yaml +++ b/core/src/main/java/google/registry/config/files/default-config.yaml @@ -210,6 +210,13 @@ registryPolicy: # domain create requests. tieredPricingPromotionRegistrarIds: [] + # Whether the registry is (or will be) using the ICANN minimum dataset or + # not. If true, contacts will be optional for domain creations, and eventually + # contacts will be forbidden for domain creations. If false, then the registry + # will continue to sture contact information on domains. See + # https://www.icann.org/resources/pages/registration-data-policy-2024-02-21-en for more. + useMinimumDataset: true + hibernate: # If set to false, calls to tm().transact() cannot be nested. If set to true, # nested calls to tm().transact() are allowed, as long as they do not specify diff --git a/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java b/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java index 1dba91f04fd..ce357dfa64f 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java +++ b/core/src/main/java/google/registry/flows/domain/DomainFlowUtils.java @@ -24,8 +24,6 @@ import static com.google.common.collect.Sets.intersection; import static com.google.common.collect.Sets.union; import static google.registry.bsa.persistence.BsaLabelUtils.isLabelBlocked; -import static google.registry.model.common.FeatureFlag.FeatureName.MINIMUM_DATASET_CONTACTS_OPTIONAL; -import static google.registry.model.common.FeatureFlag.isActiveNow; import static google.registry.model.domain.Domain.MAX_REGISTRATION_YEARS; import static google.registry.model.domain.token.AllocationToken.TokenType.REGISTER_BSA; import static google.registry.model.tld.Tld.TldState.GENERAL_AVAILABILITY; @@ -66,6 +64,7 @@ import com.google.common.collect.Sets; import com.google.common.collect.Streams; import com.google.common.net.InternetDomainName; +import google.registry.config.RegistryConfig; import google.registry.flows.EppException; import google.registry.flows.EppException.AssociationProhibitsOperationException; import google.registry.flows.EppException.AuthorizationErrorException; @@ -486,8 +485,7 @@ static void validateNoDuplicateContacts(Set contacts) static void validateRequiredContactsPresentIfRequiredForDataset( Optional> registrant, Set contacts) throws RequiredParameterMissingException { - // TODO(b/353347632): Change this flag check to a registry config check. - if (isActiveNow(MINIMUM_DATASET_CONTACTS_OPTIONAL)) { + if (RegistryConfig.useMinimumDataset()) { // Contacts are not required once we have begun the migration to the minimum dataset return; } diff --git a/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java b/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java index a6ad8beeda3..2704b97a5b5 100644 --- a/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java +++ b/core/src/main/java/google/registry/flows/domain/DomainUpdateFlow.java @@ -41,8 +41,6 @@ import static google.registry.flows.domain.DomainFlowUtils.validateRequiredContactsPresentIfRequiredForDataset; import static google.registry.flows.domain.DomainFlowUtils.verifyClientUpdateNotProhibited; import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDelete; -import static google.registry.model.common.FeatureFlag.FeatureName.MINIMUM_DATASET_CONTACTS_OPTIONAL; -import static google.registry.model.common.FeatureFlag.isActiveNow; import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_UPDATE; import static google.registry.persistence.transaction.TransactionManagerFactory.tm; @@ -52,6 +50,7 @@ import com.google.common.collect.Ordering; import com.google.common.collect.Sets; import com.google.common.net.InternetDomainName; +import google.registry.config.RegistryConfig; import google.registry.flows.EppException; import google.registry.flows.ExtensionManager; import google.registry.flows.FlowModule.RegistrarId; @@ -308,8 +307,7 @@ private Optional> determineUpdatedRegistrant(Change change, Domain // During phase 1 of minimum dataset transition, allow registrant to be removed if (change.getRegistrantContactId().isPresent() && change.getRegistrantContactId().get().isEmpty()) { - // TODO(b/353347632): Change this flag check to a registry config check. - if (isActiveNow(MINIMUM_DATASET_CONTACTS_OPTIONAL)) { + if (RegistryConfig.useMinimumDataset()) { return Optional.empty(); } else { throw new MissingRegistrantException(); diff --git a/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java b/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java index 9e5c516c664..ac226f007ba 100644 --- a/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java +++ b/core/src/test/java/google/registry/flows/EppLifecycleDomainTest.java @@ -16,8 +16,6 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.EppResourceUtils.loadByForeignKey; -import static google.registry.model.common.FeatureFlag.FeatureName.MINIMUM_DATASET_CONTACTS_OPTIONAL; -import static google.registry.model.common.FeatureFlag.FeatureStatus.INACTIVE; import static google.registry.model.eppoutput.Result.Code.SUCCESS; import static google.registry.model.eppoutput.Result.Code.SUCCESS_AND_CLOSE; import static google.registry.model.eppoutput.Result.Code.SUCCESS_WITH_ACTION_PENDING; @@ -42,7 +40,6 @@ import com.google.re2j.Pattern; import google.registry.model.billing.BillingBase.Reason; import google.registry.model.billing.BillingEvent; -import google.registry.model.common.FeatureFlag; import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.reporting.HistoryEntry.Type; @@ -76,12 +73,6 @@ class EppLifecycleDomainTest extends EppTestCase { @BeforeEach void beforeEach() { - persistResource( - new FeatureFlag() - .asBuilder() - .setFeatureName(MINIMUM_DATASET_CONTACTS_OPTIONAL) - .setStatusMap(ImmutableSortedMap.of(START_OF_TIME, INACTIVE)) - .build()); createTlds("example", "tld"); } diff --git a/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java b/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java index 734e9060504..b48fa227248 100644 --- a/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java +++ b/core/src/test/java/google/registry/flows/EppLifecycleHostTest.java @@ -16,19 +16,13 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.EppResourceUtils.loadByForeignKey; -import static google.registry.model.common.FeatureFlag.FeatureName.MINIMUM_DATASET_CONTACTS_OPTIONAL; -import static google.registry.model.common.FeatureFlag.FeatureStatus.INACTIVE; import static google.registry.model.eppoutput.Result.Code.SUCCESS; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.createTlds; -import static google.registry.testing.DatabaseHelper.persistResource; import static google.registry.testing.EppMetricSubject.assertThat; import static google.registry.testing.HostSubject.assertAboutHosts; -import static google.registry.util.DateTimeUtils.START_OF_TIME; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSortedMap; -import google.registry.model.common.FeatureFlag; import google.registry.model.domain.Domain; import google.registry.model.host.Host; import google.registry.persistence.transaction.JpaTestExtensions; @@ -94,12 +88,6 @@ void testLifecycle() throws Exception { @Test void testRenamingHostToExistingHost_fails() throws Exception { - persistResource( - new FeatureFlag() - .asBuilder() - .setFeatureName(MINIMUM_DATASET_CONTACTS_OPTIONAL) - .setStatusMap(ImmutableSortedMap.of(START_OF_TIME, INACTIVE)) - .build()); createTld("example"); assertThatLoginSucceeds("NewRegistrar", "foo-BAR2"); // Create the fakesite domain. @@ -150,12 +138,6 @@ void testRenamingHostToExistingHost_fails() throws Exception { @Test void testSuccess_multipartTldsWithSharedSuffixes() throws Exception { - persistResource( - new FeatureFlag() - .asBuilder() - .setFeatureName(MINIMUM_DATASET_CONTACTS_OPTIONAL) - .setStatusMap(ImmutableSortedMap.of(START_OF_TIME, INACTIVE)) - .build()); createTlds("bar.foo.tld", "foo.tld", "tld"); assertThatLoginSucceeds("NewRegistrar", "foo-BAR2"); diff --git a/core/src/test/java/google/registry/flows/EppPointInTimeTest.java b/core/src/test/java/google/registry/flows/EppPointInTimeTest.java index b9cae7f09c3..2bb1108e16a 100644 --- a/core/src/test/java/google/registry/flows/EppPointInTimeTest.java +++ b/core/src/test/java/google/registry/flows/EppPointInTimeTest.java @@ -17,24 +17,18 @@ import static com.google.common.truth.Truth.assertThat; import static google.registry.model.EppResourceUtils.loadAtPointInTime; import static google.registry.model.ImmutableObjectSubject.assertAboutImmutableObjects; -import static google.registry.model.common.FeatureFlag.FeatureName.MINIMUM_DATASET_CONTACTS_OPTIONAL; -import static google.registry.model.common.FeatureFlag.FeatureStatus.INACTIVE; import static google.registry.testing.DatabaseHelper.createTld; import static google.registry.testing.DatabaseHelper.loadAllOf; import static google.registry.testing.DatabaseHelper.loadByEntity; import static google.registry.testing.DatabaseHelper.persistActiveContact; import static google.registry.testing.DatabaseHelper.persistActiveHost; -import static google.registry.testing.DatabaseHelper.persistResource; -import static google.registry.util.DateTimeUtils.START_OF_TIME; import static java.nio.charset.StandardCharsets.UTF_8; import static org.joda.time.DateTimeZone.UTC; import static org.joda.time.Duration.standardDays; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.Iterables; import google.registry.flows.EppTestComponent.FakesAndMocksModule; -import google.registry.model.common.FeatureFlag; import google.registry.model.domain.Domain; import google.registry.monitoring.whitebox.EppMetric; import google.registry.persistence.transaction.JpaTestExtensions; @@ -60,12 +54,6 @@ class EppPointInTimeTest { @BeforeEach void beforeEach() { - persistResource( - new FeatureFlag() - .asBuilder() - .setFeatureName(MINIMUM_DATASET_CONTACTS_OPTIONAL) - .setStatusMap(ImmutableSortedMap.of(START_OF_TIME, INACTIVE)) - .build()); createTld("tld"); } diff --git a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java index a7b2f87e5b7..9d36a5b7630 100644 --- a/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java +++ b/core/src/test/java/google/registry/flows/domain/DomainCreateFlowTest.java @@ -25,9 +25,6 @@ import static google.registry.model.billing.BillingBase.RenewalPriceBehavior.DEFAULT; import static google.registry.model.billing.BillingBase.RenewalPriceBehavior.NONPREMIUM; import static google.registry.model.billing.BillingBase.RenewalPriceBehavior.SPECIFIED; -import static google.registry.model.common.FeatureFlag.FeatureName.MINIMUM_DATASET_CONTACTS_OPTIONAL; -import static google.registry.model.common.FeatureFlag.FeatureStatus.ACTIVE; -import static google.registry.model.common.FeatureFlag.FeatureStatus.INACTIVE; import static google.registry.model.domain.fee.Fee.FEE_EXTENSION_URIS; import static google.registry.model.domain.token.AllocationToken.TokenType.BULK_PRICING; import static google.registry.model.domain.token.AllocationToken.TokenType.DEFAULT_PROMO; @@ -159,7 +156,6 @@ import google.registry.model.billing.BillingBase.RenewalPriceBehavior; import google.registry.model.billing.BillingEvent; import google.registry.model.billing.BillingRecurrence; -import google.registry.model.common.FeatureFlag; import google.registry.model.domain.Domain; import google.registry.model.domain.DomainHistory; import google.registry.model.domain.GracePeriod; @@ -202,6 +198,7 @@ import org.joda.money.Money; import org.joda.time.DateTime; import org.joda.time.Duration; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junitpioneer.jupiter.cartesian.CartesianTest; @@ -225,6 +222,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase USD 24.00 - 100.00 + 100.00 diff --git a/core/src/test/resources/google/registry/flows/domain/domain_create_response_premium_eap.xml b/core/src/test/resources/google/registry/flows/domain/domain_create_response_premium_eap.xml index 2854b478cf1..b5bdbc0bf25 100644 --- a/core/src/test/resources/google/registry/flows/domain/domain_create_response_premium_eap.xml +++ b/core/src/test/resources/google/registry/flows/domain/domain_create_response_premium_eap.xml @@ -15,7 +15,7 @@ USD 200.00 - 100.00 + 100.00