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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user