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

Use a config point for domain-contacts-optional #2521

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/src/main/java/google/registry/config/RegistryConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,18 @@ public static ImmutableSet<String> getTieredPricingPromotionRegistrarIds() {
CONFIG_SETTINGS.get().registryPolicy.tieredPricingPromotionRegistrarIds);
}

/**
* If the registry stores the minimum data set according to the ICANN Registration Data Policy.
*
* <p>See <a href=https://www.icann.org/resources/pages/registration-data-policy-2024-02-21-en>the
* ICANN policy</a> 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public static class RegistryPolicy {
public boolean requireSslCertificates;
public double sunriseDomainCreateDiscount;
public Set<String> tieredPricingPromotionRegistrarIds;
public boolean useMinimumDataset;
}

/** Configuration for Hibernate. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -486,8 +485,7 @@ static void validateNoDuplicateContacts(Set<DesignatedContact> contacts)
static void validateRequiredContactsPresentIfRequiredForDataset(
Optional<VKey<Contact>> registrant, Set<DesignatedContact> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down Expand Up @@ -308,8 +307,7 @@ private Optional<VKey<Contact>> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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");
}

Expand Down
18 changes: 0 additions & 18 deletions core/src/test/java/google/registry/flows/EppLifecycleHostTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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");
Expand Down
12 changes: 0 additions & 12 deletions core/src/test/java/google/registry/flows/EppPointInTimeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -225,6 +222,7 @@ class DomainCreateFlowTest extends ResourceFlowTestCase<DomainCreateFlow, Domain
TmchData.readEncodedSignedMark(TmchTestData.loadFile(SMD_FILE_PATH)).getEncodedData();

private AllocationToken allocationToken;
private boolean cachedUseMinimumDataset;

DomainCreateFlowTest() {
setEppInput("domain_create.xml", ImmutableMap.of("DOMAIN", "example.tld"));
Expand Down Expand Up @@ -254,13 +252,13 @@ void initCreateTest() throws Exception {
"badcrash,NAME_COLLISION"),
persistReservedList("global-list", "resdom,FULLY_BLOCKED"))
.build());
persistResource(
new FeatureFlag()
.asBuilder()
.setFeatureName(MINIMUM_DATASET_CONTACTS_OPTIONAL)
.setStatusMap(ImmutableSortedMap.of(START_OF_TIME, INACTIVE))
.build());
persistClaimsList(ImmutableMap.of("example-one", CLAIMS_KEY, "test-validate", CLAIMS_KEY));
cachedUseMinimumDataset = RegistryConfig.useMinimumDataset();
}

@AfterEach
void afterEach() {
RegistryConfig.CONFIG_SETTINGS.get().registryPolicy.useMinimumDataset = cachedUseMinimumDataset;
}

private void enrollTldInBsa() {
Expand Down Expand Up @@ -2156,87 +2154,67 @@ void testFailure_missingContactType() {
}

@Test
void testFailure_missingRegistrant() {
void testFailure_thickRegistry_missingRegistrant() {
RegistryConfig.CONFIG_SETTINGS.get().registryPolicy.useMinimumDataset = false;
setEppInput("domain_create_missing_registrant.xml");
persistContactsAndHosts();
EppException thrown = assertThrows(MissingRegistrantException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

@Test
void testSuccess_minimumDatasetPhase1_missingRegistrant() throws Exception {
persistResource(
FeatureFlag.get(MINIMUM_DATASET_CONTACTS_OPTIONAL)
.asBuilder()
.setStatusMap(
ImmutableSortedMap.of(START_OF_TIME, INACTIVE, clock.nowUtc().minusDays(5), ACTIVE))
.build());
void testSuccess_thinRegistry_missingRegistrant() throws Exception {
setEppInput("domain_create_missing_registrant.xml");
persistContactsAndHosts();
runFlowAssertResponse(
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
}

@Test
void testFailure_missingAdmin() {
void testFailure_thickRegistry_missingAdmin() {
RegistryConfig.CONFIG_SETTINGS.get().registryPolicy.useMinimumDataset = false;
setEppInput("domain_create_missing_admin.xml");
persistContactsAndHosts();
EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

@Test
void testSuccess_minimumDatasetPhase1_missingAdmin() throws Exception {
persistResource(
FeatureFlag.get(MINIMUM_DATASET_CONTACTS_OPTIONAL)
.asBuilder()
.setStatusMap(
ImmutableSortedMap.of(START_OF_TIME, INACTIVE, clock.nowUtc().minusDays(5), ACTIVE))
.build());
void testSuccess_thinRegistry_missingAdmin() throws Exception {
setEppInput("domain_create_missing_admin.xml");
persistContactsAndHosts();
runFlowAssertResponse(
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
}

@Test
void testFailure_missingTech() {
void testFailure_thickRegistry_missingTech() {
RegistryConfig.CONFIG_SETTINGS.get().registryPolicy.useMinimumDataset = false;
setEppInput("domain_create_missing_tech.xml");
persistContactsAndHosts();
EppException thrown = assertThrows(MissingTechnicalContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

@Test
void testSuccess_minimumDatasetPhase1_missingTech() throws Exception {
persistResource(
FeatureFlag.get(MINIMUM_DATASET_CONTACTS_OPTIONAL)
.asBuilder()
.setStatusMap(
ImmutableSortedMap.of(START_OF_TIME, INACTIVE, clock.nowUtc().minusDays(5), ACTIVE))
.build());
void testSuccess_thinRegistry_missingTech() throws Exception {
setEppInput("domain_create_missing_tech.xml");
persistContactsAndHosts();
runFlowAssertResponse(
loadFile("domain_create_response.xml", ImmutableMap.of("DOMAIN", "example.tld")));
}

@Test
void testFailure_missingNonRegistrantContacts() {
void testFailure_thickRegistry_missingNonRegistrantContacts() {
RegistryConfig.CONFIG_SETTINGS.get().registryPolicy.useMinimumDataset = false;
setEppInput("domain_create_missing_non_registrant_contacts.xml");
persistContactsAndHosts();
EppException thrown = assertThrows(MissingAdminContactException.class, this::runFlow);
assertAboutEppExceptions().that(thrown).marshalsToXml();
}

@Test
void testSuccess_minimumDatasetPhase1_missingNonRegistrantContacts() throws Exception {
persistResource(
FeatureFlag.get(MINIMUM_DATASET_CONTACTS_OPTIONAL)
.asBuilder()
.setStatusMap(
ImmutableSortedMap.of(START_OF_TIME, INACTIVE, clock.nowUtc().minusDays(5), ACTIVE))
.build());
void testSuccess_thinRegistry_missingNonRegistrantContacts() throws Exception {
setEppInput("domain_create_missing_non_registrant_contacts.xml");
persistContactsAndHosts();
runFlowAssertResponse(
Expand Down
Loading
Loading