Artifacts: runner-internal turn files move to a Debugging files group

Each recorded artifact now carries a server group (deliverable or debug).
public/ files are deliverables; input/memory/history/output.md, session
exports and private/ scratch are debugging files. The app's Artifacts tab
lists deliverables and the Debug toggle reveals a separate Debugging files
group (older servers fall back to the filename rule); the TUI lists
deliverables first and marks debug rows; artifact search excludes debug
files unless include_debug / --debug-files is set.
This commit is contained in:
2026-11-04 17:43:47 +00:00
parent b5927505cc
commit 57f5219628
24 changed files with 541 additions and 30 deletions
+26 -2
View File
@@ -57,12 +57,34 @@ func runArtifactVisits(steps []protocol.RunStep) []artifactVisit {
if step.Control != nil && step.Control.Visit > 0 {
visit = step.Control.Visit
}
visits = append(visits, artifactVisit{stage: stage, visit: visit, step: step, artifacts: step.PresentedArtifacts()})
visits = append(visits, artifactVisit{stage: stage, visit: visit, step: step, artifacts: deliverablesFirst(step.PresentedArtifacts())})
}
}
return visits
}
// deliverablesFirst orders a visit's artifacts with the stage's deliverables
// ahead of the runner-internal debugging files (marked [dbg] in each row), so
// the files a stage published lead and turn files never crowd them out. The
// order within each group is the recorded order.
func deliverablesFirst(artifacts []protocol.StageArtifact) []protocol.StageArtifact {
ordered := make([]protocol.StageArtifact, 0, len(artifacts))
for _, artifact := range artifacts {
if !artifact.IsDebug() {
ordered = append(ordered, artifact)
}
}
for _, artifact := range artifacts {
if artifact.IsDebug() {
ordered = append(ordered, artifact)
}
}
if len(ordered) == 0 {
return nil
}
return ordered
}
// artifactRef addresses one artifact row in the flat selection order the view
// uses (group order, then recorded order within the group).
type artifactRef struct {
@@ -170,7 +192,9 @@ func artifactRowText(artifact protocol.StageArtifact, widths artifactWidths, wid
// decision depends only on width, so every row's columns stay aligned
// whether or not the marker is shown.
if width >= artifactCursorWidth+artifactMarkerWidth+1+artifactMinName {
if isImageContentType(artifact.ContentType) {
if artifact.IsDebug() {
prefix += "[dbg] "
} else if isImageContentType(artifact.ContentType) {
prefix += "[img] "
} else {
prefix += strings.Repeat(" ", artifactMarkerWidth) + " "
+27
View File
@@ -0,0 +1,27 @@
package tui
import (
"strings"
"testing"
"git.a-wan.net/alan/pipelines/internal/protocol"
)
func TestArtifactsDeliverablesLeadAndDebugFilesAreMarked(t *testing.T) {
artifacts := []protocol.StageArtifact{
{Name: "input.md", ContentType: "text/markdown", Group: protocol.ArtifactGroupDebug},
{Name: "history.md", ContentType: "text/markdown", Group: protocol.ArtifactGroupDebug},
{Name: "public/report.png", ContentType: "image/png", Group: protocol.ArtifactGroupDeliverable},
}
ordered := deliverablesFirst(artifacts)
if ordered[0].Name != "public/report.png" || ordered[1].Name != "input.md" || ordered[2].Name != "history.md" {
t.Fatalf("order = %+v", ordered)
}
widths := artifactWidthsFor([]artifactVisit{{artifacts: ordered}})
if row := artifactRowText(ordered[1], widths, 100, false); !strings.Contains(row, "[dbg] input.md") {
t.Fatalf("debug row not marked: %q", row)
}
if row := artifactRowText(ordered[0], widths, 100, false); !strings.Contains(row, "[img] public/report.png") {
t.Fatalf("deliverable row: %q", row)
}
}