Add shared live run graphs, debugging, editor choice and draft cleanup
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package runinspect
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
)
|
||||
|
||||
func TestDebugLaunchIsFreshAndQueriesExactRunAndVersion(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
workspace := filepath.Join(root, "project")
|
||||
os.Mkdir(workspace, 0700)
|
||||
capture := filepath.Join(root, "capture")
|
||||
t.Setenv("DEBUG_CAPTURE", capture)
|
||||
fake := filepath.Join(root, "opencode")
|
||||
os.WriteFile(fake, []byte("#!/bin/sh\npwd > \"$DEBUG_CAPTURE\"\nprintf '%s\\n' \"$@\" >> \"$DEBUG_CAPTURE\"\n"), 0700)
|
||||
d := New(&protocol.RunDetail{RunSummary: protocol.RunSummary{ID: 7, PipelineID: 4, Version: 2}, Workspace: workspace}, "/bin/pipelines", "ws://example/connect")
|
||||
for _, text := range []string{"inspect 7 --json", "show 4 --version 2 --json", "runs --pipeline 4 --json", "ws://example/connect", "NEW debugging conversation"} {
|
||||
if !strings.Contains(d.Prompt, text) {
|
||||
t.Fatal("debug context omitted authoritative query", text)
|
||||
}
|
||||
}
|
||||
cmd := d.Command(context.Background(), fake)
|
||||
if len(cmd.Args) != 3 || cmd.Args[1] != "--prompt" || cmd.Dir != workspace {
|
||||
t.Fatal("debug resumed a session or lost workspace", cmd.Args, cmd.Dir)
|
||||
}
|
||||
if err := cmd.Run(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := os.ReadFile(capture)
|
||||
if err != nil || !strings.Contains(string(data), d.Prompt) {
|
||||
t.Fatal("OpenCode launch did not receive debug prompt", err)
|
||||
}
|
||||
d.Workspace = filepath.Join(root, "missing")
|
||||
if cmd := d.Command(context.Background(), fake); cmd.Dir != "" {
|
||||
t.Fatal("historical debugging requires deleted workspace")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user