Skip to content

Migrate bsa, dns, batch, and reporting packages to java.time#3031

Open
CydeWeys wants to merge 1 commit intogoogle:masterfrom
CydeWeys:javatime-refactor-8th
Open

Migrate bsa, dns, batch, and reporting packages to java.time#3031
CydeWeys wants to merge 1 commit intogoogle:masterfrom
CydeWeys:javatime-refactor-8th

Conversation

@CydeWeys
Copy link
Copy Markdown
Member

@CydeWeys CydeWeys commented Apr 30, 2026

This change is Reviewable

@CydeWeys CydeWeys force-pushed the javatime-refactor-8th branch from 2fb2275 to 28812b7 Compare May 1, 2026 22:22
this.sigOutput = sigOutput;
signer = closer.register(new RydePgpSigningOutputStream(checkNotNull(rydeOutput), signingKey));
signer =
closer.register(new RydePgpSigningOutputStream(checkNotNull(receiverOutput), signingKey));
// If cursor time is before now, upload the corresponding report
cursors.entrySet().stream()
.filter(entry -> entry.getKey().getCursorTime().isBefore(clock.nowUtc()))
.filter(entry -> toInstant(entry.getKey().getCursorTime()).isBefore(clock.now()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

private void uploadReport(
Cursor cursor, String tldStr, ImmutableMap.Builder<String, Boolean> reportSummaryBuilder) {
DateTime cursorTime = cursor.getCursorTime();
Instant cursorTime = toInstant(cursor.getCursorTime());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

Cursor cursor =
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld")));
assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-02T10:00:00Z"));
assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-08-02T10:00:00Z"));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

Cursor cursor =
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld")));
assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ"));
assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-07-01T00:00:00Z"));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

Cursor cursor =
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("foo")));
assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ"));
assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-07-01T00:00:00Z"));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

Cursor newActivityCursor =
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("new")));
assertThat(newActivityCursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-02T10:00:00Z"));
assertThat(toInstant(newActivityCursor.getCursorTime()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_TX, Tld.get("new")));
assertThat(newTransactionCursor.getCursorTime())
.isEqualTo(DateTime.parse("2006-08-02T10:00:00Z"));
assertThat(toInstant(newTransactionCursor.getCursorTime()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

@CydeWeys CydeWeys force-pushed the javatime-refactor-8th branch 2 times, most recently from 702da9d to a0b8231 Compare May 5, 2026 20:07
@CydeWeys CydeWeys enabled auto-merge May 5, 2026 20:07
@CydeWeys CydeWeys requested a review from gbrodman May 5, 2026 20:07
This commit migrates the BSA, DNS, batch, and reporting packages from Joda-Time
to java.time. Key changes include:

- Updated Sleeper, Clock, and BigqueryUtils to use java.time types natively.
- Refactored models like RdeRevision and Tld to eliminate redundant Joda
  conversions, utilizing new DateTimeUtils static utilities for LocalDate.
- Improved test safety by replacing dynamic Instant.now() calls with static
  parsed constants.
- Migrated temporal arithmetic in test suites to use DateTimeUtils convenience
  methods (plusDays, minusDays).
- Updated BigqueryUtils serialization to preserve millisecond precision and
  formatting for large years, ensuring consistency with previous Joda behavior.
- Enhanced code readability by converting long concatenated strings to Java
  text blocks in LordnLogTest.
- Resolved environmental test failures in SyncRegistrarsSheetTest by
  synchronizing the FakeClock with the JPA extension.
- Updated project engineering standards (GEMINI.md) to prefer Truth's
  .hasValue() for Optional assertions.

Verified with a clean full build and all relevant test suites passing.
@CydeWeys CydeWeys force-pushed the javatime-refactor-8th branch from a0b8231 to 67bdec7 Compare May 5, 2026 20:14
Copy link
Copy Markdown
Collaborator

@gbrodman gbrodman left a comment

Choose a reason for hiding this comment

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

@gbrodman reviewed 184 files and all commit messages, and made 11 comments.
Reviewable status: all files reviewed, 12 unresolved discussions (waiting on CydeWeys).


core/src/main/java/google/registry/rde/RdeUtils.java line 41 at r3 (raw file):

  private static final int PEEK_SIZE = 2048;

  public static final DateTimeFormatter RDE_WATERMARK_FORMATTER =

this is used in more than just RDE, maybe consider moving it to a more generic class?


core/src/main/java/google/registry/rde/RydeEncoder.java line 144 at r3 (raw file):

    /** Returns the built {@link RydeEncoder}. */
    public RydeEncoder build() throws IOException {

why are these exceptions added?


core/src/main/java/google/registry/rde/RydeTar.java line 47 at r3 (raw file):

  static ImprovedOutputStream openTarWriter(
      @WillNotClose OutputStream os, long expectedSize, String filename, Instant modified)
      throws IOException {

why did it make these changes?


core/src/test/java/google/registry/batch/BulkDomainTransferActionTest.java line 82 at r3 (raw file):

        persistResource(
            persistDomainWithDependentResources(
                    "pendingdelete", "tld", now, minusDays(now, 1), plusDays(now, 30))

why are you switching the plusMonths to plusDays in this test?

// If cursor time is before now, upload the corresponding report
cursors.entrySet().stream()
.filter(entry -> entry.getKey().getCursorTime().isBefore(clock.nowUtc()))
.filter(entry -> toInstant(entry.getKey().getCursorTime()).isBefore(clock.now()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

private void uploadReport(
Cursor cursor, String tldStr, ImmutableMap.Builder<String, Boolean> reportSummaryBuilder) {
DateTime cursorTime = cursor.getCursorTime();
Instant cursorTime = toInstant(cursor.getCursorTime());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

Cursor cursor =
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld")));
assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-02T10:00:00Z"));
assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-08-02T10:00:00Z"));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

Cursor cursor =
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("tld")));
assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ"));
assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-07-01T00:00:00Z"));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

Cursor cursor =
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("foo")));
assertThat(cursor.getCursorTime()).isEqualTo(DateTime.parse("2006-07-01TZ"));
assertThat(toInstant(cursor.getCursorTime())).isEqualTo(Instant.parse("2006-07-01T00:00:00Z"));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

Cursor newActivityCursor =
loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_ACTIVITY, Tld.get("new")));
assertThat(newActivityCursor.getCursorTime()).isEqualTo(DateTime.parse("2006-08-02T10:00:00Z"));
assertThat(toInstant(newActivityCursor.getCursorTime()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

loadByKey(Cursor.createScopedVKey(CursorType.ICANN_UPLOAD_TX, Tld.get("new")));
assertThat(newTransactionCursor.getCursorTime())
.isEqualTo(DateTime.parse("2006-08-02T10:00:00Z"));
assertThat(toInstant(newTransactionCursor.getCursorTime()))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pls fix

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants