retention: explicit run-history and artifact retention

Add `pipelines retention report` (strictly read-only) and
`pipelines retention apply` (explicit, approval-gated removal) with an age
and/or count policy, protected-run rules, atomic single-transaction removal
and honest database space reclaim. Nothing prunes automatically.
This commit is contained in:
2026-10-17 15:45:46 +01:00
parent b2e920a150
commit 14175eba70
15 changed files with 2127 additions and 12 deletions
+2 -2
View File
@@ -104,7 +104,7 @@ func artifactWidthsFor(visits []artifactVisit) artifactWidths {
for _, artifact := range visit.artifacts {
widths.name = min(artifactMaxName, max(widths.name, lipgloss.Width(ansi.Strip(artifact.Name))))
widths.typ = min(artifactMaxType, max(widths.typ, lipgloss.Width(ansi.Strip(artifact.ContentType))))
widths.size = max(widths.size, lipgloss.Width(humanBytes(artifact.SizeBytes)))
widths.size = max(widths.size, lipgloss.Width(HumanBytes(artifact.SizeBytes)))
}
}
return widths
@@ -182,7 +182,7 @@ func artifactRowText(artifact protocol.StageArtifact, widths artifactWidths, wid
if strings.TrimSpace(contentType) == "" {
contentType = "unknown type"
}
size := humanBytes(artifact.SizeBytes)
size := HumanBytes(artifact.SizeBytes)
gap := strings.Repeat(" ", artifactColumnGap)
nameCell := func(w int) string { return padRight(ansi.Truncate(name, max(1, w), "…"), w) }
typeCell := padRight(ansi.Truncate(contentType, max(1, widths.typ), "…"), widths.typ)
+3 -1
View File
@@ -44,7 +44,9 @@ func artifactsSummary(step protocol.RunStep) string {
return label
}
func humanBytes(size int64) string {
// HumanBytes renders a byte size with binary units. It is the one byte
// formatter shared by the TUI and the CLI, so sizes never diverge.
func HumanBytes(size int64) string {
const unit = 1024
if size < unit {
return fmt.Sprintf("%d B", size)