Skip to content

fix(resourcemanager): suspension escalation email quotes true days remaining - #767

Open
JoseSzycho wants to merge 1 commit into
mainfrom
pr-758
Open

JoseSzycho wants to merge 1 commit into
mainfrom
pr-758

Conversation

@JoseSzycho

Copy link
Copy Markdown
Contributor

Problem

When a suspended project crosses more than one notification checkpoint between reconciles (a controller gap, or first contact late into its window), the escalation controller would:

  • send multiple warning emails back-to-back (e.g. "7 days remaining" then "3 days remaining"), and
  • quote the checkpoint value (30/7/3/1) in the email instead of the actual days left — so an org could be told "7 days" when only 2 real days remained.

This is customer-facing and about a deadline that ends in deletion, so a wrong or conflicting countdown is high impact.

Root cause

internal/controllers/resourcemanager/projectsuspension_escalation_controller.go

The email loop passed the fixed checkpoint into sendEscalationWarningEmail (which used it as DaysUntilDeletion) instead of the computed daysRemaining, and had no break, so all due checkpoints fired in one pass.

Fix

  • Collect every now-crossed checkpoint and send one email, quoted at the true daysRemaining (never the checkpoint value).
  • Record checkpoints as notified only after the email is actually sent, so a skipped (no contact email) or errored send is retried later.

Behavior change

Scenario Before After
Gap crossed 7-day + 3-day marks, ~2 days left Two emails: "7 days" + "3 days" One email: "2 days remaining"
Normal single checkpoint (7-day mark) "7 days remaining" "7 days remaining"
Org has no contact email checkpoint not recorded → retried checkpoint not recorded → retried

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.

2 participants