From 30406735a5ff8ace168009c78f8a37ae3d5e1d86 Mon Sep 17 00:00:00 2001 From: "Jonathan A. Sternberg" Date: Wed, 28 Jan 2026 10:04:37 -0600 Subject: [PATCH] dap: improve file explorer source names Improves the naming for file explorer names when the input relates directly to a source. This is most common when the input is the context (which is just usually a simple source like `local://context`). This should help in most circumstances in determining which input is which. Signed-off-by: Jonathan A. Sternberg --- dap/thread.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dap/thread.go b/dap/thread.go index febd4677e8fa..253d0e874127 100644 --- a/dap/thread.go +++ b/dap/thread.go @@ -549,14 +549,25 @@ func (t *thread) solveInputs(ctx context.Context, target *step) (string, map[str } func (t *thread) determineInputName(op *pb.Op, index int, input *pb.Input) string { - switch op := op.Op.(type) { - case *pb.Op_Exec: - for _, m := range op.Exec.Mounts { + // Attempt to match the input to one of the mount destinations if we have + // an exec operation. + if exec, ok := op.Op.(*pb.Op_Exec); ok { + for _, m := range exec.Exec.Mounts { if m.Input >= 0 && m.Input == int64(index) { return m.Dest } } } + + // Is our input digest a source? Use the identifier if it is. + // That should give us something that is at least more user-friendly. + if op := t.ops[digest.Digest(input.Digest)]; op != nil && input.Index == 0 { + if source, ok := op.Op.(*pb.Op_Source); ok { + return source.Source.Identifier + } + } + + // Use a default name that matches the input digest. return input.Digest }