mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 10:45:59 -10:00
Bash discovery launched each Git Bash candidate serially (10 s each), then a PowerShell check, and remembered the proof only in process, so every cold start repeated it in front of the Studio handshake. Candidates are now probed with a hedge, the search shares one budget and falls back with probe_timeout, and a successful launch is persisted keyed by path, size, mtime and content digest (treated as a miss on any doubt). Boot gains shell, prompt and environment phase marks so the start-up trace names every stretch. Refs #11434
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package boot
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"reasonix/internal/contract/event"
|
|
)
|
|
|
|
func TestPhaseObserverReceivesCompletedStretch(t *testing.T) {
|
|
timer := newPhaseTimer()
|
|
var phases []Phase
|
|
timer.observe = func(p Phase) { phases = append(phases, p) }
|
|
timer.mark("sessions")
|
|
if len(phases) != 1 || phases[0].Name != "sessions" || phases[0].D < 0 {
|
|
t.Fatalf("observed phases = %#v", phases)
|
|
}
|
|
if phases[0] != timer.phases[0] {
|
|
t.Fatal("observer did not receive the recorded phase")
|
|
}
|
|
if got := timer.done("assemble"); len(got) != 2 || len(phases) != 2 || phases[1] != got[1] {
|
|
t.Fatalf("final phases = %#v, observed = %#v", got, phases)
|
|
}
|
|
}
|
|
|
|
func TestBuildReportsPhasesToHostBeforeReturning(t *testing.T) {
|
|
isolateConfigHome(t)
|
|
dir := robustTempDir(t)
|
|
t.Chdir(dir)
|
|
writeFile(t, dir, "reasonix.toml", "[environment]\nenabled = false\n")
|
|
var phases []Phase
|
|
ctrl, err := Build(context.Background(), Options{
|
|
Sink: event.Discard,
|
|
OnPhase: func(p Phase) { phases = append(phases, p) },
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer ctrl.Close()
|
|
want := []string{"extensions", "config", "migrations", "sessions", "provider", "shell", "prompt", "environment", "memory", "skills", "mcp", "assemble"}
|
|
if len(phases) != len(want) {
|
|
t.Fatalf("phases = %#v", phases)
|
|
}
|
|
for i, name := range want {
|
|
if phases[i].Name != name || phases[i].D < 0 {
|
|
t.Fatalf("phase %d = %#v, want %s", i, phases[i], name)
|
|
}
|
|
}
|
|
}
|