Show which versions retention will delete (#149) #152

Merged
qwc merged 1 commit from feature/version-expiry-hint into main 2026-09-01 19:04:37 +02:00
Owner

Closes #149.

The project detail page listed versions with no sign that some of them are on a clock. The keep pattern and retention window were only visible in the admin edit form, so a reader had no way to tell a permanent release from a branch build about to be swept up.

What it looks like

  • Every version the project's keep pattern does not match gets an Expires in N days badge, counted from its upload date, with the exact due date in the tooltip.
  • A version already past its window reads Expires soon — retention runs hourly, so it goes on the next pass rather than showing a negative count.
  • One line above the list states the rule that produced the badges: "Versions whose tag does not match ^v?\d+\.\d+\.\d+$ are deleted 30 days after upload."

Decisions worth reviewing

  • Nothing is shown when the project has no retention period. That is the shipped default (retention.nonsemver_days = 0), where nothing is ever deleted whatever the pattern says — a badge there would be a lie. If you'd rather see "would expire (retention disabled)", say so and it's a two-line change.
  • versionExpiries mirrors enforceRetentionPolicy exactly — same keep pattern, same permanent-pin exemption (#141), same CreatedAt window. A badge that disagreed with the cleanup pass would be worse than no badge; the tests pin both halves of the pin rule.
  • The hint is shown to everyone who can view the project, not just editors. It explains why a version may vanish, which readers benefit from too.

versionKeeper gained a small extraction (effectiveKeepPattern) so the notice and the predicate cannot drift apart.

Tests

internal/handler/version_expiry_test.go — written first, watched fail:

  • badges appear with the right day count, and only on versions the pattern doesn't keep
  • the rule line shows the effective pattern and window
  • nothing at all when retention is off
  • a permanent pin is exempt; a temporary pin is not

Full Go suite green; docs updated in how-to/version-retention.md per the docs policy.

Assisted-by: Claude Opus 5

Closes #149. The project detail page listed versions with no sign that some of them are on a clock. The keep pattern and retention window were only visible in the admin edit form, so a reader had no way to tell a permanent release from a branch build about to be swept up. ## What it looks like - Every version the project's keep pattern does **not** match gets an `Expires in N days` badge, counted from its upload date, with the exact due date in the tooltip. - A version already past its window reads `Expires soon` — retention runs hourly, so it goes on the next pass rather than showing a negative count. - One line above the list states the rule that produced the badges: *"Versions whose tag does not match `^v?\d+\.\d+\.\d+$` are deleted 30 days after upload."* ## Decisions worth reviewing - **Nothing is shown when the project has no retention period.** That is the shipped default (`retention.nonsemver_days = 0`), where nothing is ever deleted whatever the pattern says — a badge there would be a lie. If you'd rather see "would expire (retention disabled)", say so and it's a two-line change. - **`versionExpiries` mirrors `enforceRetentionPolicy` exactly** — same keep pattern, same permanent-pin exemption (#141), same `CreatedAt` window. A badge that disagreed with the cleanup pass would be worse than no badge; the tests pin both halves of the pin rule. - The hint is shown to everyone who can view the project, not just editors. It explains why a version may vanish, which readers benefit from too. `versionKeeper` gained a small extraction (`effectiveKeepPattern`) so the notice and the predicate cannot drift apart. ## Tests `internal/handler/version_expiry_test.go` — written first, watched fail: - badges appear with the right day count, and only on versions the pattern doesn't keep - the rule line shows the effective pattern and window - nothing at all when retention is off - a permanent pin is exempt; a temporary pin is not Full Go suite green; docs updated in `how-to/version-retention.md` per the docs policy. Assisted-by: Claude Opus 5
Show which versions retention will delete (#149)
All checks were successful
CI / test (pull_request) Successful in 1m27s
CI / build (pull_request) Successful in 52s
CI / docker (pull_request) Has been skipped
638fd0b4d9
The project page listed versions with no sign that some of them are on a
clock. The keep pattern and retention window were only visible in the admin
edit form, so a reader had no way to tell a permanent release from a branch
build about to be swept up.

Every version the project's keep pattern does not match now carries an
"Expires in N days" badge, counting from its upload date, with the exact due
date as the tooltip. One already past its window reads "Expires soon" —
retention runs hourly, so it goes on the next pass. Above the list, one line
states the rule that produced the badges.

versionExpiries mirrors enforceRetentionPolicy deliberately: same keep
pattern, same permanent-pin exemption (#141), same CreatedAt window. A badge
that disagreed with the cleanup pass would be worse than no badge. Nothing is
shown at all when the project has no retention period — the shipped default,
where nothing is ever deleted and an expiry claim would be a lie.

Assisted-by: Claude Opus 5

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Marcel M. Otte <marcel.otte@mmo.to>
qwc merged commit 338faf0285 into main 2026-09-01 19:04:37 +02:00
qwc deleted branch feature/version-expiry-hint 2026-09-01 19:04:37 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
qwc-open/asiakirjat!152
No description provided.