{{ message }}
Commit b080be4
authored
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.*
1 parent d547bea commit b080be4
5 files changed
Lines changed: 161 additions & 19 deletions
File tree
- coderd
- autobuild
- notifications
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1336 | 1336 | | |
1337 | 1337 | | |
1338 | 1338 | | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
1339 | 1416 | | |
1340 | 1417 | | |
1341 | 1418 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
1514 | 1513 | | |
1515 | 1514 | | |
1516 | 1515 | | |
1517 | | - | |
1518 | | - | |
1519 | | - | |
1520 | | - | |
1521 | | - | |
1522 | | - | |
1523 | | - | |
1524 | | - | |
1525 | | - | |
1526 | | - | |
1527 | | - | |
1528 | | - | |
1529 | | - | |
| 1516 | + | |
1530 | 1517 | | |
1531 | 1518 | | |
1532 | 1519 | | |
| |||
1535 | 1522 | | |
1536 | 1523 | | |
1537 | 1524 | | |
1538 | | - | |
| 1525 | + | |
1539 | 1526 | | |
1540 | 1527 | | |
1541 | 1528 | | |
| |||

0 commit comments