Skip to content

Verify billing recurrence expansion is caught up before invoicing#3121

Merged
gbrodman merged 1 commit into
google:masterfrom
gbrodman:billingCursor
Jul 7, 2026
Merged

Verify billing recurrence expansion is caught up before invoicing#3121
gbrodman merged 1 commit into
google:masterfrom
gbrodman:billingCursor

Conversation

@gbrodman

@gbrodman gbrodman commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

This change is Reviewable

@gbrodman gbrodman added the kokoro:force-run Force a Kokoro build. label Jun 29, 2026
@domain-registry-eng domain-registry-eng removed the kokoro:force-run Force a Kokoro build. label Jun 29, 2026
@gbrodman gbrodman requested a review from CydeWeys July 1, 2026 17:40

@CydeWeys CydeWeys left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@CydeWeys made 1 comment.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on gbrodman).


core/src/main/java/google/registry/reporting/billing/GenerateInvoicesAction.java line 122 at r1 (raw file):

                  () ->
                      tm().loadByKeyIfPresent(Cursor.createGlobalVKey(RECURRING_BILLING))
                          .orElse(Cursor.createGlobal(RECURRING_BILLING, START_INSTANT))

This is a round-about, semi-confusing way to handle the simple case of "the cursor doesn't exist".

This is clearer to me:

Optional<Cursor> lastBillingExpansion = .... tm().loadByKeyIfPresent(...);
checkState(lastBillingExpansion.isPresent() && lastBillingExpansion.get().getCursorTime().isBefore(...), ...);

@CydeWeys CydeWeys left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@CydeWeys made 2 comments.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on gbrodman).


core/src/main/java/google/registry/reporting/billing/GenerateInvoicesAction.java line 122 at r1 (raw file):

Previously, CydeWeys (Ben McIlwain) wrote…

This is a round-about, semi-confusing way to handle the simple case of "the cursor doesn't exist".

This is clearer to me:

Optional<Cursor> lastBillingExpansion = .... tm().loadByKeyIfPresent(...);
checkState(lastBillingExpansion.isPresent() && lastBillingExpansion.get().getCursorTime().isBefore(...), ...);

Or maybe broken up into two separate checkState() calls for clearer error messages.


core/src/main/java/google/registry/reporting/billing/GenerateInvoicesAction.java line 126 at r1 (raw file):

      checkState(
          !cursorTime.isBefore(startOfNextMonth),
          "BillingRecurrence expansion cursor (%s) is before the start of the next month (%s). "

As currently written, this error message can be a little confusing, as it will say the cursor value is START_OF_TIME when the actual problem is that it doesn't exist.

@CydeWeys CydeWeys left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@CydeWeys made 1 comment.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on gbrodman).


core/src/main/java/google/registry/reporting/billing/GenerateInvoicesAction.java line 126 at r1 (raw file):

Previously, CydeWeys (Ben McIlwain) wrote…

As currently written, this error message can be a little confusing, as it will say the cursor value is START_OF_TIME when the actual problem is that it doesn't exist.

(Well, it would say that the actual cursor value is 1970-01-01-...., which you'd have to know means START_OF_TIME, so even worse.)

@gbrodman gbrodman left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@gbrodman made 2 comments.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on CydeWeys).


core/src/main/java/google/registry/reporting/billing/GenerateInvoicesAction.java line 122 at r1 (raw file):

Previously, CydeWeys (Ben McIlwain) wrote…

Or maybe broken up into two separate checkState() calls for clearer error messages.

sure, splitting things up is always good


core/src/main/java/google/registry/reporting/billing/GenerateInvoicesAction.java line 126 at r1 (raw file):

Previously, CydeWeys (Ben McIlwain) wrote…

(Well, it would say that the actual cursor value is 1970-01-01-...., which you'd have to know means START_OF_TIME, so even worse.)

sure

@CydeWeys CydeWeys left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@CydeWeys reviewed 2 files and all commit messages, and resolved 2 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on gbrodman).

@gbrodman gbrodman added this pull request to the merge queue Jul 7, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 7, 2026
@gbrodman gbrodman added this pull request to the merge queue Jul 7, 2026
Merged via the queue into google:master with commit b1e42cf Jul 7, 2026
16 checks passed
@gbrodman gbrodman deleted the billingCursor branch July 7, 2026 19:27
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