Add XAP registrar flag and drop DB defaults (#3222)

Expose the --expiry_access_period_enabled CLI flag on registrar mutation
commands and drop temporary database-level default constraints for XAP.

Specifically:
- Expose the --expiry_access_period_enabled parameter in
  CreateOrUpdateRegistrarCommand and pass it to
  Registrar.Builder.setExpiryAccessPeriodEnabled.
- Add expiryAccessPeriodTransitions with default DISABLED to example.yaml.
- Add unit tests for --expiry_access_period_enabled in
  CreateRegistrarCommandTest and UpdateRegistrarCommandTest.
- Add Flyway migrations V229 and V230 to drop the temporary database-level
  DEFAULT constraints on Tld.expiry_access_period_transitions and
  Registrar.expiry_access_period_enabled per db/README.md.
- Regenerate flyway.txt, nomulus.golden.sql, and ER diagrams.

TAG=agy
BUG=http://b/437398822
This commit is contained in:
Ben McIlwain
2026-08-31 16:36:29 +00:00
committed by GitHub
parent 275c65115b
commit 36dd7fbe06
10 changed files with 117 additions and 20 deletions
@@ -27,6 +27,8 @@ eapFeeSchedule:
currency: "USD"
amount: 0.00
escrowEnabled: false
expiryAccessPeriodTransitions:
"1970-01-01T00:00:00.000Z": "DISABLED"
idnTables: []
invoicingEnabled: false
lordnUsername: null
@@ -234,6 +234,13 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
arity = 1)
private Boolean registryLockAllowed;
@Nullable
@Parameter(
names = "--expiry_access_period_enabled",
description = "Whether this registrar is enabled for the Expiry Access Period",
arity = 1)
private Boolean expiryAccessPeriodEnabled;
@Nullable
@Parameter(
names = "--drive_folder_id",
@@ -384,6 +391,8 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
Optional.ofNullable(blockPremiumNames).ifPresent(builder::setBlockPremiumNames);
Optional.ofNullable(contactsRequireSyncing).ifPresent(builder::setContactsRequireSyncing);
Optional.ofNullable(registryLockAllowed).ifPresent(builder::setRegistryLockAllowed);
Optional.ofNullable(expiryAccessPeriodEnabled)
.ifPresent(builder::setExpiryAccessPeriodEnabled);
Optional.ofNullable(phonePasscode).ifPresent(builder::setPhonePasscode);
Optional.ofNullable(icannReferralEmail).ifPresent(builder::setIcannReferralEmail);
Optional.ofNullable(whoisServer).ifPresent(builder::setWhoisServer);
@@ -104,6 +104,7 @@ class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarCommand>
assertThat(registrar.getLastUpdateTime()).isEqualTo(registrar.getCreationTime());
assertThat(registrar.getBlockPremiumNames()).isFalse();
assertThat(registrar.isRegistryLockAllowed()).isFalse();
assertThat(registrar.getExpiryAccessPeriodEnabled()).isFalse();
assertThat(registrar.getPoNumber()).isEmpty();
assertThat(registrar.getIcannReferralEmail()).isEqualTo("foo@bar.test");
@@ -890,6 +891,50 @@ class CreateRegistrarCommandTest extends CommandTestCase<CreateRegistrarCommand>
assertThat(registrar.get().isRegistryLockAllowed()).isFalse();
}
@Test
void testSuccess_expiryAccessPeriodEnabled() throws Exception {
runCommandForced(
"--name=blobio",
"--password=some_password",
"--registrar_type=REAL",
"--iana_id=8",
"--expiry_access_period_enabled=true",
"--passcode=01234",
"--icann_referral_email=foo@bar.test",
"--street=\"123 Fake St\"",
"--city Fakington",
"--state MA",
"--zip 00351",
"--cc US",
"clientz");
Optional<Registrar> registrar = Registrar.loadByRegistrarId("clientz");
assertThat(registrar).isPresent();
assertThat(registrar.get().getExpiryAccessPeriodEnabled()).isTrue();
}
@Test
void testSuccess_expiryAccessPeriodDisabled() throws Exception {
runCommandForced(
"--name=blobio",
"--password=some_password",
"--registrar_type=REAL",
"--iana_id=8",
"--expiry_access_period_enabled=false",
"--passcode=01234",
"--icann_referral_email=foo@bar.test",
"--street=\"123 Fake St\"",
"--city Fakington",
"--state MA",
"--zip 00351",
"--cc US",
"clientz");
Optional<Registrar> registrar = Registrar.loadByRegistrarId("clientz");
assertThat(registrar).isPresent();
assertThat(registrar.get().getExpiryAccessPeriodEnabled()).isFalse();
}
@Test
void testFailure_badPhoneNumber() {
ParameterException thrown =
@@ -563,6 +563,21 @@ class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarCommand>
assertThat(loadRegistrar("NewRegistrar").isRegistryLockAllowed()).isFalse();
}
@Test
void testSuccess_expiryAccessPeriodEnabled() throws Exception {
assertThat(loadRegistrar("NewRegistrar").getExpiryAccessPeriodEnabled()).isFalse();
runCommandForced("--expiry_access_period_enabled=true", "NewRegistrar");
assertThat(loadRegistrar("NewRegistrar").getExpiryAccessPeriodEnabled()).isTrue();
}
@Test
void testSuccess_resetExpiryAccessPeriodEnabled() throws Exception {
persistResource(
loadRegistrar("NewRegistrar").asBuilder().setExpiryAccessPeriodEnabled(true).build());
runCommandForced("--expiry_access_period_enabled=false", "NewRegistrar");
assertThat(loadRegistrar("NewRegistrar").getExpiryAccessPeriodEnabled()).isFalse();
}
@Test
void testSuccess_unspecifiedBooleansArentChanged() throws Exception {
persistResource(
@@ -570,6 +585,7 @@ class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarCommand>
.asBuilder()
.setBlockPremiumNames(true)
.setContactsRequireSyncing(true)
.setExpiryAccessPeriodEnabled(true)
.build());
// Make some unrelated change where we don't specify the flags for the booleans.
runCommandForced("NewRegistrar");
@@ -577,6 +593,7 @@ class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarCommand>
Registrar reloadedRegistrar = loadRegistrar("NewRegistrar");
assertThat(reloadedRegistrar.getBlockPremiumNames()).isTrue();
assertThat(reloadedRegistrar.getContactsRequireSyncing()).isTrue();
assertThat(reloadedRegistrar.getExpiryAccessPeriodEnabled()).isTrue();
}
@Test