You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(coderd): show correct deletion time in dormancy notification (backport #26488) (#27895)
Code-only backport of #26488 to `release/2.34`.
The dormancy notification's "will be automatically deleted in X"
sentence rendered the dormancy threshold (`time_til_dormant`) instead of
the auto-delete duration (`time_til_dormant_autodelete`). A 30-day
threshold rendered as "4 weeks" even when auto-delete was configured to
fire much sooner or later, so users were told the wrong deletion date.
Unlike #26488, this backport contains **no migration**. Adding migration
000527 to the 2.34 line would break the migration ordering for
deployments that later upgrade. Instead, the stored notification body is
left untouched and the existing `timeTilDormant` label is populated with
the correct value:
- When the template has auto-delete configured, the label carries the
countdown derived from the workspace's `deleting_at`, which
`UpdateWorkspaceDormantDeletingAt` already computes atomically from
`time_til_dormant_autodelete`.
- When auto-delete is disabled, `deleting_at` is unset and the sentence
cannot be omitted without a body change, so the label falls back to
generic wording: "...will be automatically deleted in line with your
template's auto-deletion policy if it remains inactive."
Upgrading to >= 2.35.1 later applies migration 000527 and the
`timeTilDelete` rename as usual; this patch is fully superseded at that
point.
<details>
<summary>Implementation notes</summary>
- `coderd/autobuild/lifecycle_executor.go`: propagate `wsNew.DeletingAt`
onto `ws` after the dormancy UPDATE and humanize it into the
`timeTilDormant` label.
- `coderd/workspaces.go` (`putWorkspaceDormant`): use
`newWorkspace.DeletingAt` for the label; the template fetch that fed the
wrong duration is removed.
- The label key intentionally stays `timeTilDormant` because the 2.34
notification body (migration 000311) references it; renaming would
require a data migration, which this backport deliberately avoids.
- No feature flag: the change is a pure correctness fix with no schema
or API surface.
- Tests adapted from #26488: `TestNotifications/DormancyAutoDelete`
(lifecycle executor) and
`TestWorkspaceNotifications/Dormant/InitiatorNotOwnerWithAutoDelete`
(API path), plus fallback-wording assertions in the existing
no-auto-delete tests. Both use a 35-day auto-delete so `humanize.Time`
deterministically renders "1 month from now".
</details>
---
*This PR was generated by Coder Agents on behalf of @ibetitsmike.*
0 commit comments