Skip to content

Clarify bulk compliance day-40 warning logic - #3277

Closed
CydeWeys wants to merge 1 commit into
google:masterfrom
CydeWeys:fix-bulk-compliance-day40-check
Closed

CydeWeys wants to merge 1 commit into
google:masterfrom
CydeWeys:fix-bulk-compliance-day40-check

Conversation

@CydeWeys

@CydeWeys CydeWeys commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Fix the inverted inline comment introduced in PR #2422 and replace the
opaque Integer.MAX_VALUE sentinel in CheckBulkComplianceAction's
handleActiveDomainOverage() with explicit control flow across all four
notification states:

  • Never notified (Optional.empty()): send initial 30-day cure warning.
  • < 30 days since last notification: cure window active, send nothing.
  • 30-39 days since last notification: uncured warning, send upgrade
    notice.
  • = 40 days since last notification: prior violation was cured during
    days 30-39 (lastNotificationSent is not cleared when activeDomains
    returns below maxDomains), so treat as a new violation episode and
    send a fresh 30-day warning.

Add unit tests in CheckBulkComplianceActionTest covering never-notified
packages and exact day-29, day-30, day-39, and day-40 boundaries.

BUG= http://b/586480278


This change is Reviewable

Fix the inverted inline comment introduced in PR google#2422 and replace the
opaque Integer.MAX_VALUE sentinel in CheckBulkComplianceAction's
handleActiveDomainOverage() with explicit control flow across all four
notification states:
- Never notified (Optional.empty()): send initial 30-day cure warning.
- < 30 days since last notification: cure window active, send nothing.
- 30-39 days since last notification: uncured warning, send upgrade
  notice.
- >= 40 days since last notification: prior violation was cured during
  days 30-39 (lastNotificationSent is not cleared when activeDomains
  returns below maxDomains), so treat as a new violation episode and
  send a fresh 30-day warning.

Add unit tests in CheckBulkComplianceActionTest covering never-notified
packages and exact day-29, day-30, day-39, and day-40 boundaries.

BUG= http://b/586480278
@CydeWeys

Copy link
Copy Markdown
Member Author

Closing this without merging.

On further investigation there is no runtime bug here. The daysSinceLastNotification >= FORTY_DAYS check in CheckBulkComplianceAction already behaves as intended:

  • < 30 days: no email
  • 30-39 days: upgrade notice
  • never notified, or >= 40 days: warning

That is the same logic as the original if/else chain from #1867. #2422 collapsed it into a single boolean without changing behavior, but the one-line comment it added describes the opposite of what the code does. That misleading comment is what prompted this PR.

CheckBulkComplianceAction is also not registered in RequestComponent or routing.txt, and it isn't scheduled in any cloud-scheduler-tasks-*.xml. It has never been wired up since it was added in #1798, so this comment-and-test-only change wouldn't affect anything that runs today.

Any future work on this action belongs together under http://b/261763205: routing and scheduling it, finalizing the email templates (still the placeholders from #1867), notification throttling and error handling, and the recipient changes from #1900. If the action is retired instead, that bug tracks deleting it.

@CydeWeys CydeWeys closed this Nov 19, 2026
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.

1 participant