Skip to content

fix(coderd): show correct deletion time in dormancy notification#26488

Open
zedkipp wants to merge 1 commit into
mainfrom
zedkipp/plat-220-dormancy-notification
Open

fix(coderd): show correct deletion time in dormancy notification#26488
zedkipp wants to merge 1 commit into
mainfrom
zedkipp/plat-220-dormancy-notification

Conversation

@zedkipp

@zedkipp zedkipp commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

The dormancy notification's "will be automatically deleted in X" sentence rendered the dormancy threshold instead of the auto-delete duration. A 30-day threshold rendered as "4 weeks" even when auto-delete was 90 days; a 60-day threshold rendered as "1 month" with a 7-day auto-delete. Render the countdown from the auto-delete setting, and skip the deletion sentence entirely when auto-delete is disabled so the notification no longer promises a deletion that will never happen.

@linear-code

linear-code Bot commented Jun 17, 2026

Copy link
Copy Markdown

PLAT-220

The dormancy notification's "will be automatically deleted in X"
sentence rendered the dormancy threshold instead of the auto-delete
duration. A 30-day threshold rendered as "4 weeks" even when
auto-delete was 90 days; a 60-day threshold rendered as "1 month"
with a 7-day auto-delete. Render the countdown from the auto-delete
setting, and skip the deletion sentence entirely when auto-delete
is disabled so the notification no longer promises a deletion that
will never happen.
@zedkipp zedkipp force-pushed the zedkipp/plat-220-dormancy-notification branch from 7686a27 to b03984c Compare June 17, 2026 20:55
@zedkipp zedkipp requested review from Emyrk and jscottmiller June 17, 2026 21:34
@zedkipp zedkipp marked this pull request as ready for review June 17, 2026 21:34
Comment thread coderd/workspaces.go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Worth testing the new branch in workspaces_test.go?

// Auto-delete must be configured for the body to render a
// deletion timeline.
if tmpl.TimeTilDormantAutoDelete > 0 {
deleteTime := dbtime.Now().Add(time.Duration(tmpl.TimeTilDormantAutoDelete))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rather than generating the delete time with now + offset, we could use the updated DeletingAt returned from UpdateWorkspaceDormantDeletingAt via wsNew (mutating ws as we do with DormantAt). In practice this only saves us a very very minor data race between template updates and this loop and a bit of code duplication, so it isn't a big deal.

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